summaryrefslogtreecommitdiff
path: root/maintenance/populateSha1.php
diff options
context:
space:
mode:
Diffstat (limited to 'maintenance/populateSha1.php')
-rw-r--r--maintenance/populateSha1.php22
1 files changed, 10 insertions, 12 deletions
diff --git a/maintenance/populateSha1.php b/maintenance/populateSha1.php
index 72ef9461..1714c0d6 100644
--- a/maintenance/populateSha1.php
+++ b/maintenance/populateSha1.php
@@ -20,7 +20,7 @@
* @ingroup Maintenance
*/
-require_once( dirname(__FILE__).'/Maintenance.php' );
+require_once( dirname( __FILE__ ) . '/Maintenance.php' );
class PopulateSha1 extends Maintenance {
public function __construct() {
@@ -37,14 +37,14 @@ class PopulateSha1 extends Maintenance {
$t = -microtime( true );
$dbw = wfGetDB( DB_MASTER );
- if( $file ) {
- $res = $dbw->selectRow(
- 'image',
- array( 'img_name' ),
+ if ( $file ) {
+ $res = $dbw->selectRow(
+ 'image',
+ array( 'img_name' ),
array( 'img_name' => $dbw->addQuotes( $file ) ),
__METHOD__
);
- if( !$res ) {
+ if ( !$res ) {
$this->error( "No such file: $file", true );
return;
}
@@ -52,19 +52,17 @@ class PopulateSha1 extends Maintenance {
$res = $dbw->select( 'image', array( 'img_name' ), array( 'img_sha1' => '' ), __METHOD__ );
}
$imageTable = $dbw->tableName( 'image' );
- $oldimageTable = $dbw->tableName( 'oldimage' );
- $batch = array();
-
+
if ( $method == 'pipe' ) {
// @fixme kill this and replace with a second unbuffered DB connection.
global $wgDBuser, $wgDBserver, $wgDBpassword, $wgDBname;
- $cmd = 'mysql -u' . wfEscapeShellArg( $wgDBuser ) .
+ $cmd = 'mysql -u' . wfEscapeShellArg( $wgDBuser ) .
' -h' . wfEscapeShellArg( $wgDBserver ) .
' -p' . wfEscapeShellArg( $wgDBpassword, $wgDBname );
$this->output( "Using pipe method\n" );
$pipe = popen( $cmd, 'w' );
}
-
+
$numRows = $res->numRows();
$i = 0;
foreach ( $res as $row ) {
@@ -98,4 +96,4 @@ class PopulateSha1 extends Maintenance {
}
$maintClass = "PopulateSha1";
-require_once( DO_MAINTENANCE );
+require_once( RUN_MAINTENANCE_IF_MAIN );