class FixExtLinksProtocolRelative extends LoggedUpdateMaintenance {
public function __construct() {
parent::__construct();
- $this->mDescription =
- "Fixes any entries in the externallinks table containing protocol-relative URLs";
+ $this->addDescription(
+ 'Fixes any entries in the externallinks table containing protocol-relative URLs' );
}
protected function getUpdateKey() {
return false;
}
$this->output( "Fixing protocol-relative entries in the externallinks table...\n" );
- $res = $db->select( 'externallinks', array( 'el_from', 'el_to', 'el_index' ),
- array( 'el_index' . $db->buildLike( '//', $db->anyString() ) ),
+ $res = $db->select( 'externallinks', [ 'el_from', 'el_to', 'el_index' ],
+ [ 'el_index' . $db->buildLike( '//', $db->anyString() ) ],
__METHOD__
);
$count = 0;
wfWaitForSlaves();
}
$db->insert( 'externallinks',
- array(
- array(
- 'el_id' => $db->nextSequenceValue( 'externallinks_el_id_seq' ),
+ [
+ [
'el_from' => $row->el_from,
'el_to' => $row->el_to,
'el_index' => "http:{$row->el_index}",
- ),
- array(
- 'el_id' => $db->nextSequenceValue( 'externallinks_el_id_seq' ),
+ 'el_index_60' => substr( "http:{$row->el_index}", 0, 60 ),
+ ],
+ [
'el_from' => $row->el_from,
'el_to' => $row->el_to,
'el_index' => "https:{$row->el_index}",
- )
- ), __METHOD__, array( 'IGNORE' )
+ 'el_index_60' => substr( "https:{$row->el_index}", 0, 60 ),
+ ]
+ ], __METHOD__, [ 'IGNORE' ]
);
$db->delete(
'externallinks',
- array(
+ [
'el_index' => $row->el_index,
'el_from' => $row->el_from,
'el_to' => $row->el_to
- ),
+ ],
__METHOD__
);
}
}
}
-$maintClass = "FixExtLinksProtocolRelative";
+$maintClass = FixExtLinksProtocolRelative::class;
require_once RUN_MAINTENANCE_IF_MAIN;