X-Git-Url: https://git.cyclocoop.org/%242?a=blobdiff_plain;f=includes%2FWikiPage.php;h=fffd5f644eb55c929ab78ebaa5ffadc5f38b0d91;hb=2f5914c2ce4c612920dd96f5ef66e3bd342d2195;hp=8e9b0a04629591e4285a53f994774289ca2e4209;hpb=d0bdc038e85a0fed58f898557589720ba8d9af00;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/WikiPage.php b/includes/WikiPage.php index 8e9b0a0462..fffd5f644e 100644 --- a/includes/WikiPage.php +++ b/includes/WikiPage.php @@ -1761,9 +1761,9 @@ class WikiPage extends Page { $parserCache->save( $editInfo->output, $this, $editInfo->popts ); } - # Update the links tables - $u = new LinksUpdate( $this->mTitle, $editInfo->output ); - $u->doUpdate(); + # Update the links tables and other secondary data + $updates = $editInfo->output->getSecondaryDataUpdates( $this->mTitle ); + DataUpdate::runUpdates( $updates ); wfRunHooks( 'ArticleEditUpdates', array( &$this, &$editInfo, $options['changed'] ) ); @@ -2248,57 +2248,18 @@ class WikiPage extends Page { /** * Do some database updates after deletion * - * @param $id Int: page_id value of the page being deleted + * @param $id Int: page_id value of the page being deleted (B/C, currently unused) */ public function doDeleteUpdates( $id ) { + # update site status DeferredUpdates::addUpdate( new SiteStatsUpdate( 0, 1, - (int)$this->isCountable(), -1 ) ); - $dbw = wfGetDB( DB_MASTER ); - - # Delete restrictions for it - $dbw->delete( 'page_restrictions', array ( 'pr_page' => $id ), __METHOD__ ); - - # Fix category table counts - $cats = array(); - $res = $dbw->select( 'categorylinks', 'cl_to', array( 'cl_from' => $id ), __METHOD__ ); - - foreach ( $res as $row ) { - $cats [] = $row->cl_to; - } - - $this->updateCategoryCounts( array(), $cats ); - - # If using cascading deletes, we can skip some explicit deletes - if ( !$dbw->cascadingDeletes() ) { - $dbw->delete( 'revision', array( 'rev_page' => $id ), __METHOD__ ); - - # Delete outgoing links - $dbw->delete( 'pagelinks', array( 'pl_from' => $id ), __METHOD__ ); - $dbw->delete( 'imagelinks', array( 'il_from' => $id ), __METHOD__ ); - $dbw->delete( 'categorylinks', array( 'cl_from' => $id ), __METHOD__ ); - $dbw->delete( 'templatelinks', array( 'tl_from' => $id ), __METHOD__ ); - $dbw->delete( 'externallinks', array( 'el_from' => $id ), __METHOD__ ); - $dbw->delete( 'langlinks', array( 'll_from' => $id ), __METHOD__ ); - $dbw->delete( 'iwlinks', array( 'iwl_from' => $id ), __METHOD__ ); - $dbw->delete( 'redirect', array( 'rd_from' => $id ), __METHOD__ ); - $dbw->delete( 'page_props', array( 'pp_page' => $id ), __METHOD__ ); - } - - # If using cleanup triggers, we can skip some manual deletes - if ( !$dbw->cleanupTriggers() ) { - # Clean up recentchanges entries... - $dbw->delete( 'recentchanges', - array( 'rc_type != ' . RC_LOG, - 'rc_namespace' => $this->mTitle->getNamespace(), - 'rc_title' => $this->mTitle->getDBkey() ), - __METHOD__ ); - $dbw->delete( 'recentchanges', - array( 'rc_type != ' . RC_LOG, 'rc_cur_id' => $id ), - __METHOD__ ); - } + # remove secondary indexes, etc + $updates = $this->getDeletionUpdates( ); + DataUpdate::runUpdates( $updates ); # Clear caches - self::onArticleDelete( $this->mTitle ); + WikiPage::onArticleDelete( $this->mTitle ); # Reset this object $this->clear(); @@ -2875,6 +2836,7 @@ class WikiPage extends Page { if ( count( $templates_diff ) > 0 ) { # Whee, link updates time. + # Note: we are only interested in links here. We don't need to get other DataUpdate items from the parser output. $u = new LinksUpdate( $this->mTitle, $parserOutput, false ); $u->doUpdate(); } @@ -3003,6 +2965,16 @@ class WikiPage extends Page { global $wgUser; return $this->isParserCacheUsed( ParserOptions::newFromUser( $wgUser ), $oldid ); } + + public function getDeletionUpdates() { + $updates = array( + new LinksDeletionUpdate( $this ), + ); + + //@todo: make a hook to add update objects + //NOTE: deletion updates will be determined by the ContentHandler in the future + return $updates; + } } class PoolWorkArticleView extends PoolCounterWork {