public function processSynonym( $synonym ) { $dbr = wfGetDB( DB_SLAVE ); $pCount = 0; $vCount = 0; $this->output( "Fixing pages with template links to $synonym ...\n" ); while ( true ) { $res = $dbr->select( 'templatelinks', array( 'tl_title', 'tl_from' ), array( 'tl_namespace' => NS_TEMPLATE, 'tl_title ' . $dbr->buildLike( $synonym, $dbr->anyString() ) ), __METHOD__, array( 'ORDER BY' => array( 'tl_title', 'tl_from' ), 'LIMIT' => $this->batchsize ) ); if ( $dbr->numRows( $res ) == 0 ) { // No more rows, we're done break; } $processed = array(); foreach ( $res as $row ) { $vCount++; if ( isset( $processed[$row->tl_from] ) ) { // We've already processed this page, skip it continue; } RefreshLinks::fixLinksFromArticle( $row->tl_from ); $processed[$row->tl_from] = true; $pCount++; } $this->output( "{$pCount}/{$vCount} pages processed\n" ); wfWaitForSlaves(); } }
/** * Perform an edit from the update data * @throws OAIError */ function doEdit() { $title = $this->getTitle(); if (is_null($title)) { throw new OAIError(sprintf("Bad title for update to page #%d; cannot apply update: \"%s\"", $this->getArticleId(), $this->_page['title'])); } $id = 0; foreach ($this->_page['revisions'] as $revision) { $id = $this->applyRevision($revision); } RefreshLinks::fixLinksFromArticle($id); if (isset($this->_page['uploads'])) { foreach ($this->_page['uploads'] as $upload) { $this->applyUpload($upload); } } }