Yaron Koren has submitted this change and it was merged.

Change subject: Allow user-defined path for compiled templates.
......................................................................


Allow user-defined path for compiled templates.

This allows the Widgets plugin to be used in wikifarms and keeps
compatibility with previous versions; solves bug 37678.

Change-Id: I4651f3fc04f09ca442608f58c1b379430f752d57
---
M WidgetRenderer.php
M Widgets.php
2 files changed, 5 insertions(+), 2 deletions(-)

Approvals:
  Yaron Koren: Verified; Looks good to me, approved



diff --git a/WidgetRenderer.php b/WidgetRenderer.php
index be5ad33..e5a9647 100644
--- a/WidgetRenderer.php
+++ b/WidgetRenderer.php
@@ -16,12 +16,12 @@
        }
 
        public static function renderWidget( &$parser, $widgetName ) {
-               global $IP;
+               global $IP, $wgWidgetsCompileDir;
 
                $smarty = new Smarty;
                $smarty->left_delimiter = '<!--{';
                $smarty->right_delimiter = '}-->';
-               $smarty->compile_dir = 
"$IP/extensions/Widgets/compiled_templates/";
+               $smarty->compile_dir = $wgWidgetsCompileDir;
 
                // registering custom Smarty plugins
                $smarty->addPluginsDir( 
"$IP/extensions/Widgets/smarty_plugins/" );
diff --git a/Widgets.php b/Widgets.php
index 576441c..7a0efd9 100644
--- a/Widgets.php
+++ b/Widgets.php
@@ -47,6 +47,9 @@
 // Set this to true to use FlaggedRevs extension's stable version for widget 
security
 $wgWidgetsUseFlaggedRevs = false;
 
+// Set a default directory for storage of compiled templates
+$wgWidgetsCompileDir = "$IP/extensions/Widgets/compiled_templates/";
+
 $dir = dirname( __FILE__ ) . '/';
 
 // Initialize Smarty

-- 
To view, visit https://gerrit.wikimedia.org/r/129170
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I4651f3fc04f09ca442608f58c1b379430f752d57
Gerrit-PatchSet: 3
Gerrit-Project: mediawiki/extensions/Widgets
Gerrit-Branch: master
Gerrit-Owner: Ptaff <wikimedia.wa...@ptaff.ca>
Gerrit-Reviewer: Ptaff <wikimedia.wa...@ptaff.ca>
Gerrit-Reviewer: Yaron Koren <yaro...@gmail.com>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to