r45518 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r45517‎ | r45518 | r45519 >
Date:21:09, 7 January 2009
Author:aaron
Status:resolved (Comments)
Tags:
Comment:
(bug 16923) New parameter value diff=review for the URL
Modified paths:
  • /trunk/extensions/FlaggedRevs/FlaggedRevs.hooks.php (modified) (history)
  • /trunk/extensions/FlaggedRevs/FlaggedRevs.php (modified) (history)
  • /trunk/phase3/StartProfiler.php (modified) (history)
  • /trunk/phase3/docs/hooks.txt (modified) (history)
  • /trunk/phase3/includes/diff/DifferenceEngine.php (modified) (history)

Diff [purge]

Index: trunk/phase3/docs/hooks.txt
@@ -551,6 +551,13 @@
552552 if implementing a custom editor, e.g. for a special namespace,
553553 etc.
554554
 555+'NewDifferenceEngine': Called when a new DifferenceEngine object is made
 556+$title: the diff page title (nullable)
 557+&$oldId: the actual old Id to use in the diff
 558+&$newId: the actual new Id to use in the diff (0 means current)
 559+$old: the ?old= param value from the url
 560+$new: the ?new= param value from the url
 561+
555562 'DiffViewHeader': called before diff display
556563 $diff: DifferenceEngine object that's calling
557564 $oldRev: Revision object of the "old" revision (may be null/invalid)
Index: trunk/phase3/includes/diff/DifferenceEngine.php
@@ -46,11 +46,8 @@
4747 if ( 'prev' === $new ) {
4848 # Show diff between revision $old and the previous one.
4949 # Get previous one from DB.
50 - #
5150 $this->mNewid = intval($old);
52 -
5351 $this->mOldid = $this->mTitle->getPreviousRevisionID( $this->mNewid );
54 -
5552 } elseif ( 'next' === $new ) {
5653 # Show diff between revision $old and the previous one.
5754 # Get previous one from DB.
@@ -62,10 +59,10 @@
6360 # revision is cur, which is "0".
6461 $this->mNewid = 0;
6562 }
66 -
6763 } else {
6864 $this->mOldid = intval($old);
6965 $this->mNewid = intval($new);
 66+ wfRunHooks( 'NewDifferenceEngine', array(&$titleObj, &$this->mOldid, &$this->mNewid, $old, $new) );
7067 }
7168 $this->mRcidMarkPatrolled = intval($rcid); # force it to be an integer
7269 $this->mRefreshCache = $refreshCache;
Index: trunk/phase3/StartProfiler.php
@@ -1,6 +1,7 @@
22 <?php
33
4 -require_once( dirname(__FILE__).'/includes/ProfilerStub.php' );
 4+require_once( dirname(__FILE__).'/includes/Profiler.php' );
 5+$wgProfiler = new Profiler;
56
67 /**
78 * To use a profiler, delete the line above and add something like this:
Index: trunk/extensions/FlaggedRevs/FlaggedRevs.php
@@ -419,6 +419,8 @@
420420 $wgHooks['EditPageBeforeEditChecks'][] = 'FlaggedRevsHooks::addReviewCheck';
421421 # User stats
422422 $wgHooks['ArticleRollbackComplete'][] = 'FlaggedRevsHooks::incrementRollbacks';
 423+# Add diff url param alias
 424+$wgHooks['NewDifferenceEngine'][] = 'FlaggedRevsHooks::checkDiffUrl';
423425
424426 # Add CSS/JS as needed
425427 $wgHooks['OutputPageParserOutput'][] = 'FlaggedRevsHooks::injectStyleAndJS';
Index: trunk/extensions/FlaggedRevs/FlaggedRevs.hooks.php
@@ -1297,6 +1297,17 @@
12981298 public static function injectReviewDiffURLParams( &$article, &$sectionAnchor, &$extraQuery ) {
12991299 return FlaggedArticle::getInstance( $article )->injectReviewDiffURLParams( $sectionAnchor, $extraQuery );
13001300 }
 1301+
 1302+ public static function checkDiffUrl( $titleObj, &$mOldid, &$mNewid, $old, $new ) {
 1303+ if( $new == 'review' && isset($titleObj) ) {
 1304+ $frev = FlaggedRevision::newFromStable( $titleObj );
 1305+ if( $frev ) {
 1306+ $mOldid = $frev->getRevId(); // stable
 1307+ $mNewid = 0; // cur
 1308+ }
 1309+ }
 1310+ return true;
 1311+ }
13011312
13021313 public static function onDiffViewHeader( $diff, $oldRev, $newRev ) {
13031314 self::injectStyleAndJS();

Comments

#Comment by Brion VIBBER (talk | contribs)   18:47, 13 January 2009

StartProfiler update should not be included!

#Comment by Brion VIBBER (talk | contribs)   18:51, 13 January 2009

That was fixed in r45521. Yay!

Status & tagging log