Index: trunk/phase3/docs/hooks.txt |
— | — | @@ -551,6 +551,13 @@ |
552 | 552 | if implementing a custom editor, e.g. for a special namespace, |
553 | 553 | etc. |
554 | 554 | |
| 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 | + |
555 | 562 | 'DiffViewHeader': called before diff display |
556 | 563 | $diff: DifferenceEngine object that's calling |
557 | 564 | $oldRev: Revision object of the "old" revision (may be null/invalid) |
Index: trunk/phase3/includes/diff/DifferenceEngine.php |
— | — | @@ -46,11 +46,8 @@ |
47 | 47 | if ( 'prev' === $new ) { |
48 | 48 | # Show diff between revision $old and the previous one. |
49 | 49 | # Get previous one from DB. |
50 | | - # |
51 | 50 | $this->mNewid = intval($old); |
52 | | - |
53 | 51 | $this->mOldid = $this->mTitle->getPreviousRevisionID( $this->mNewid ); |
54 | | - |
55 | 52 | } elseif ( 'next' === $new ) { |
56 | 53 | # Show diff between revision $old and the previous one. |
57 | 54 | # Get previous one from DB. |
— | — | @@ -62,10 +59,10 @@ |
63 | 60 | # revision is cur, which is "0". |
64 | 61 | $this->mNewid = 0; |
65 | 62 | } |
66 | | - |
67 | 63 | } else { |
68 | 64 | $this->mOldid = intval($old); |
69 | 65 | $this->mNewid = intval($new); |
| 66 | + wfRunHooks( 'NewDifferenceEngine', array(&$titleObj, &$this->mOldid, &$this->mNewid, $old, $new) ); |
70 | 67 | } |
71 | 68 | $this->mRcidMarkPatrolled = intval($rcid); # force it to be an integer |
72 | 69 | $this->mRefreshCache = $refreshCache; |
Index: trunk/phase3/StartProfiler.php |
— | — | @@ -1,6 +1,7 @@ |
2 | 2 | <?php |
3 | 3 | |
4 | | -require_once( dirname(__FILE__).'/includes/ProfilerStub.php' ); |
| 4 | +require_once( dirname(__FILE__).'/includes/Profiler.php' ); |
| 5 | +$wgProfiler = new Profiler; |
5 | 6 | |
6 | 7 | /** |
7 | 8 | * To use a profiler, delete the line above and add something like this: |
Index: trunk/extensions/FlaggedRevs/FlaggedRevs.php |
— | — | @@ -419,6 +419,8 @@ |
420 | 420 | $wgHooks['EditPageBeforeEditChecks'][] = 'FlaggedRevsHooks::addReviewCheck'; |
421 | 421 | # User stats |
422 | 422 | $wgHooks['ArticleRollbackComplete'][] = 'FlaggedRevsHooks::incrementRollbacks'; |
| 423 | +# Add diff url param alias |
| 424 | +$wgHooks['NewDifferenceEngine'][] = 'FlaggedRevsHooks::checkDiffUrl'; |
423 | 425 | |
424 | 426 | # Add CSS/JS as needed |
425 | 427 | $wgHooks['OutputPageParserOutput'][] = 'FlaggedRevsHooks::injectStyleAndJS'; |
Index: trunk/extensions/FlaggedRevs/FlaggedRevs.hooks.php |
— | — | @@ -1297,6 +1297,17 @@ |
1298 | 1298 | public static function injectReviewDiffURLParams( &$article, &$sectionAnchor, &$extraQuery ) { |
1299 | 1299 | return FlaggedArticle::getInstance( $article )->injectReviewDiffURLParams( $sectionAnchor, $extraQuery ); |
1300 | 1300 | } |
| 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 | + } |
1301 | 1312 | |
1302 | 1313 | public static function onDiffViewHeader( $diff, $oldRev, $newRev ) { |
1303 | 1314 | self::injectStyleAndJS(); |