X-Git-Url: https://git.cyclocoop.org/%242?a=blobdiff_plain;f=includes%2FLinksUpdate.php;h=e2e860a15059934a25b12d3e751cbc9d5ca5981a;hb=12166f46b4d63d3fd3cab68cf4c7090a1646dd09;hp=1d0bcf78d22e0e882442f2bb1cdcf044247f1043;hpb=444ab875f97080cfd14f50dd51855439c795cfd6;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/LinksUpdate.php b/includes/LinksUpdate.php index 1d0bcf78d2..e2e860a150 100644 --- a/includes/LinksUpdate.php +++ b/includes/LinksUpdate.php @@ -51,7 +51,7 @@ class LinksUpdate extends SqlDataUpdate { * @param $recursive Boolean: queue jobs for recursive updates? */ function __construct( $title, $parserOutput, $recursive = true ) { - parent::__construct( ); + parent::__construct( false ); // no implicit transaction if ( !( $title instanceof Title ) ) { throw new MWException( "The calling convention to LinksUpdate::LinksUpdate() has changed. " . @@ -71,6 +71,7 @@ class LinksUpdate extends SqlDataUpdate { } $this->mParserOutput = $parserOutput; + $this->mLinks = $parserOutput->getLinks(); $this->mImages = $parserOutput->getImages(); $this->mTemplates = $parserOutput->getTemplates(); @@ -825,9 +826,13 @@ class LinksDeletionUpdate extends SqlDataUpdate { * @param $page WikiPage Page we are updating */ function __construct( WikiPage $page ) { - parent::__construct( ); + parent::__construct( false ); // no implicit transaction $this->mPage = $page; + + if ( !$page->getId() ) { + throw new MWException( "Page ID not known, perhaps the page doesn't exist?" ); + } } /** @@ -879,4 +884,16 @@ class LinksDeletionUpdate extends SqlDataUpdate { __METHOD__ ); } } + + /** + * Update all the appropriate counts in the category table. + * @param $added array associative array of category name => sort key + * @param $deleted array associative array of category name => sort key + */ + function updateCategoryCounts( $added, $deleted ) { + $a = WikiPage::factory( $this->mTitle ); + $a->updateCategoryCounts( + array_keys( $added ), array_keys( $deleted ) + ); + } }