[FileBackend] Added back ability to delete file HTTP headers.
[lhc/web/wiklou.git] / includes / LinksUpdate.php
index 87db4d6..fd1fefb 100644 (file)
@@ -49,6 +49,7 @@ class LinksUpdate extends SqlDataUpdate {
         * @param $title Title of the page we're updating
         * @param $parserOutput ParserOutput: output from a full parse of this page
         * @param $recursive Boolean: queue jobs for recursive updates?
+        * @throws MWException
         */
        function __construct( $title, $parserOutput, $recursive = true ) {
                parent::__construct( false ); // no implicit transaction
@@ -71,6 +72,7 @@ class LinksUpdate extends SqlDataUpdate {
                }
 
                $this->mParserOutput = $parserOutput;
+
                $this->mLinks = $parserOutput->getLinks();
                $this->mImages = $parserOutput->getImages();
                $this->mTemplates = $parserOutput->getTemplates();
@@ -828,6 +830,10 @@ class LinksDeletionUpdate extends SqlDataUpdate {
                parent::__construct( false ); // no implicit transaction
 
                $this->mPage = $page;
+
+               if ( !$page->exists() ) {
+                       throw new MWException( "Page ID not known, perhaps the page doesn't exist?" );
+               }
        }
 
        /**
@@ -879,4 +885,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 )
+               );
+       }
 }