Index: trunk/extensions/FlaggedRevs/presentation/FlaggedRevsUI.setup.php |
— | — | @@ -88,9 +88,10 @@ |
89 | 89 | * Register FlaggedRevs special pages as needed. |
90 | 90 | * @param $pages Array $wgSpecialPages (list of special pages) |
91 | 91 | * @param $groups Array $wgSpecialPageGroups (assoc array of special page groups) |
| 92 | + * @param $updates Array $wgSpecialPageCacheUpdates (assoc array of special page updaters) |
92 | 93 | * @return void |
93 | 94 | */ |
94 | | - public static function defineSpecialPages( array &$pages, array &$groups ) { |
| 95 | + public static function defineSpecialPages( array &$pages, array &$groups, array &$updates ) { |
95 | 96 | global $wgFlaggedRevsProtection, $wgFlaggedRevsNamespaces, $wgUseTagFilter; |
96 | 97 | |
97 | 98 | // Show special pages only if FlaggedRevs is enabled on some namespaces |
— | — | @@ -109,11 +110,13 @@ |
110 | 111 | $groups['ReviewedPages'] = 'quality'; |
111 | 112 | $pages['UnreviewedPages'] = 'UnreviewedPages'; |
112 | 113 | $groups['UnreviewedPages'] = 'quality'; |
| 114 | + $updates['UnreviewedPages'] = 'UnreviewedPages::updateQueryCache'; |
113 | 115 | } |
114 | 116 | $pages['QualityOversight'] = 'QualityOversight'; |
115 | 117 | $groups['QualityOversight'] = 'quality'; |
116 | 118 | $pages['ValidationStatistics'] = 'ValidationStatistics'; |
117 | 119 | $groups['ValidationStatistics'] = 'quality'; |
| 120 | + $updates['ValidationStatistics'] = 'FlaggedRevsStats::updateCache'; |
118 | 121 | // Protect levels define allowed stability settings |
119 | 122 | if ( $wgFlaggedRevsProtection ) { |
120 | 123 | $pages['StablePages'] = 'StablePages'; |
— | — | @@ -171,6 +174,16 @@ |
172 | 175 | } |
173 | 176 | |
174 | 177 | /** |
| 178 | + * Define AJAX dispatcher functions |
| 179 | + * @param $ajaxExportList Array $wgAjaxExportList |
| 180 | + * @return void |
| 181 | + */ |
| 182 | + public static function defineAjaxFunctions( &$ajaxExportList ) { |
| 183 | + $ajaxExportList[] = 'RevisionReview::AjaxReview'; |
| 184 | + $ajaxExportList[] = 'FlaggablePageView::AjaxBuildDiffHeaderItems'; |
| 185 | + } |
| 186 | + |
| 187 | + /** |
175 | 188 | * Append FlaggedRevs log names and set filterable logs |
176 | 189 | * @param $logNames Array $wgLogNames (assoc array of log name message keys) |
177 | 190 | * @param $logHeaders Array $wgLogHeaders (assoc array of log header message keys) |
Index: trunk/extensions/FlaggedRevs/FlaggedRevs.setup.php |
— | — | @@ -5,7 +5,24 @@ |
6 | 6 | * Note: avoid FlaggedRevs class calls here for performance (like load.php). |
7 | 7 | */ |
8 | 8 | class FlaggedRevsSetup { |
| 9 | + protected static $canLoad = false; |
| 10 | + |
9 | 11 | /** |
| 12 | + * Signal that LocalSettings.php is loaded. |
| 13 | + */ |
| 14 | + public static function setReady() { |
| 15 | + self::$canLoad = true; |
| 16 | + } |
| 17 | + |
| 18 | + /* |
| 19 | + * The FlaggedRevs class uses this as a sanity check. |
| 20 | + * @return bool |
| 21 | + */ |
| 22 | + public static function isReady() { |
| 23 | + return self::$canLoad; |
| 24 | + } |
| 25 | + |
| 26 | + /** |
10 | 27 | * Register FlaggedRevs source code paths. |
11 | 28 | * This function must NOT depend on any config vars. |
12 | 29 | * |
— | — | @@ -289,13 +306,14 @@ |
290 | 307 | } |
291 | 308 | |
292 | 309 | /** |
293 | | - * Set $wgSpecialPages and $wgSpecialPageGroups |
| 310 | + * Set special pages |
294 | 311 | * |
295 | 312 | * @return void |
296 | 313 | */ |
297 | 314 | public static function setSpecialPages() { |
298 | | - global $wgSpecialPages, $wgSpecialPageGroups; |
299 | | - FlaggedRevsUISetup::defineSpecialPages( $wgSpecialPages, $wgSpecialPageGroups ); |
| 315 | + global $wgSpecialPages, $wgSpecialPageGroups, $wgSpecialPageCacheUpdates; |
| 316 | + FlaggedRevsUISetup::defineSpecialPages( |
| 317 | + $wgSpecialPages, $wgSpecialPageGroups, $wgSpecialPageCacheUpdates ); |
300 | 318 | } |
301 | 319 | |
302 | 320 | /** |
Index: trunk/extensions/FlaggedRevs/FlaggedRevs.php |
— | — | @@ -90,6 +90,9 @@ |
91 | 91 | # JS/CSS modules and message bundles used by JS scripts |
92 | 92 | FlaggedRevsUISetup::defineResourceModules( $wgResourceModules ); |
93 | 93 | |
| 94 | +# AJAX functions |
| 95 | +FlaggedRevsUISetup::defineAjaxFunctions( $wgAjaxExportList ); |
| 96 | + |
94 | 97 | # Load the extension after setup is finished |
95 | 98 | $wgExtensionFunctions[] = 'efLoadFlaggedRevs'; |
96 | 99 | |
— | — | @@ -100,7 +103,7 @@ |
101 | 104 | */ |
102 | 105 | function efLoadFlaggedRevs() { |
103 | 106 | # LocalSettings.php loaded, safe to load config |
104 | | - FlaggedRevs::ready(); |
| 107 | + FlaggedRevsSetup::setReady(); |
105 | 108 | |
106 | 109 | # Conditional autopromote groups |
107 | 110 | FlaggedRevsSetup::setAutopromoteConfig(); |
— | — | @@ -117,13 +120,5 @@ |
118 | 121 | FlaggedRevsSetup::setConditionalPreferences(); |
119 | 122 | } |
120 | 123 | |
121 | | -# AJAX functions |
122 | | -$wgAjaxExportList[] = 'RevisionReview::AjaxReview'; |
123 | | -$wgAjaxExportList[] = 'FlaggablePageView::AjaxBuildDiffHeaderItems'; |
124 | | - |
125 | | -# Cache update |
126 | | -$wgSpecialPageCacheUpdates['UnreviewedPages'] = 'UnreviewedPages::updateQueryCache'; |
127 | | -$wgSpecialPageCacheUpdates['ValidationStatistics'] = 'FlaggedRevsStats::updateCache'; |
128 | | - |
129 | 124 | # B/C ... |
130 | 125 | $wgLogActions['rights/erevoke'] = 'rights-editor-revoke'; |
Index: trunk/extensions/FlaggedRevs/dataclasses/FlaggedRevs.class.php |
— | — | @@ -21,22 +21,14 @@ |
22 | 22 | # Autoreview config |
23 | 23 | protected static $autoReviewConfig = 0; |
24 | 24 | |
25 | | - protected static $canLoad = false; |
26 | 25 | protected static $loaded = false; |
27 | 26 | |
28 | | - /** |
29 | | - * Signal that LocalSettings.php is loaded |
30 | | - */ |
31 | | - public static function ready() { |
32 | | - self::$canLoad = true; |
33 | | - } |
34 | | - |
35 | 27 | protected static function load() { |
36 | 28 | global $wgFlaggedRevsTags, $wgFlaggedRevTags; |
37 | 29 | if ( self::$loaded ) { |
38 | 30 | return true; |
39 | 31 | } |
40 | | - if ( !self::$canLoad ) { // sanity |
| 32 | + if ( !FlaggedRevsSetup::isReady() ) { // sanity |
41 | 33 | wfDebugDieBacktrace( 'FlaggedRevs config loaded too soon! Possibly before LocalSettings.php!' ); |
42 | 34 | } |
43 | 35 | self::$loaded = true; |