r112768 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r112767‎ | r112768 | r112769 >
Date:03:11, 1 March 2012
Author:johnduhart
Status:deferred
Tags:
Comment:
Removed hook for adding configuration variables, use addJsConfigVars instead
Modified paths:
  • /trunk/extensions/ArticleCreationWorkflow/ArticleCreationWorkflow.hooks.php (modified) (history)
  • /trunk/extensions/ArticleCreationWorkflow/ArticleCreationWorkflow.php (modified) (history)
  • /trunk/extensions/ArticleCreationWorkflow/SpecialArticleCreationLanding.php (modified) (history)

Diff [purge]

Index: trunk/extensions/ArticleCreationWorkflow/ArticleCreationWorkflow.php
@@ -33,8 +33,6 @@
3434 $wgHooks['ArticleSaveComplete'][] = 'ArticleCreationHooks::trackEditSuccess';
3535 $wgHooks['EditPage::attemptSave'][] = 'ArticleCreationHooks::trackEditAttempt';
3636
37 -$wgHooks['MakeGlobalVariablesScript'][] = 'ArticleCreationHooks::getGlobalVariables';
38 -
3937 /* Internationalization */
4038 $wgExtensionMessagesFiles['ArticleCreation'] = $articleCreationDir . 'ArticleCreationWorkflow.i18n.php';
4139
Index: trunk/extensions/ArticleCreationWorkflow/ArticleCreationWorkflow.hooks.php
@@ -61,25 +61,6 @@
6262 return true;
6363 }
6464
65 - public static function getGlobalVariables( &$vars ) {
66 - global $wgArticleCreationConfig, $wgUser, $wgArticleCreationButtons, $wgTitle;
67 -
68 - if ( ! $wgTitle->isSpecial( 'ArticleCreationLanding' ) ) {
69 - return true;
70 - }
71 -
72 - $vars['acConfig'] = $wgArticleCreationConfig +
73 - array(
74 - 'enabled' => ArticleCreationUtil::isEnabled(),
75 - 'tracking-turned-on' => ArticleCreationUtil::trackingEnabled(),
76 - 'tracking-code-prefix' => ArticleCreationUtil::trackingCodePrefix(),
77 - 'variant' => ArticleCreationTemplates::getLandingVariant( $wgTitle ),
78 - 'acwbucket' => ArticleCreationUtil::trackingBucket(),
79 - );
80 -
81 - return true;
82 - }
83 -
8465 public static function configSearchTitle( &$vars ) {
8566 global $wgRequest;
8667
Index: trunk/extensions/ArticleCreationWorkflow/SpecialArticleCreationLanding.php
@@ -33,9 +33,27 @@
3434 $out->setRobotPolicy( 'noindex,nofollow' );
3535 $out->addModules( 'ext.articleCreation.core' );
3636 $out->addModules( 'ext.articleCreation.user' );
 37+ $out->addJsConfigVars( 'acConfig', $this->getConfigVars() );
3738 $out->addHtml( ArticleCreationTemplates::getLandingPage($par) );
3839
3940 ArticleCreationUtil::TrackSpecialLandingPage( $par );
4041 }
 42+
 43+ /**
 44+ * Returns the javascript configuration
 45+ *
 46+ * @return array
 47+ */
 48+ protected function getConfigVars() {
 49+ global $wgArticleCreationConfig;
 50+
 51+ return $wgArticleCreationConfig + array(
 52+ 'enabled' => ArticleCreationUtil::isEnabled(),
 53+ 'tracking-turned-on' => ArticleCreationUtil::trackingEnabled(),
 54+ 'tracking-code-prefix' => ArticleCreationUtil::trackingCodePrefix(),
 55+ 'variant' => ArticleCreationTemplates::getLandingVariant( $this->getTitle() ),
 56+ 'acwbucket' => ArticleCreationUtil::trackingBucket(),
 57+ );
 58+ }
4159
4260 }

Status & tagging log