* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* http://www.gnu.org/copyleft/gpl.html
*
+ * @file
* @ingroup Maintenance
*/
-require_once( dirname( __FILE__ ) . '/Maintenance.php' );
+require_once( __DIR__ . '/Maintenance.php' );
+/**
+ * Maintenance script that fixes any entriy for protocol-relative URLs
+ * in the externallinks table.
+ *
+ * @ingroup Maintenance
+ */
class FixExtLinksProtocolRelative extends LoggedUpdateMaintenance {
public function __construct() {
parent::__construct();
protected function updateSkippedMessage() {
return 'protocol-relative URLs in externallinks table already fixed.';
}
-
+
protected function doDBUpdates() {
$db = wfGetDB( DB_MASTER );
if ( !$db->tableExists( 'externallinks' ) ) {
foreach ( $res as $row ) {
$count++;
if ( $count % 100 == 0 ) {
- $this->output( $count );
+ $this->output( $count . "\n" );
wfWaitForSlaves();
}
$db->insert( 'externallinks',
)
), __METHOD__, array( 'IGNORE' )
);
- $db->delete( 'externallinks', array( 'el_index' => $row->el_index ), __METHOD__ );
+ $db->delete( 'externallinks', array( 'el_index' => $row->el_index, 'el_from' => $row->el_from, 'el_to' => $row->el_to ), __METHOD__ );
}
$this->output( "Done, $count rows updated.\n" );
return true;