X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=maintenance%2FdumpUploads.php;h=4bfc57464ab9b55616262f041a42f03ffbba3d3f;hb=fb56b37d67ba9b2c1b16da68beca4bdb218993f3;hp=026ac025c083cfc36283bd7b6164653315d7e020;hpb=6505e5f278aae664f78fb8f876c10902d2195231;p=lhc%2Fweb%2Fwiklou.git diff --git a/maintenance/dumpUploads.php b/maintenance/dumpUploads.php index 026ac025c0..4bfc57464a 100644 --- a/maintenance/dumpUploads.php +++ b/maintenance/dumpUploads.php @@ -32,8 +32,8 @@ require_once __DIR__ . '/Maintenance.php'; class UploadDumper extends Maintenance { public function __construct() { parent::__construct(); - $this->mDescription = "Generates list of uploaded files which can be fed to tar or similar. -By default, outputs relative paths against the parent directory of \$wgUploadDirectory."; + $this->addDescription( 'Generates list of uploaded files which can be fed to tar or similar. +By default, outputs relative paths against the parent directory of $wgUploadDirectory.' ); $this->addOption( 'base', 'Set base relative path instead of wiki include root', false, true ); $this->addOption( 'local', 'List all local files, used or not. No shared files included' ); $this->addOption( 'used', 'Skip local images that are not used' ); @@ -76,7 +76,7 @@ By default, outputs relative paths against the parent directory of \$wgUploadDir * @param bool $shared True to pass shared-dir settings to hash func */ function fetchUsed( $shared ) { - $dbr = $this->getDB( DB_SLAVE ); + $dbr = $this->getDB( DB_REPLICA ); $image = $dbr->tableName( 'image' ); $imagelinks = $dbr->tableName( 'imagelinks' ); @@ -97,9 +97,9 @@ By default, outputs relative paths against the parent directory of \$wgUploadDir * @param bool $shared True to pass shared-dir settings to hash func */ function fetchLocal( $shared ) { - $dbr = $this->getDB( DB_SLAVE ); + $dbr = $this->getDB( DB_REPLICA ); $result = $dbr->select( 'image', - array( 'img_name' ), + [ 'img_name' ], '', __METHOD__ ); @@ -111,7 +111,7 @@ By default, outputs relative paths against the parent directory of \$wgUploadDir function outputItem( $name, $shared ) { $file = wfFindFile( $name ); if ( $file && $this->filterItem( $file, $shared ) ) { - $filename = $file->getPath(); + $filename = $file->getLocalRefPath(); $rel = wfRelativePath( $filename, $this->mBasePath ); $this->output( "$rel\n" ); } else { @@ -124,5 +124,5 @@ By default, outputs relative paths against the parent directory of \$wgUploadDir } } -$maintClass = "UploadDumper"; +$maintClass = UploadDumper::class; require_once RUN_MAINTENANCE_IF_MAIN;