r102760 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r102759‎ | r102760 | r102761 >
Date:07:46, 11 November 2011
Author:aaron
Status:ok
Tags:
Comment:
* Removed getArticleInstance() and updated callers to use getTitleInstance() directly.
* Moved $wgJobClasses code and setUnconditionalHooks() call.
* Moved b/c $wgLogActions code to defineLogActionHandlers().
* Minor comment tweaks.
Modified paths:
  • /trunk/extensions/FlaggedRevs/FlaggedRevs.php (modified) (history)
  • /trunk/extensions/FlaggedRevs/FlaggedRevs.setup.php (modified) (history)
  • /trunk/extensions/FlaggedRevs/backend/FlaggableWikiPage.php (modified) (history)
  • /trunk/extensions/FlaggedRevs/backend/FlaggedRevs.hooks.php (modified) (history)
  • /trunk/extensions/FlaggedRevs/frontend/FlaggedRevsUI.setup.php (modified) (history)

Diff [purge]

Index: trunk/extensions/FlaggedRevs/FlaggedRevs.php
@@ -48,10 +48,7 @@
4949 $wgExtensionAliasesFiles
5050 );
5151
52 -# Load hooks that are always set
53 -FlaggedRevsSetup::setUnconditionalHooks();
54 -
55 -# Define new rights that FlaggedRevs creates
 52+# Define user rights
5653 $wgAvailableRights[] = 'review'; # review pages to basic quality levels
5754 $wgAvailableRights[] = 'validate'; # review pages to all quality levels
5855 $wgAvailableRights[] = 'autoreview'; # auto-review one's own edits (including rollback)
@@ -64,10 +61,7 @@
6562 # array so that it shows up in sp:ListGroupRights...
6663 $wgGroupPermissions['bot']['autoreview'] = true;
6764
68 -# Special case cache invalidations
69 -$wgJobClasses['flaggedrevs_CacheUpdate'] = 'FRExtraCacheUpdateJob';
70 -
71 -# New user preferences
 65+# Define user preferences
7266 $wgDefaultUserOptions['flaggedrevssimpleui'] = (int)$wgSimpleFlaggedRevsUI;
7367 $wgDefaultUserOptions['flaggedrevsstable'] = FR_SHOW_STABLE_DEFAULT;
7468 $wgDefaultUserOptions['flaggedrevseditdiffs'] = true;
@@ -88,6 +82,12 @@
8983 # AJAX functions
9084 FlaggedRevsUISetup::defineAjaxFunctions( $wgAjaxExportList );
9185
 86+# Special case page cache invalidations
 87+$wgJobClasses['flaggedrevs_CacheUpdate'] = 'FRExtraCacheUpdateJob';
 88+
 89+# Load hooks that are always set
 90+FlaggedRevsSetup::setUnconditionalHooks();
 91+
9292 # Load the extension after setup is finished
9393 $wgExtensionFunctions[] = 'efLoadFlaggedRevs';
9494
@@ -95,6 +95,7 @@
9696 * This function is for setup that has to happen in Setup.php
9797 * when the functions in $wgExtensionFunctions get executed.
9898 * Note: avoid calls to FlaggedRevs class here for performance.
 99+ * @return void
99100 */
100101 function efLoadFlaggedRevs() {
101102 # LocalSettings.php loaded, safe to load config
@@ -114,6 +115,3 @@
115116 # Defaults for user preferences
116117 FlaggedRevsSetup::setConditionalPreferences();
117118 }
118 -
119 -# B/C ...
120 -$wgLogActions['rights/erevoke'] = 'rights-editor-revoke';
Index: trunk/extensions/FlaggedRevs/frontend/FlaggedRevsUI.setup.php
@@ -227,6 +227,9 @@
228228 $logActions['review/unapprove'] = 'review-logentry-dis'; // was checked
229229 $logActions['review/unapprove2'] = 'review-logentry-dis'; // was quality
230230
 231+ # B/C ...
 232+ $logActions['rights/erevoke'] = 'rights-editor-revoke';
 233+
231234 $logActionsHandlers['stable/config'] = 'FlaggedRevsLogView::stabilityLogText'; // customize
232235 $logActionsHandlers['stable/modify'] = 'FlaggedRevsLogView::stabilityLogText'; // re-customize
233236 $logActionsHandlers['stable/reset'] = 'FlaggedRevsLogView::stabilityLogText'; // reset
Index: trunk/extensions/FlaggedRevs/backend/FlaggedRevs.hooks.php
@@ -359,7 +359,7 @@
360360 ) {
361361 global $wgRequest;
362362 # Edit must be non-null, to a reviewable page, with $user set
363 - $fa = FlaggableWikiPage::getArticleInstance( $article );
 363+ $fa = FlaggableWikiPage::getTitleInstance( $article->getTitle() );
364364 $fa->loadPageData( 'fromdbmaster' );
365365 if ( !$rev || !$user || !$fa->isReviewable() ) {
366366 return true;
@@ -540,7 +540,7 @@
541541 if ( !$baseId && !$reviewEdit ) {
542542 return true; // short-circuit
543543 }
544 - $fa = FlaggableWikiPage::getArticleInstance( $article );
 544+ $fa = FlaggableWikiPage::getTitleInstance( $article->getTitle() );
545545 $fa->loadPageData( 'fromdbmaster' );
546546 if ( !$fa->isReviewable() ) {
547547 return true; // page is not reviewable
Index: trunk/extensions/FlaggedRevs/backend/FlaggableWikiPage.php
@@ -17,7 +17,7 @@
1818
1919 /**
2020 * Get a FlaggableWikiPage for a given title
21 - * @param Title
 21+ * @param $title Title
2222 * @return FlaggableWikiPage
2323 */
2424 public static function getTitleInstance( Title $title ) {
@@ -29,15 +29,6 @@
3030 }
3131
3232 /**
33 - * Get a FlaggableWikiPage for a given article
34 - * @param Article
35 - * @return FlaggableWikiPage
36 - */
37 - public static function getArticleInstance( Page $article ) {
38 - return self::getTitleInstance( $article->getTitle() );
39 - }
40 -
41 - /**
4233 * Clear object process cache values
4334 * @return void
4435 */
@@ -54,7 +45,6 @@
5546
5647 /**
5748 * Get the current file version (null if this not a File page)
58 - *
5949 * @return File|null|false
6050 */
6151 public function getFile() {
Index: trunk/extensions/FlaggedRevs/FlaggedRevs.setup.php
@@ -5,20 +5,21 @@
66 * Note: avoid FlaggedRevs class calls here for performance (like load.php).
77 */
88 class FlaggedRevsSetup {
 9+ /* Variable checked by FlaggedRevs::load() */
910 protected static $canLoad = false;
1011
1112 /**
1213 * Signal that LocalSettings.php is loaded.
13 -
 14+ *
1415 * @return void
1516 */
1617 public static function setReady() {
1718 self::$canLoad = true;
1819 }
1920
20 - /*
 21+ /**
2122 * The FlaggedRevs class uses this as a sanity check.
22 -
 23+ *
2324 * @return bool
2425 */
2526 public static function isReady() {

Status & tagging log