X-Git-Url: http://git.cyclocoop.org/%7B%24www_url%7Dadmin/membres/fiche.php?a=blobdiff_plain;f=includes%2Fpage%2FWikiPage.php;h=e1d9f99ed62b1300e02331fbee381fc0eedf6a5a;hb=bb8608c98a3d677d8557dd7056a7434c7c38c055;hp=40665010a1755999f6028c82863bd85d5285f45b;hpb=4b282b3ffafce6c8f12bef4e5a7bbb8b80c51571;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/page/WikiPage.php b/includes/page/WikiPage.php index 40665010a1..e1d9f99ed6 100644 --- a/includes/page/WikiPage.php +++ b/includes/page/WikiPage.php @@ -2883,7 +2883,14 @@ class WikiPage implements Page, IDBAccessObject { // unless they actually try to catch exceptions (which is rare). // we need to remember the old content so we can use it to generate all deletion updates. - $content = $this->getContent( Revision::RAW ); + try { + $content = $this->getContent( Revision::RAW ); + } catch ( Exception $ex ) { + wfLogWarning( __METHOD__ . ': failed to load content during deletion! ' + . $ex->getMessage() ); + + $content = null; + } // Bitfields to further suppress the content if ( $suppress ) { @@ -3024,8 +3031,16 @@ class WikiPage implements Page, IDBAccessObject { * may already return null when the page proper was deleted. */ public function doDeleteUpdates( $id, Content $content = null ) { + try { + $countable = $this->isCountable(); + } catch ( Exception $ex ) { + // fallback for deleting broken pages for which we cannot load the content for + // some reason. Note that doDeleteArticleReal() already logged this problem. + $countable = false; + } + // Update site status - DeferredUpdates::addUpdate( new SiteStatsUpdate( 0, 1, - (int)$this->isCountable(), -1 ) ); + DeferredUpdates::addUpdate( new SiteStatsUpdate( 0, 1, - (int)$countable, -1 ) ); // Delete pagelinks, update secondary indexes, etc $updates = $this->getDeletionUpdates( $content ); @@ -3641,7 +3656,14 @@ class WikiPage implements Page, IDBAccessObject { if ( !$content ) { // load content object, which may be used to determine the necessary updates. // XXX: the content may not be needed to determine the updates. - $content = $this->getContent( Revision::RAW ); + try { + $content = $this->getContent( Revision::RAW ); + } catch ( Exception $ex ) { + // If we can't load the content, something is wrong. Perhaps that's why + // the user is trying to delete the page, so let's not fail in that case. + // Note that doDeleteArticleReal() will already have logged an issue with + // loading the content. + } } if ( !$content ) {