* @ingroup Maintenance
*/
+use MediaWiki\MediaWikiServices;
+
require_once __DIR__ . '/cleanupTable.inc';
/**
protected function fileExists( $name ) {
// XXX: Doesn't actually check for file existence, just presence of image record.
// This is reasonable, since cleanupImages.php only iterates over the image table.
- $dbr = $this->getDB( DB_SLAVE );
- $row = $dbr->selectRow( 'image', array( 'img_name' ), array( 'img_name' => $name ), __METHOD__ );
+ $dbr = $this->getDB( DB_REPLICA );
+ $row = $dbr->selectRow( 'image', [ 'img_name' ], [ 'img_name' => $name ], __METHOD__ );
return $row !== false;
}
protected function moveIllegalPage( $row ) {
$legal = 'A-Za-z0-9_/\\\\-';
$legalized = preg_replace_callback( "!([^$legal])!",
- array( &$this, 'hexChar' ),
+ [ $this, 'hexChar' ],
$row->page_title );
if ( $legalized == '.' ) {
$legalized = '(dot)';
"'$row->page_title') to ($row->page_namespace,'$dest')\n" );
$dbw = $this->getDB( DB_MASTER );
$dbw->update( 'page',
- array( 'page_title' => $dest ),
- array( 'page_id' => $row->page_id ),
+ [ 'page_title' => $dest ],
+ [ 'page_id' => $row->page_id ],
__METHOD__ );
}
}
* @param object $row
* @param Title $title
*/
- protected function moveInconsistentPage( $row, $title ) {
- if ( $title->exists() || $title->getInterwiki() || !$title->canExist() ) {
+ protected function moveInconsistentPage( $row, Title $title ) {
+ if ( $title->exists( Title::GAID_FOR_UPDATE )
+ || $title->getInterwiki()
+ || !$title->canExist()
+ ) {
if ( $title->getInterwiki() || !$title->canExist() ) {
$prior = $title->getPrefixedDBkey();
} else {
$prior = $title->getDBkey();
}
- # Old cleanupTitles could move articles there. See bug 23147.
+ # Old cleanupTitles could move articles there. See T25147.
$ns = $row->page_namespace;
if ( $ns < 0 ) {
$ns = 0;
}
# Namespace which no longer exists. Put the page in the main namespace
- # since we don't have any idea of the old namespace name. See bug 68501.
+ # since we don't have any idea of the old namespace name. See T70501.
if ( !MWNamespace::exists( $ns ) ) {
$ns = 0;
}
"'$row->page_title') to ($ns,'$dest')\n" );
$dbw = $this->getDB( DB_MASTER );
$dbw->update( 'page',
- array(
+ [
'page_namespace' => $ns,
'page_title' => $dest
- ),
- array( 'page_id' => $row->page_id ),
+ ],
+ [ 'page_id' => $row->page_id ],
__METHOD__ );
- LinkCache::singleton()->clear();
+ MediaWikiServices::getInstance()->getLinkCache()->clear();
}
}
}