Index: trunk/extensions/FlaggedRevs/FlaggedRevs.php |
— | — | @@ -74,6 +74,9 @@ |
75 | 75 | # Add stable/current revision tabs. May be redundant due to the tags. |
76 | 76 | $wgFlaggedRevTabs = false; |
77 | 77 | |
| 78 | +# Allowed namespaces of reviewable pages |
| 79 | +$wgFlaggedRevsNamespaces = array( NS_MAIN ); |
| 80 | + |
78 | 81 | # Revision tagging can slow development... |
79 | 82 | # For example, the main user base may become complacent, |
80 | 83 | # perhaps treat flagged pages as "done", |
— | — | @@ -84,7 +87,8 @@ |
85 | 88 | $wgFlaggedRevsOverride = true; |
86 | 89 | # Can users make comments that will show up below flagged revisions? |
87 | 90 | $wgFlaggedRevComments = false; |
88 | | -# Make user's watch pages when reviewed if they watch pages that they edit |
| 91 | +# Automatically checks the 'watch' box on the review form if they set |
| 92 | +# "watch pages I edit" as true at [[Special:Preferences]]. |
89 | 93 | $wgFlaggedRevsWatch = true; |
90 | 94 | # Redirect users out to review changes since stable version on save? |
91 | 95 | $wgReviewChangesAfterEdit = true; |
— | — | @@ -536,6 +540,17 @@ |
537 | 541 | } |
538 | 542 | return $min; |
539 | 543 | } |
| 544 | + |
| 545 | + /** |
| 546 | + * Is this page in reviewable namespace? |
| 547 | + * @param Title, $title |
| 548 | + * @returns bool |
| 549 | + */ |
| 550 | + public static function isReviewable( $title ) { |
| 551 | + global $wgFlaggedRevsNamespaces; |
| 552 | + |
| 553 | + return in_array($title->getNamespace(),$wgFlaggedRevsNamespaces); |
| 554 | + } |
540 | 555 | |
541 | 556 | ######### Hooked functions ######### |
542 | 557 | |
— | — | @@ -684,7 +699,7 @@ |
685 | 700 | $fname = 'FlaggedRevs::extraLinksUpdate'; |
686 | 701 | wfProfileIn( $fname ); |
687 | 702 | |
688 | | - if( !$linksUpdate->mTitle->isContentPage() ) |
| 703 | + if( !FlaggedRevs::isReviewable( $linksUpdate->mTitle ) ) |
689 | 704 | return true; |
690 | 705 | # Check if this page has a stable version |
691 | 706 | $sv = $wgFlaggedRevs->getOverridingRev( $linksUpdate->mTitle, true, true ); |
— | — | @@ -1089,11 +1104,10 @@ |
1090 | 1105 | */ |
1091 | 1106 | public static function maybeUpdateMainCache( $article, &$outputDone, &$pcache ) { |
1092 | 1107 | global $wgUser, $action; |
1093 | | - // Only trigger on article view for content pages, not for protect/delete/hist |
1094 | | - if( !$article || !$article->exists() || !$article->mTitle->isContentPage() || $action !='view' ) |
| 1108 | + // Only trigger on article view for content pages, not for protect/delete/hist |
| 1109 | + if( $action !='view' || !$wgUser->isAllowed( 'review' ) ) |
1095 | 1110 | return true; |
1096 | | - // User must have review rights |
1097 | | - if( !$wgUser->isAllowed( 'review' ) ) |
| 1111 | + if( !$article || !$article->exists() || !FlaggedRevs::isReviewable( $article->mTitle ) ) |
1098 | 1112 | return true; |
1099 | 1113 | |
1100 | 1114 | $parserCache =& ParserCache::singleton(); |
— | — | @@ -1145,9 +1159,11 @@ |
1146 | 1160 | static function pageOverride() { |
1147 | 1161 | global $wgTitle, $wgFlaggedRevsAnonOnly, $wgFlaggedRevsOverride, $wgUser, $wgRequest, $action; |
1148 | 1162 | # This only applies to viewing content pages |
1149 | | - if( $action !='view' || !$wgTitle->isContentPage() ) return; |
| 1163 | + if( $action !='view' || !FlaggedRevs::isReviewable( $wgTitle ) ) |
| 1164 | + return; |
1150 | 1165 | # Does not apply to diffs/old revisions |
1151 | | - if( $wgRequest->getVal('oldid') || $wgRequest->getVal('diff') ) return; |
| 1166 | + if( $wgRequest->getVal('oldid') || $wgRequest->getVal('diff') ) |
| 1167 | + return; |
1152 | 1168 | # Does the stable version override the current one? |
1153 | 1169 | if( $wgFlaggedRevsOverride ) { |
1154 | 1170 | # If $wgFlaggedRevsAnonOnly is set to false, stable version are only requested explicitly |
— | — | @@ -1169,7 +1185,7 @@ |
1170 | 1186 | function setPageContent( $article, &$outputDone, &$pcache ) { |
1171 | 1187 | global $wgRequest, $wgTitle, $wgOut, $action, $wgUser; |
1172 | 1188 | // Only trigger on article view for content pages, not for protect/delete/hist |
1173 | | - if( !$article || !$article->exists() || !$article->mTitle->isContentPage() || $action !='view' ) |
| 1189 | + if( $action !='view' || !$article || !$article->exists() || !FlaggedRevs::isReviewable( $article->mTitle ) ) |
1174 | 1190 | return true; |
1175 | 1191 | // Grab page and rev ids |
1176 | 1192 | $pageid = $article->getId(); |
— | — | @@ -1289,7 +1305,7 @@ |
1290 | 1306 | function addToEditView( $editform ) { |
1291 | 1307 | global $wgRequest, $wgTitle, $wgOut; |
1292 | 1308 | // Talk pages cannot be validated |
1293 | | - if( !$editform->mArticle || !$wgTitle->isContentPage() ) |
| 1309 | + if( !$editform->mArticle || !FlaggedRevs::isReviewable( $wgTitle ) ) |
1294 | 1310 | return false; |
1295 | 1311 | // Find out revision id |
1296 | 1312 | if( $editform->mArticle->mRevision ) { |
— | — | @@ -1343,10 +1359,10 @@ |
1344 | 1360 | function addReviewForm( $out ) { |
1345 | 1361 | global $wgArticle, $wgRequest, $action; |
1346 | 1362 | |
1347 | | - if( !$wgArticle || !$wgArticle->exists() || !$wgArticle->mTitle->isContentPage() || $action !='view' ) |
| 1363 | + if( !$wgArticle || !$wgArticle->exists() || !FlaggedRevs::isReviewable( $wgArticle->mTitle ) ) |
1348 | 1364 | return true; |
1349 | 1365 | // Check if page is protected |
1350 | | - if( !$wgArticle->mTitle->quickUserCan( 'edit' ) ) { |
| 1366 | + if( $action !='view' || !$wgArticle->mTitle->quickUserCan( 'edit' ) ) { |
1351 | 1367 | return true; |
1352 | 1368 | } |
1353 | 1369 | // Get revision ID |
— | — | @@ -1384,7 +1400,7 @@ |
1385 | 1401 | global $wgHooks; |
1386 | 1402 | // Are we using the popular cite extension? |
1387 | 1403 | if( in_array('wfSpecialCiteNav',$wgHooks['SkinTemplateBuildNavUrlsNav_urlsAfterPermalink']) ) { |
1388 | | - if( $sktmp->mTitle->isContentPage() && $revid !== 0 ) { |
| 1404 | + if( FlaggedRevs::isReviewable( $sktmp->mTitle ) && $revid !== 0 ) { |
1389 | 1405 | $nav_urls['cite'] = array( |
1390 | 1406 | 'text' => wfMsg( 'cite_article_link' ), |
1391 | 1407 | 'href' => $sktmp->makeSpecialUrl( 'Cite', "page=" . wfUrlencode( "{$sktmp->thispage}" ) . "&id={$tfrev->fr_rev_id}" ) |
— | — | @@ -1402,7 +1418,7 @@ |
1403 | 1419 | return true; |
1404 | 1420 | $title = $sktmp->mTitle->getSubjectPage(); |
1405 | 1421 | // Non-content pages cannot be validated |
1406 | | - if( !$title->isContentPage() || !$title->exists() ) |
| 1422 | + if( !FlaggedRevs::isReviewable( $title ) || !$title->exists() ) |
1407 | 1423 | return true; |
1408 | 1424 | $article = new Article( $title ); |
1409 | 1425 | // If we are viewing a page normally, and it was overridden, |
Index: trunk/extensions/FlaggedRevs/FlaggedRevsPage_body.php |
— | — | @@ -41,7 +41,7 @@ |
42 | 42 | $this->oldid = $wgRequest->getIntOrNull( 'oldid' ); |
43 | 43 | // Must be a valid content page |
44 | 44 | $this->page = Title::newFromUrl( $this->target ); |
45 | | - if( !$this->target || !$this->oldid || !$this->page->isContentPage() ) { |
| 45 | + if( !$this->target || !$this->oldid || !FlaggedRevs::isReviewable( $this->page ) ) { |
46 | 46 | $wgOut->addHTML( wfMsgExt('revreview-main',array('parse')) ); |
47 | 47 | return; |
48 | 48 | } |
— | — | @@ -593,7 +593,7 @@ |
594 | 594 | |
595 | 595 | // Must be a valid page/Id |
596 | 596 | $page = Title::newFromUrl( $this->page ); |
597 | | - if( is_null($page) || !$page->isContentPage() ) { |
| 597 | + if( is_null($page) || !FlaggedRevs::isReviewable( $page ) ) { |
598 | 598 | $wgOut->showErrorPage('notargettitle', 'allpagesbadtitle' ); |
599 | 599 | return; |
600 | 600 | } |
— | — | @@ -710,7 +710,7 @@ |
711 | 711 | } |
712 | 712 | |
713 | 713 | function getNamespaceMenu( $selected=NULL, $allnamespaces = null, $includehidden=false ) { |
714 | | - global $wgContLang, $wgContentNamespaces; |
| 714 | + global $wgContLang, $wgFlaggedRevsNamespaces; |
715 | 715 | |
716 | 716 | $selector = "<label for='namespace'>" . wfMsgHtml('namespace') . "</label>"; |
717 | 717 | if( $selected !== '' ) { |
— | — | @@ -727,7 +727,7 @@ |
728 | 728 | |
729 | 729 | foreach($arr as $index => $name) { |
730 | 730 | # Content only |
731 | | - if($index < NS_MAIN || !in_array($index, $wgContentNamespaces) ) |
| 731 | + if($index < NS_MAIN || !in_array($index, $wgFlaggedRevsNamespaces) ) |
732 | 732 | continue; |
733 | 733 | |
734 | 734 | $name = $index !== 0 ? $name : wfMsg('blanknamespace'); |
— | — | @@ -768,12 +768,12 @@ |
769 | 769 | } |
770 | 770 | |
771 | 771 | function getSQLText( &$dbr, $namespace, $showOutdated, $category ) { |
772 | | - global $wgContentNamespaces; |
| 772 | + global $wgFlaggedRevsNamespaces; |
773 | 773 | |
774 | 774 | list($page,$flaggedrevs,$categorylinks) = $dbr->tableNamesN('page','flaggedrevs','categorylinks'); |
775 | 775 | # Must be a content page... |
776 | | - if( is_null($namespace) || !in_array($namespace,$wgContentNamespaces) ) { |
777 | | - $where = 'page_namespace IN(' . implode(',',$wgContentNamespaces) . ') '; |
| 776 | + if( is_null($namespace) || !in_array($namespace,$wgFlaggedRevsNamespaces) ) { |
| 777 | + $where = 'page_namespace IN(' . implode(',',$wgFlaggedRevsNamespaces) . ') '; |
778 | 778 | } else { |
779 | 779 | $where = "page_namespace={$namespace} "; |
780 | 780 | } |