Ptaff has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/129170

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
1 file changed, 9 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Widgets 
refs/changes/70/129170/1

diff --git a/WidgetRenderer.php b/WidgetRenderer.php
index be5ad33..7d6e1ee 100644
--- a/WidgetRenderer.php
+++ b/WidgetRenderer.php
@@ -3,6 +3,13 @@
  * Class holding functions for displaying widgets.
  */
 
+// Ensure the $wgWidgetsCompileDir global variable exists and set it
+// to the traditional default if it does not.
+
+if (!isset($wgWidgetsCompileDir)) {
+       $wgWidgetsCompileDir = "$IP/extensions/Widgets/compiled_templates/";
+};
+
 class WidgetRenderer {
 
        // A randomly-generated string, used to prevent malicious users from
@@ -16,12 +23,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/" );

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I4651f3fc04f09ca442608f58c1b379430f752d57
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Widgets
Gerrit-Branch: master
Gerrit-Owner: Ptaff <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to