X-Git-Url: http://git.cyclocoop.org/%7B%7B%20url_for%28%27admin_vote_del%27%2C%20idvote=vote.voteid%29%20%7D%7D?a=blobdiff_plain;f=includes%2FTitle.php;h=1676a1b5438cfa1c5c82ff3c79085bd2dd607ad5;hb=b769c3bbec5b6d0ec46998289eb66f84de2fc5db;hp=526bc929ff229a2e5bf25a29f7ba345ccadedba3;hpb=55c45e57b394b0ecf3e46948ad24c147cabb43a5;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/Title.php b/includes/Title.php index 526bc929ff..1676a1b543 100644 --- a/includes/Title.php +++ b/includes/Title.php @@ -158,6 +158,9 @@ class Title { /** @var TitleValue A corresponding TitleValue object */ private $mTitleValue = null; + + /** @var bool Would deleting this page be a big deletion? */ + private $mIsBigDeletion = null; // @} /** @@ -3271,6 +3274,7 @@ class Title { $this->mEstimateRevisions = null; $this->mPageLanguage = false; $this->mDbPageLanguage = null; + $this->mIsBigDeletion = null; } /** @@ -4377,12 +4381,32 @@ class Title { return false; } - $revCount = $this->estimateRevisionCount(); - return $revCount > $wgDeleteRevisionsLimit; + if ( $this->mIsBigDeletion === null ) { + $dbr = wfGetDB( DB_SLAVE ); + + $innerQuery = $dbr->selectSQLText( + 'revision', + '1', + array( 'rev_page' => $this->getArticleID() ), + __METHOD__, + array( 'LIMIT' => $wgDeleteRevisionsLimit + 1 ) + ); + + $revCount = $dbr->query( + 'SELECT COUNT(*) FROM (' . $innerQuery . ') AS innerQuery', + __METHOD__ + ); + $revCount = $revCount->fetchRow(); + $revCount = $revCount['COUNT(*)']; + + $this->mIsBigDeletion = $revCount > $wgDeleteRevisionsLimit; + } + + return $this->mIsBigDeletion; } /** - * Get the approximate revision count of this page. + * Get the approximate revision count of this page. * * @return int */