"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "maintenance/refreshLinks.php" between
mediawiki-1.31.1.tar.gz and mediawiki-1.32.0.tar.gz

About: MediaWiki is a wiki engine (the collaborative editing software that runs for e.g. Wikipedia, the free encyclopedia).

refreshLinks.php  (mediawiki-1.31.1):refreshLinks.php  (mediawiki-1.32.0)
skipping to change at line 24 skipping to change at line 24
* *
* You should have received a copy of the GNU General Public License along * You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc., * with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* http://www.gnu.org/copyleft/gpl.html * http://www.gnu.org/copyleft/gpl.html
* *
* @file * @file
* @ingroup Maintenance * @ingroup Maintenance
*/ */
use MediaWiki\MediaWikiServices;
use Wikimedia\Rdbms\IDatabase; use Wikimedia\Rdbms\IDatabase;
require_once __DIR__ . '/Maintenance.php'; require_once __DIR__ . '/Maintenance.php';
/** /**
* Maintenance script to refresh link tables. * Maintenance script to refresh link tables.
* *
* @ingroup Maintenance * @ingroup Maintenance
*/ */
class RefreshLinks extends Maintenance { class RefreshLinks extends Maintenance {
skipping to change at line 261 skipping to change at line 262
} }
/** /**
* Run LinksUpdate for all links on a given page_id * Run LinksUpdate for all links on a given page_id
* @param int $id The page_id * @param int $id The page_id
* @param int|bool $ns Only fix links if it is in this namespace * @param int|bool $ns Only fix links if it is in this namespace
*/ */
public static function fixLinksFromArticle( $id, $ns = false ) { public static function fixLinksFromArticle( $id, $ns = false ) {
$page = WikiPage::newFromID( $id ); $page = WikiPage::newFromID( $id );
LinkCache::singleton()->clear(); MediaWikiServices::getInstance()->getLinkCache()->clear();
if ( $page === null ) { if ( $page === null ) {
return; return;
} elseif ( $ns !== false } elseif ( $ns !== false
&& !$page->getTitle()->inNamespace( $ns ) ) { && !$page->getTitle()->inNamespace( $ns ) ) {
return; return;
} }
$content = $page->getContent( Revision::RAW ); // Defer updates to post-send but then immediately execute deferr
if ( $content === null ) { ed updates;
return; // this is the simplest way to run all updates immediately (inclu
} ding updates
// scheduled by other updates).
$updates = $content->getSecondaryDataUpdates( $page->doSecondaryDataUpdates( [
$page->getTitle(), /* $old = */ null, /* $recursive = */ 'defer' => DeferredUpdates::POSTSEND,
false ); 'recursive' => false,
foreach ( $updates as $update ) { ] );
DeferredUpdates::addUpdate( $update ); DeferredUpdates::doUpdates();
DeferredUpdates::doUpdates();
}
} }
/** /**
* Removes non-existing links from pages from pagelinks, imagelinks, * Removes non-existing links from pages from pagelinks, imagelinks,
* categorylinks, templatelinks, externallinks, interwikilinks, langlinks and redirect tables. * categorylinks, templatelinks, externallinks, interwikilinks, langlinks and redirect tables.
* *
* @param int|null $start Page_id to start from * @param int|null $start Page_id to start from
* @param int|null $end Page_id to stop at * @param int|null $end Page_id to stop at
* @param int $batchSize The size of deletion batches * @param int $batchSize The size of deletion batches
* @param int $chunkSize Maximum number of existent IDs to check per quer y * @param int $chunkSize Maximum number of existent IDs to check per quer y
 End of changes. 3 change blocks. 
13 lines changed or deleted 12 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)