From: Brion Vibber Date: Sat, 17 May 2008 15:53:58 +0000 (+0000) Subject: Revert r34906, r34907, r34928 -- mixing high-level data into low-level storage functi... X-Git-Tag: 1.31.0-rc.0~47576 X-Git-Url: https://git.heureux-cyclage.org/?a=commitdiff_plain;h=beedd5c5f3fe1b2f82ec6e4e4f8acfcea977e6fe;p=lhc%2Fweb%2Fwiklou.git Revert r34906, r34907, r34928 -- mixing high-level data into low-level storage functions for the sole purpose of passing it off to hooks, which seems very icky to me. It feels like a hook in the wrong place is being used. --- diff --git a/docs/hooks.txt b/docs/hooks.txt index 944b952e55..70ff967bf7 100644 --- a/docs/hooks.txt +++ b/docs/hooks.txt @@ -929,8 +929,6 @@ $user: the User object to load preferences from 'RevisionInsertComplete': called after a revision is inserted into the DB $revision: the Revision -$edit: was this a new edit? -$baseID: what revision ID was this revision based off? (false if none) 'SavePreferences': called at the end of PreferencesForm::savePreferences; returning false prevents the preferences from being saved. diff --git a/includes/Article.php b/includes/Article.php index 3192009f6f..cef4470b9e 100644 --- a/includes/Article.php +++ b/includes/Article.php @@ -1362,11 +1362,10 @@ class Article { * EDIT_NEW is specified and the article does exist, a duplicate key error will cause an exception * to be thrown from the Database. These two conditions are also possible with auto-detection due * to MediaWiki's performance-optimised locking strategy. - * @param integer $baseRevID, the revision ID this is based off * * @return bool success */ - function doEdit( $text, $summary, $flags = 0, $baseRevID = false ) { + function doEdit( $text, $summary, $flags = 0 ) { global $wgUser, $wgDBtransactions; wfProfileIn( __METHOD__ ); @@ -1445,7 +1444,7 @@ class Article { ) ); $dbw->begin(); - $revisionId = $revision->insertOn( $dbw, true, $baseRevID ); + $revisionId = $revision->insertOn( $dbw ); # Update page $ok = $this->updateRevisionOn( $dbw, $revision, $lastRevision ); @@ -1513,7 +1512,7 @@ class Article { 'minor_edit' => $isminor, 'text' => $text ) ); - $revisionId = $revision->insertOn( $dbw, true ); + $revisionId = $revision->insertOn( $dbw ); $this->mTitle->resetArticleID( $newid ); @@ -2525,7 +2524,7 @@ class Article { if( $bot && ($wgUser->isAllowed('markbotedits') || $wgUser->isAllowed('bot')) ) $flags |= EDIT_FORCE_BOT; - $this->doEdit( $target->getText(), $summary, $flags, $target->getId() ); + $this->doEdit( $target->getText(), $summary, $flags ); wfRunHooks( 'ArticleRollbackComplete', array( $this, $wgUser, $target ) ); diff --git a/includes/Revision.php b/includes/Revision.php index 050db2b86f..a6f9604099 100644 --- a/includes/Revision.php +++ b/includes/Revision.php @@ -707,11 +707,9 @@ class Revision { * number on success and dies horribly on failure. * * @param Database $dbw - * @param bool $edit, was this a new edit? (optional) - * @param integer $baseID, what revision was this based on? (optional) * @return int */ - public function insertOn( &$dbw, $edit = false, $baseID = false ) { + public function insertOn( &$dbw ) { global $wgDefaultExternalStore; wfProfileIn( __METHOD__ ); @@ -774,7 +772,7 @@ class Revision { $this->mId = !is_null($rev_id) ? $rev_id : $dbw->insertId(); - wfRunHooks( 'RevisionInsertComplete', array( &$this, $edit, $baseID ) ); + wfRunHooks( 'RevisionInsertComplete', array( &$this ) ); wfProfileOut( __METHOD__ ); return $this->mId; diff --git a/includes/SpecialImport.php b/includes/SpecialImport.php index da7a7662c9..76bd646ab5 100644 --- a/includes/SpecialImport.php +++ b/includes/SpecialImport.php @@ -218,7 +218,7 @@ class ImportReporter { $dbw = wfGetDB( DB_MASTER ); $nullRevision = Revision::newNullRevision( $dbw, $title->getArticleId(), $comment, true ); - $nullRevision->insertOn( $dbw, true ); + $nullRevision->insertOn( $dbw ); # Update page record $article = new Article( $title ); $article->updateRevisionOn( $dbw, $nullRevision ); diff --git a/includes/SpecialUndelete.php b/includes/SpecialUndelete.php index a98e71e887..c0e2e0c20e 100644 --- a/includes/SpecialUndelete.php +++ b/includes/SpecialUndelete.php @@ -514,7 +514,7 @@ class PageArchive { 'deleted' => $unsuppress ? 0 : $row->ar_deleted, 'len' => $row->ar_len ) ); - $revision->insertOn( $dbw, false ); + $revision->insertOn( $dbw ); $restored++; wfRunHooks( 'ArticleRevisionUndeleted', array( &$this->title, $revision, $row->ar_page_id ) ); diff --git a/includes/Title.php b/includes/Title.php index 89e20b0f95..fbbbc798a8 100644 --- a/includes/Title.php +++ b/includes/Title.php @@ -2598,7 +2598,7 @@ class Title { # Save a null revision in the page's history notifying of the move $nullRevision = Revision::newNullRevision( $dbw, $oldid, $comment, true ); - $nullRevId = $nullRevision->insertOn( $dbw, true ); + $nullRevId = $nullRevision->insertOn( $dbw ); # Change the name of the target page: $dbw->update( 'page', @@ -2624,7 +2624,7 @@ class Title { 'page' => $newid, 'comment' => $comment, 'text' => $redirectText ) ); - $redirectRevision->insertOn( $dbw, true ); + $redirectRevision->insertOn( $dbw ); $redirectArticle->updateRevisionOn( $dbw, $redirectRevision, 0 ); # Now, we record the link from the redirect to the new title. @@ -2685,7 +2685,7 @@ class Title { # Save a null revision in the page's history notifying of the move $nullRevision = Revision::newNullRevision( $dbw, $oldid, $comment, true ); - $nullRevId = $nullRevision->insertOn( $dbw, true ); + $nullRevId = $nullRevision->insertOn( $dbw ); # Rename page entry $dbw->update( 'page', @@ -2711,7 +2711,7 @@ class Title { 'page' => $newid, 'comment' => $comment, 'text' => $redirectText ) ); - $redirectRevision->insertOn( $dbw, true ); + $redirectRevision->insertOn( $dbw ); $redirectArticle->updateRevisionOn( $dbw, $redirectRevision, 0 ); # Record the just-created redirect's linking to the page diff --git a/includes/filerepo/ICRepo.php b/includes/filerepo/ICRepo.php index 9f2cc714b6..805dc02ccf 100644 --- a/includes/filerepo/ICRepo.php +++ b/includes/filerepo/ICRepo.php @@ -285,7 +285,7 @@ class ICFile extends LocalFile{ if( $descTitle->exists() ) { # Create a null revision $nullRevision = Revision::newNullRevision( $dbw, $descTitle->getArticleId(), $log->getRcComment(), false ); - $nullRevision->insertOn( $dbw, true ); + $nullRevision->insertOn( $dbw ); $article->updateRevisionOn( $dbw, $nullRevision ); # Invalidate the cache for the description page diff --git a/includes/filerepo/LocalFile.php b/includes/filerepo/LocalFile.php index d341290bad..f96d171870 100644 --- a/includes/filerepo/LocalFile.php +++ b/includes/filerepo/LocalFile.php @@ -858,7 +858,7 @@ class LocalFile extends File if( $descTitle->exists() ) { # Create a null revision $nullRevision = Revision::newNullRevision( $dbw, $descTitle->getArticleId(), $log->getRcComment(), false ); - $nullRevision->insertOn( $dbw, true ); + $nullRevision->insertOn( $dbw ); $article->updateRevisionOn( $dbw, $nullRevision ); # Invalidate the cache for the description page