MediaWiki  1.23.8
deleteSelfExternals.php
Go to the documentation of this file.
1 <?php
24 require_once __DIR__ . '/Maintenance.php';
25 
33  public function __construct() {
34  parent::__construct();
35  $this->mDescription = 'Delete self-references to $wgServer from externallinks';
36  $this->mBatchSize = 1000;
37  }
38 
39  public function execute() {
40  global $wgServer;
41  $this->output( "Deleting self externals from $wgServer\n" );
42  $db = wfGetDB( DB_MASTER );
43  while ( 1 ) {
45  $db->commit( __METHOD__ );
46  $q = $db->limitResult( "DELETE /* deleteSelfExternals */ FROM externallinks WHERE el_to"
47  . $db->buildLike( $wgServer . '/', $db->anyString() ), $this->mBatchSize );
48  $this->output( "Deleting a batch\n" );
49  $db->query( $q );
50  if ( !$db->affectedRows() ) {
51  return;
52  }
53  }
54  }
55 }
56 
57 $maintClass = "DeleteSelfExternals";
58 require_once RUN_MAINTENANCE_IF_MAIN;
DB_MASTER
const DB_MASTER
Definition: Defines.php:56
php
skin txt MediaWiki includes four core it has been set as the default in MediaWiki since the replacing Monobook it had been been the default skin since before being replaced by Vector largely rewritten in while keeping its appearance Several legacy skins were removed in the as the burden of supporting them became too heavy to bear Those in etc for skin dependent CSS etc for skin dependent JavaScript These can also be customised on a per user by etc This feature has led to a wide variety of user styles becoming that gallery is a good place to ending in php
Definition: skin.txt:62
wfGetDB
& wfGetDB( $db, $groups=array(), $wiki=false)
Get a Database object.
Definition: GlobalFunctions.php:3659
RUN_MAINTENANCE_IF_MAIN
require_once RUN_MAINTENANCE_IF_MAIN
Definition: maintenance.txt:50
Maintenance
Abstract maintenance class for quickly writing and churning out maintenance scripts with minimal effo...
Definition: maintenance.txt:39
DeleteSelfExternals\__construct
__construct()
Default constructor.
Definition: deleteSelfExternals.php:33
DeleteSelfExternals\execute
execute()
Do the actual work.
Definition: deleteSelfExternals.php:39
global
when a variable name is used in a it is silently declared as a new masking the global
Definition: design.txt:93
wfWaitForSlaves
wfWaitForSlaves( $maxLag=false, $wiki=false, $cluster=false)
Modern version of wfWaitForSlaves().
Definition: GlobalFunctions.php:3804
DeleteSelfExternals
Maintenance script that deletes self-references to $wgServer from the externallinks table.
Definition: deleteSelfExternals.php:32
Maintenance\output
output( $out, $channel=null)
Throw some output to the user.
Definition: Maintenance.php:314
$maintClass
$maintClass
Definition: deleteSelfExternals.php:57