X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2FLinksUpdate.php;h=0b7393addbbb9a0dde8bb91a0818e65f099e3318;hb=72f36a8bb3ec8492f82b7bd0c85109ce494acf25;hp=f54487a5ab2b7e3645a38ff7edfaf714a18fe6a1;hpb=3f83da1cdbc6339ac20415f09a307d2695fe70ee;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/LinksUpdate.php b/includes/LinksUpdate.php index f54487a5ab..0b7393addb 100644 --- a/includes/LinksUpdate.php +++ b/includes/LinksUpdate.php @@ -27,7 +27,7 @@ */ class LinksUpdate extends SqlDataUpdate { - // @todo: make members protected, but make sure extensions don't break + // @todo make members protected, but make sure extensions don't break public $mId, //!< Page ID of the article linked from $mTitle, //!< Title object of the article linked from @@ -237,22 +237,36 @@ class LinksUpdate extends SqlDataUpdate { wfProfileOut( __METHOD__ ); } + /** + * Queue recursive jobs for this page + * + * Which means do LinksUpdate on all templates + * that include the current page, using the job queue. + */ function queueRecursiveJobs() { - wfProfileIn( __METHOD__ ); + self::queueRecursiveJobsForTable( $this->mTitle, 'templatelinks' ); + } - if ( $this->mTitle->getBacklinkCache()->hasLinks( 'templatelinks' ) ) { + /** + * Queue a RefreshLinks job for any table. + * + * @param Title $title Title to do job for + * @param String $table Table to use (e.g. 'templatelinks') + */ + public static function queueRecursiveJobsForTable( Title $title, $table ) { + wfProfileIn( __METHOD__ ); + if ( $title->getBacklinkCache()->hasLinks( $table ) ) { $job = new RefreshLinksJob2( - $this->mTitle, + $title, array( - 'table' => 'templatelinks', + 'table' => $table, ) + Job::newRootJobParams( // "overall" refresh links job info - "refreshlinks:templatelinks:{$this->mTitle->getPrefixedText()}" + "refreshlinks:{$table}:{$title->getPrefixedText()}" ) ); JobQueueGroup::singleton()->push( $job ); JobQueueGroup::singleton()->deduplicateRootJob( $job ); } - wfProfileOut( __METHOD__ ); } @@ -354,7 +368,7 @@ class LinksUpdate extends SqlDataUpdate { */ private function getLinkInsertions( $existing = array() ) { $arr = array(); - foreach( $this->mLinks as $ns => $dbkeys ) { + foreach ( $this->mLinks as $ns => $dbkeys ) { $diffs = isset( $existing[$ns] ) ? array_diff_key( $dbkeys, $existing[$ns] ) : $dbkeys; @@ -376,7 +390,7 @@ class LinksUpdate extends SqlDataUpdate { */ private function getTemplateInsertions( $existing = array() ) { $arr = array(); - foreach( $this->mTemplates as $ns => $dbkeys ) { + foreach ( $this->mTemplates as $ns => $dbkeys ) { $diffs = isset( $existing[$ns] ) ? array_diff_key( $dbkeys, $existing[$ns] ) : $dbkeys; foreach ( $diffs as $dbk => $id ) { $arr[] = array( @@ -398,7 +412,7 @@ class LinksUpdate extends SqlDataUpdate { private function getImageInsertions( $existing = array() ) { $arr = array(); $diffs = array_diff_key( $this->mImages, $existing ); - foreach( $diffs as $iname => $dummy ) { + foreach ( $diffs as $iname => $dummy ) { $arr[] = array( 'il_from' => $this->mId, 'il_to' => $iname @@ -415,8 +429,8 @@ class LinksUpdate extends SqlDataUpdate { private function getExternalInsertions( $existing = array() ) { $arr = array(); $diffs = array_diff_key( $this->mExternals, $existing ); - foreach( $diffs as $url => $dummy ) { - foreach( wfMakeUrlIndexes( $url ) as $index ) { + foreach ( $diffs as $url => $dummy ) { + foreach ( wfMakeUrlIndexes( $url ) as $index ) { $arr[] = array( 'el_from' => $this->mId, 'el_to' => $url, @@ -481,7 +495,7 @@ class LinksUpdate extends SqlDataUpdate { private function getInterlangInsertions( $existing = array() ) { $diffs = array_diff_assoc( $this->mInterlangs, $existing ); $arr = array(); - foreach( $diffs as $lang => $title ) { + foreach ( $diffs as $lang => $title ) { $arr[] = array( 'll_from' => $this->mId, 'll_lang' => $lang, @@ -517,7 +531,7 @@ class LinksUpdate extends SqlDataUpdate { */ private function getInterwikiInsertions( $existing = array() ) { $arr = array(); - foreach( $this->mInterwikis as $prefix => $dbkeys ) { + foreach ( $this->mInterwikis as $prefix => $dbkeys ) { $diffs = isset( $existing[$prefix] ) ? array_diff_key( $dbkeys, $existing[$prefix] ) : $dbkeys; foreach ( $diffs as $dbk => $id ) { $arr[] = array(