$mCategories, //!< Map of category names to sort keys
$mInterlangs, //!< Map of language codes to titles
$mProperties, //!< Map of arbitrary name to value
- $mDb, //!< Database connection reference
- $mOptions, //!< SELECT options to be used (array)
$mRecursive; //!< Whether to queue jobs for recursive updates
/**
}
$this->mParserOutput = $parserOutput;
+
$this->mLinks = $parserOutput->getLinks();
$this->mImages = $parserOutput->getImages();
$this->mTemplates = $parserOutput->getTemplates();
**/
class LinksDeletionUpdate extends SqlDataUpdate {
- protected $mPage; //!< WikiPage the wikipage that was deleted
+ protected $mTitle; //!< Title the title of page that was deleted
/**
* Constructor
*
* @param $page WikiPage Page we are updating
*/
- function __construct( WikiPage $page ) {
+ function __construct( Title $title ) {
parent::__construct( );
- $this->mPage = $page;
+ $this->mTitle = $title;
+
+ if ( !$title->getArticleID() ) {
+ throw new MWException( "The Title object did not provide an article ID. Perhaps the page doesn't exist?" );
+ }
}
/**
* Do some database updates after deletion
*/
public function doUpdate() {
- $title = $this->mPage->getTitle();
- $id = $this->mPage->getId();
+ $title = $this->mTitle;
+ $id = $title->getArticleID();
# Delete restrictions for it
$this->mDb->delete( 'page_restrictions', array ( 'pr_page' => $id ), __METHOD__ );
$cats [] = $row->cl_to;
}
- $this->mPage->updateCategoryCounts( array(), $cats );
+ $this->updateCategoryCounts( array(), $cats );
# If using cascading deletes, we can skip some explicit deletes
if ( !$this->mDb->cascadingDeletes() ) {
__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 )
+ );
+ }
}