r61627 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r61626‎ | r61627 | r61628 >
Date:10:37, 28 January 2010
Author:aaron
Status:ok
Tags:
Comment:
More hook arranging/style tweaks
Modified paths:
  • /trunk/extensions/FlaggedRevs/FlaggedRevs.php (modified) (history)

Diff [purge]

Index: trunk/extensions/FlaggedRevs/FlaggedRevs.php
@@ -404,61 +404,9 @@
405405 $wgAutoloadClasses['ApiStabilize'] = $dir . 'api/ApiStabilize.php';
406406 $wgAPIModules['stabilize'] = 'ApiStabilize';
407407
408 -# ######## Hook triggered data operations #########
409 -# Autopromote Editors
410 -$wgHooks['ArticleSaveComplete'][] = 'FlaggedRevsHooks::maybeMakeEditor';
411 -# Adds table link references to include ones from the stable version
412 -$wgHooks['LinksUpdate'][] = 'FlaggedRevsHooks::extraLinksUpdate';
413 -# Clear dead config rows
414 -$wgHooks['ArticleDeleteComplete'][] = 'FlaggedRevsHooks::onArticleDelete';
415 -$wgHooks['ArticleRevisionVisiblitySet'][] = 'FlaggedRevsHooks::onRevisionDelete';
416 -$wgHooks['TitleMoveComplete'][] = 'FlaggedRevsHooks::onTitleMoveComplete';
417 -# Check on undelete/merge for changes to stable version
418 -$wgHooks['ArticleMergeComplete'][] = 'FlaggedRevsHooks::updateFromMerge';
419 -$wgHooks['ArticleRevisionUndeleted'][] = 'FlaggedRevsHooks::onRevisionRestore';
420 -# Parser hooks, selects the desired images/templates
421 -$wgHooks['ParserClearState'][] = 'FlaggedRevsHooks::parserAddFields';
422 -$wgHooks['BeforeGalleryFindFile'][] = 'FlaggedRevsHooks::galleryFindStableFileTime';
423 -$wgHooks['BeforeParserFetchTemplateAndtitle'][] = 'FlaggedRevsHooks::parserFetchStableTemplate';
424 -$wgHooks['BeforeParserMakeImageLinkObj'][] = 'FlaggedRevsHooks::parserMakeStableFileLink';
425 -# Additional parser versioning
426 -$wgHooks['ParserAfterTidy'][] = 'FlaggedRevsHooks::parserInjectTimestamps';
427 -$wgHooks['OutputPageParserOutput'][] = 'FlaggedRevsHooks::outputInjectTimestamps';
428 -# Auto-reviewing
429 -$wgHooks['RecentChange_save'][] = 'FlaggedRevsHooks::autoMarkPatrolled';
430 -$wgHooks['NewRevisionFromEditComplete'][] = 'FlaggedRevsHooks::maybeMakeEditReviewed';
431 -# Determine what pages can be moved and patrolled
432 -$wgHooks['userCan'][] = 'FlaggedRevsHooks::onUserCan';
433 -# Log parameter
434 -$wgHooks['LogLine'][] = 'FlaggedRevsHooks::logLineLinks';
435 -# Disable auto-promotion for demoted users
436 -$wgHooks['UserRights'][] = 'FlaggedRevsHooks::recordDemote';
437 -# User stats
438 -$wgHooks['ArticleRollbackComplete'][] = 'FlaggedRevsHooks::incrementRollbacks';
439 -$wgHooks['NewRevisionFromEditComplete'][] = 'FlaggedRevsHooks::incrementReverts';
440 -# Null edit review via checkbox
441 -$wgHooks['ArticleSaveComplete'][] = 'FlaggedRevsHooks::maybeNullEditReview';
442 -# Special auto-promote
443 -$wgHooks['GetAutoPromoteGroups'][] = 'FlaggedRevsHooks::checkAutoPromote';
444 -# Save stability settings
445 -$wgHooks['ProtectionForm::save'][] = 'FlaggedRevsHooks::onProtectionSave';
 408+######## HOOK TRIGGERED FUNCTIONS #########
446409
447 -# Actually register special pages
448 -$wgHooks['SpecialPage_initList'][] = 'efLoadFlaggedRevsSpecialPages';
449 -
450 -# Stable dump hook
451 -$wgHooks['WikiExporter::dumpStableQuery'][] = 'FlaggedRevsHooks::stableDumpQuery';
452 -# ########
453 -
454 -
455 -# ######## Hook triggered UI operations #########
456 -# Local user account preference
457 -$wgHooks['GetPreferences'][] = 'FlaggedRevsHooks::onGetPreferences';
458 -# Show unreviewed pages links
459 -$wgHooks['CategoryPageView'][] = 'FlaggedRevsHooks::onCategoryPageView';
460 -# Backlog notice
461 -$wgHooks['SiteNoticeAfter'][] = 'FlaggedRevsHooks::addBacklogNotice';
462 -
 410+# ######## User interface #########
463411 # Override current revision, add patrol links, set cache...
464412 $wgHooks['ArticleViewHeader'][] = 'FlaggedRevsHooks::onArticleViewHeader';
465413 $wgHooks['ImagePageFindFile'][] = 'FlaggedRevsHooks::imagePageFindFile';
@@ -495,29 +443,88 @@
496444 $wgHooks['ArticleUpdateBeforeRedirect'][] = 'FlaggedRevsHooks::injectPostEditURLParams';
497445 # Diff-to-stable
498446 $wgHooks['DiffViewHeader'][] = 'FlaggedRevsHooks::onDiffViewHeader';
 447+# Add diff=review url param alias
 448+$wgHooks['NewDifferenceEngine'][] = 'FlaggedRevsHooks::checkDiffUrl';
499449 # Autoreview stuff
500450 $wgHooks['EditPage::showEditForm:fields'][] = 'FlaggedRevsHooks::addRevisionIDField';
501451 $wgHooks['EditPageBeforeEditChecks'][] = 'FlaggedRevsHooks::addReviewCheck';
502 -# Add diff url param alias
503 -$wgHooks['NewDifferenceEngine'][] = 'FlaggedRevsHooks::checkDiffUrl';
504 -# Check if a page is currently being reviewed
505 -$wgHooks['MediaWikiPerformAction'][] = 'FlaggedRevsHooks::markUnderReview';
 452+# Local user account preference
 453+$wgHooks['GetPreferences'][] = 'FlaggedRevsHooks::onGetPreferences';
 454+# Show unreviewed pages links
 455+$wgHooks['CategoryPageView'][] = 'FlaggedRevsHooks::onCategoryPageView';
 456+# Backlog notice
 457+$wgHooks['SiteNoticeAfter'][] = 'FlaggedRevsHooks::addBacklogNotice';
 458+# Review/stability log links
 459+$wgHooks['LogLine'][] = 'FlaggedRevsHooks::logLineLinks';
506460
507461 # Add CSS/JS as needed
508462 $wgHooks['BeforePageDisplay'][] = 'FlaggedRevsHooks::onBeforePageDisplay';
509463 $wgHooks['MakeGlobalVariablesScript'][] = 'FlaggedRevsHooks::injectGlobalJSVars';
510464
 465+# Add flagging data to ApiQueryRevisions
 466+$wgHooks['APIGetAllowedParams'][] = 'FlaggedRevsApiHooks::addApiRevisionParams';
 467+$wgHooks['APIQueryAfterExecute'][] = 'FlaggedRevsApiHooks::addApiRevisionData';
 468+# ########
 469+
 470+# ######## Parser #########
 471+# Parser hooks, selects the desired images/templates
 472+$wgHooks['ParserClearState'][] = 'FlaggedRevsHooks::parserAddFields';
 473+$wgHooks['BeforeParserFetchTemplateAndtitle'][] = 'FlaggedRevsHooks::parserFetchStableTemplate';
 474+$wgHooks['BeforeParserMakeImageLinkObj'][] = 'FlaggedRevsHooks::parserMakeStableFileLink';
 475+$wgHooks['BeforeGalleryFindFile'][] = 'FlaggedRevsHooks::galleryFindStableFileTime';
 476+# Additional parser versioning
 477+$wgHooks['ParserAfterTidy'][] = 'FlaggedRevsHooks::parserInjectTimestamps';
 478+$wgHooks['OutputPageParserOutput'][] = 'FlaggedRevsHooks::outputInjectTimestamps';
 479+# ########
 480+
 481+# ######## DB write operations #########
 482+# Autopromote Editors
 483+$wgHooks['ArticleSaveComplete'][] = 'FlaggedRevsHooks::maybeMakeEditor';
 484+# Auto-reviewing
 485+$wgHooks['RecentChange_save'][] = 'FlaggedRevsHooks::autoMarkPatrolled';
 486+$wgHooks['NewRevisionFromEditComplete'][] = 'FlaggedRevsHooks::maybeMakeEditReviewed';
 487+# Disable auto-promotion for demoted users
 488+$wgHooks['UserRights'][] = 'FlaggedRevsHooks::recordDemote';
 489+# User edit tallies
 490+$wgHooks['ArticleRollbackComplete'][] = 'FlaggedRevsHooks::incrementRollbacks';
 491+$wgHooks['NewRevisionFromEditComplete'][] = 'FlaggedRevsHooks::incrementReverts';
 492+# Null edit review via checkbox
 493+$wgHooks['ArticleSaveComplete'][] = 'FlaggedRevsHooks::maybeNullEditReview';
 494+# Save stability settings
 495+$wgHooks['ProtectionForm::save'][] = 'FlaggedRevsHooks::onProtectionSave';
511496 # Extra cache updates for stable versions
512497 $wgHooks['HTMLCacheUpdate::doUpdate'][] = 'FlaggedRevsHooks::doCacheUpdate';
 498+# Updates stable version tracking data
 499+$wgHooks['LinksUpdate'][] = 'FlaggedRevsHooks::extraLinksUpdate';
 500+# Clear dead config rows
 501+$wgHooks['ArticleDeleteComplete'][] = 'FlaggedRevsHooks::onArticleDelete';
 502+$wgHooks['ArticleRevisionVisiblitySet'][] = 'FlaggedRevsHooks::onRevisionDelete';
 503+$wgHooks['TitleMoveComplete'][] = 'FlaggedRevsHooks::onTitleMoveComplete';
 504+# Check on undelete/merge for changes to stable version
 505+$wgHooks['ArticleMergeComplete'][] = 'FlaggedRevsHooks::updateFromMerge';
 506+$wgHooks['ArticleRevisionUndeleted'][] = 'FlaggedRevsHooks::onRevisionRestore';
 507+# ########
513508
 509+# ######## Other #########
 510+# Determine what pages can be moved and patrolled
 511+$wgHooks['userCan'][] = 'FlaggedRevsHooks::onUserCan';
 512+# Implicit autoreview rights group
 513+$wgHooks['GetAutoPromoteGroups'][] = 'FlaggedRevsHooks::checkAutoPromote';
 514+
 515+# Check if a page is currently being reviewed
 516+$wgHooks['MediaWikiPerformAction'][] = 'FlaggedRevsHooks::markUnderReview';
 517+
 518+# Actually register special pages
 519+$wgHooks['SpecialPage_initList'][] = 'efLoadFlaggedRevsSpecialPages';
 520+# Stable dump hook
 521+$wgHooks['WikiExporter::dumpStableQuery'][] = 'FlaggedRevsHooks::stableDumpQuery';
 522+
514523 # Duplicate flagged* tables in parserTests.php
515524 $wgHooks['ParserTestTables'][] = 'FlaggedRevsHooks::onParserTestTables';
516 -
517 -# Add flagging data to ApiQueryRevisions
518 -$wgHooks['APIGetAllowedParams'][] = 'FlaggedRevsApiHooks::addApiRevisionParams';
519 -$wgHooks['APIQueryAfterExecute'][] = 'FlaggedRevsApiHooks::addApiRevisionData';
520525 # ########
521526
 527+######## END HOOK TRIGGERED FUNCTIONS #########
 528+
522529 function efLoadFlaggedRevs() {
523530 global $wgUseRCPatrol, $wgFlaggedRevsNamespaces, $wgFlaggedRevsVisible;
524531 # If patrolling is already on, then we know that it
@@ -549,28 +556,29 @@
550557 global $wgSpecialPages, $wgUseTagFilter;
551558 global $wgFlaggedRevsNamespaces, $wgFlaggedRevsOverride, $wgFlaggedRevsProtectLevels;
552559 // Show special pages only if FlaggedRevs is enabled on some namespaces
553 - if ( !empty( $wgFlaggedRevsNamespaces ) ) {
554 - $list['RevisionReview'] = $wgSpecialPages['RevisionReview'] = 'RevisionReview';
555 - $list['ReviewedVersions'] = $wgSpecialPages['ReviewedVersions'] = 'ReviewedVersions';
556 - // Protect levels define allowed stability settings
557 - if ( empty( $wgFlaggedRevsProtectLevels ) ) {
558 - $list['Stabilization'] = $wgSpecialPages['Stabilization'] = 'Stabilization';
559 - }
560 - $list['UnreviewedPages'] = $wgSpecialPages['UnreviewedPages'] = 'UnreviewedPages';
561 - $list['OldReviewedPages'] = $wgSpecialPages['OldReviewedPages'] = 'OldReviewedPages';
562 - // Show tag filtered pending edit page if there are tags
563 - if ( $wgUseTagFilter && ChangeTags::listDefinedTags() ) {
564 - $list['ProblemChanges'] = $wgSpecialPages['ProblemChanges'] = 'ProblemChanges';
565 - }
566 - $list['ReviewedPages'] = $wgSpecialPages['ReviewedPages'] = 'ReviewedPages';
567 - $list['QualityOversight'] = $wgSpecialPages['QualityOversight'] = 'QualityOversight';
568 - $list['ValidationStatistics'] = $wgSpecialPages['ValidationStatistics'] = 'ValidationStatistics';
569 - if ( !$wgFlaggedRevsOverride ) {
570 - $list['StablePages'] = $wgSpecialPages['StablePages'] = 'StablePages';
571 - } else {
572 - $list['UnstablePages'] = $wgSpecialPages['UnstablePages'] = 'UnstablePages';
573 - }
 560+ if ( empty( $wgFlaggedRevsNamespaces ) ) {
 561+ return true;
574562 }
 563+ $list['RevisionReview'] = $wgSpecialPages['RevisionReview'] = 'RevisionReview';
 564+ $list['ReviewedVersions'] = $wgSpecialPages['ReviewedVersions'] = 'ReviewedVersions';
 565+ // Protect levels define allowed stability settings
 566+ if ( empty( $wgFlaggedRevsProtectLevels ) ) {
 567+ $list['Stabilization'] = $wgSpecialPages['Stabilization'] = 'Stabilization';
 568+ }
 569+ $list['UnreviewedPages'] = $wgSpecialPages['UnreviewedPages'] = 'UnreviewedPages';
 570+ $list['OldReviewedPages'] = $wgSpecialPages['OldReviewedPages'] = 'OldReviewedPages';
 571+ // Show tag filtered pending edit page if there are tags
 572+ if ( $wgUseTagFilter && ChangeTags::listDefinedTags() ) {
 573+ $list['ProblemChanges'] = $wgSpecialPages['ProblemChanges'] = 'ProblemChanges';
 574+ }
 575+ $list['ReviewedPages'] = $wgSpecialPages['ReviewedPages'] = 'ReviewedPages';
 576+ $list['QualityOversight'] = $wgSpecialPages['QualityOversight'] = 'QualityOversight';
 577+ $list['ValidationStatistics'] = $wgSpecialPages['ValidationStatistics'] = 'ValidationStatistics';
 578+ if ( !$wgFlaggedRevsOverride ) {
 579+ $list['StablePages'] = $wgSpecialPages['StablePages'] = 'StablePages';
 580+ } else {
 581+ $list['UnstablePages'] = $wgSpecialPages['UnstablePages'] = 'UnstablePages';
 582+ }
575583 return true;
576584 }
577585

Status & tagging log