r34906 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r34905‎ | r34906 | r34907 >
Date:03:17, 16 May 2008
Author:aaron
Status:old
Tags:
Comment:
Decrappify edit check for revision hook
Modified paths:
  • /trunk/extensions/FlaggedRevs/FlaggedRevs.php (modified) (history)
  • /trunk/phase3/docs/hooks.txt (modified) (history)
  • /trunk/phase3/includes/Article.php (modified) (history)
  • /trunk/phase3/includes/Revision.php (modified) (history)
  • /trunk/phase3/includes/SpecialImport.php (modified) (history)
  • /trunk/phase3/includes/SpecialUndelete.php (modified) (history)
  • /trunk/phase3/includes/Title.php (modified) (history)
  • /trunk/phase3/includes/filerepo/ICRepo.php (modified) (history)
  • /trunk/phase3/includes/filerepo/LocalFile.php (modified) (history)

Diff [purge]

Index: trunk/phase3/docs/hooks.txt
@@ -919,6 +919,7 @@
920920
921921 'RevisionInsertComplete': called after a revision is inserted into the DB
922922 $revision: the Revision
 923+$edit: was this a new edit?
923924
924925 'SavePreferences': called at the end of PreferencesForm::savePreferences;
925926 returning false prevents the preferences from being saved.
Index: trunk/phase3/includes/SpecialImport.php
@@ -218,7 +218,7 @@
219219 $dbw = wfGetDB( DB_MASTER );
220220 $nullRevision = Revision::newNullRevision(
221221 $dbw, $title->getArticleId(), $comment, true );
222 - $nullRevision->insertOn( $dbw );
 222+ $nullRevision->insertOn( $dbw, true );
223223 # Update page record
224224 $article = new Article( $title );
225225 $article->updateRevisionOn( $dbw, $nullRevision );
Index: trunk/phase3/includes/Article.php
@@ -1444,7 +1444,7 @@
14451445 ) );
14461446
14471447 $dbw->begin();
1448 - $revisionId = $revision->insertOn( $dbw );
 1448+ $revisionId = $revision->insertOn( $dbw, true );
14491449
14501450 # Update page
14511451 $ok = $this->updateRevisionOn( $dbw, $revision, $lastRevision );
@@ -1512,7 +1512,7 @@
15131513 'minor_edit' => $isminor,
15141514 'text' => $text
15151515 ) );
1516 - $revisionId = $revision->insertOn( $dbw );
 1516+ $revisionId = $revision->insertOn( $dbw, true );
15171517
15181518 $this->mTitle->resetArticleID( $newid );
15191519
Index: trunk/phase3/includes/filerepo/LocalFile.php
@@ -862,7 +862,7 @@
863863 if( $descTitle->exists() ) {
864864 # Create a null revision
865865 $nullRevision = Revision::newNullRevision( $dbw, $descTitle->getArticleId(), $log->getRcComment(), false );
866 - $nullRevision->insertOn( $dbw );
 866+ $nullRevision->insertOn( $dbw, true );
867867 $article->updateRevisionOn( $dbw, $nullRevision );
868868
869869 # Invalidate the cache for the description page
Index: trunk/phase3/includes/filerepo/ICRepo.php
@@ -285,7 +285,7 @@
286286 if( $descTitle->exists() ) {
287287 # Create a null revision
288288 $nullRevision = Revision::newNullRevision( $dbw, $descTitle->getArticleId(), $log->getRcComment(), false );
289 - $nullRevision->insertOn( $dbw );
 289+ $nullRevision->insertOn( $dbw, true );
290290 $article->updateRevisionOn( $dbw, $nullRevision );
291291
292292 # Invalidate the cache for the description page
Index: trunk/phase3/includes/Revision.php
@@ -707,9 +707,10 @@
708708 * number on success and dies horribly on failure.
709709 *
710710 * @param Database $dbw
 711+ * @param bool $edit, was this a new edit? (optional)
711712 * @return int
712713 */
713 - public function insertOn( &$dbw ) {
 714+ public function insertOn( &$dbw, $edit=false ) {
714715 global $wgDefaultExternalStore;
715716
716717 wfProfileIn( __METHOD__ );
@@ -772,7 +773,7 @@
773774
774775 $this->mId = !is_null($rev_id) ? $rev_id : $dbw->insertId();
775776
776 - wfRunHooks( 'RevisionInsertComplete', array( &$this ) );
 777+ wfRunHooks( 'RevisionInsertComplete', array( &$this, $edit ) );
777778
778779 wfProfileOut( __METHOD__ );
779780 return $this->mId;
Index: trunk/phase3/includes/SpecialUndelete.php
@@ -514,7 +514,7 @@
515515 'deleted' => $unsuppress ? 0 : $row->ar_deleted,
516516 'len' => $row->ar_len
517517 ) );
518 - $revision->insertOn( $dbw );
 518+ $revision->insertOn( $dbw, false );
519519 $restored++;
520520
521521 wfRunHooks( 'ArticleRevisionUndeleted', array( &$this->title, $revision, $row->ar_page_id ) );
Index: trunk/phase3/includes/Title.php
@@ -2596,7 +2596,7 @@
25972597
25982598 # Save a null revision in the page's history notifying of the move
25992599 $nullRevision = Revision::newNullRevision( $dbw, $oldid, $comment, true );
2600 - $nullRevId = $nullRevision->insertOn( $dbw );
 2600+ $nullRevId = $nullRevision->insertOn( $dbw, true );
26012601
26022602 # Change the name of the target page:
26032603 $dbw->update( 'page',
@@ -2622,7 +2622,7 @@
26232623 'page' => $newid,
26242624 'comment' => $comment,
26252625 'text' => $redirectText ) );
2626 - $redirectRevision->insertOn( $dbw );
 2626+ $redirectRevision->insertOn( $dbw, true );
26272627 $redirectArticle->updateRevisionOn( $dbw, $redirectRevision, 0 );
26282628
26292629 # Now, we record the link from the redirect to the new title.
@@ -2683,7 +2683,7 @@
26842684
26852685 # Save a null revision in the page's history notifying of the move
26862686 $nullRevision = Revision::newNullRevision( $dbw, $oldid, $comment, true );
2687 - $nullRevId = $nullRevision->insertOn( $dbw );
 2687+ $nullRevId = $nullRevision->insertOn( $dbw, true );
26882688
26892689 # Rename page entry
26902690 $dbw->update( 'page',
@@ -2709,7 +2709,7 @@
27102710 'page' => $newid,
27112711 'comment' => $comment,
27122712 'text' => $redirectText ) );
2713 - $redirectRevision->insertOn( $dbw );
 2713+ $redirectRevision->insertOn( $dbw, true );
27142714 $redirectArticle->updateRevisionOn( $dbw, $redirectRevision, 0 );
27152715
27162716 # Record the just-created redirect's linking to the page
Index: trunk/extensions/FlaggedRevs/FlaggedRevs.php
@@ -1910,11 +1910,6 @@
19111911 if( !$wgRequest->wasPosted() ) {
19121912 return false;
19131913 }
1914 - # Sent to page title or Special:MovePage
1915 - $move = SpecialPage::getTitleFor( 'MovePage' );
1916 - if( !in_array( $wgRequest->getVal('title'), array($title->getPrefixedDBkey(),$move->getPrefixedDBkey()) ) ) {
1917 - return false;
1918 - }
19191914 # Must be by this user
19201915 if( $wgUser->getId() ) {
19211916 if( $rev->getUser() != $wgUser->getId() ) {
@@ -1933,7 +1928,7 @@
19341929 * When an edit is made by a reviewer, if the current revision is the stable
19351930 * version, try to automatically review it.
19361931 */
1937 - public static function maybeMakeEditReviewed( $rev ) {
 1932+ public static function maybeMakeEditReviewed( $rev, $edit ) {
19381933 global $wgFlaggedRevsAutoReview, $wgFlaggedArticle, $wgRequest;
19391934 # Get the user
19401935 $user = User::newFromId( $rev->getUser() );

Follow-up revisions

RevisionCommit summaryAuthorDate
r34982Revert r34906, r34907, r34928 -- mixing high-level data into low-level storag...brion15:53, 17 May 2008

Status & tagging log