21require_once __DIR__ .
'/Maintenance.php';
25 parent::__construct();
27 $this->
addDescription(
"Find unregistered files in the 'public' repo zone." );
29 'Only scan files in this subdirectory (e.g. "a/a0")',
false,
true );
30 $this->
addOption(
'verbose',
"Mention file paths checked" );
35 $subdir = $this->
getOption(
'subdir',
'' );
39 if ( $repo->hasSha1Storage() ) {
40 $this->
fatalError(
"Local repo uses SHA-1 file storage names; aborting." );
43 $directory = $repo->getZonePath(
'public' );
44 if ( $subdir !=
'' ) {
45 $directory .=
"/$subdir/";
49 $this->
output(
"Scanning files under $directory:\n" );
52 $list = $repo->getBackend()->getFileList( [
'dir' => $directory ] );
53 if ( $list ===
null ) {
54 $this->
fatalError(
"Could not get file listing." );
58 foreach ( $list as $path ) {
59 if (
preg_match(
'#^(thumb|deleted)/#', $path ) ) {
65 $this->
checkFiles( $repo, $pathBatch, $verbose );
69 $this->
checkFiles( $repo, $pathBatch, $verbose );
73 if ( !count( $paths ) ) {
83 foreach ( $paths as $path ) {
87 $this->
output(
"Checking old file $name\n" );
91 list( ,
$base ) = explode(
'!', $name, 2 );
92 $oiWheres[] =
$dbr->makeList(
93 [
'oi_name' =>
$base,
'oi_archive_name' => $name ],
98 $this->
output(
"Checking current file $name\n" );
111 [
'name' =>
'img_name',
'old' => 0 ],
112 $imgIN ? [
'img_name' => $imgIN ] :
'1=0'
116 [
'name' =>
'oi_archive_name',
'old' => 1 ],
117 $oiWheres ?
$dbr->makeList( $oiWheres,
LIST_OR ) :
'1=0'
127 foreach (
$res as $row ) {
129 $oldNamesFound[] = $row->name;
131 $curNamesFound[] = $row->name;
136 $file = $repo->
newFile( $name );
139 $this->
output( $name .
"\n" . $file->getCanonicalUrl() .
"\n\n" );
141 $this->
error(
"Cannot get URL for bad file title '$name'" );
145 foreach (
array_diff( $oldNames, $oldNamesFound ) as $name ) {
146 list( ,
$base ) = explode(
'!', $name, 2 );
149 $this->
output( $name .
"\n" . $file->getCanonicalUrl() .
"\n\n" );
and that you know you can do these things To protect your we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights These restrictions translate to certain responsibilities for you if you distribute copies of the or if you modify it For if you distribute copies of such a whether gratis or for a you must give the recipients all the rights that you have You must make sure that receive or can get the source code And you must show them these terms so they know their rights We protect your rights with two and(2) offer you this license which gives you legal permission to copy
newFile( $title, $time=false)
Create a new File object from the local repository.
execute()
Do the actual work.
__construct()
Default constructor.
checkFiles(LocalRepo $repo, array $paths, $verbose)
A repository that stores files in the local filesystem and registers them in the wiki's own database.
getReplicaDB()
Get a connection to the replica DB.
newFromArchiveName( $title, $archiveName)
Abstract maintenance class for quickly writing and churning out maintenance scripts with minimal effo...
output( $out, $channel=null)
Throw some output to the user.
hasOption( $name)
Checks to see if a particular option exists.
getBatchSize()
Returns batch size.
addDescription( $text)
Set the description text.
addOption( $name, $description, $required=false, $withArg=false, $shortName=false, $multiOccurrence=false)
Add a parameter to the script.
getOption( $name, $default=null)
Get an option, or return the default.
setBatchSize( $s=0)
Set the batch size.
fatalError( $msg, $exitCode=1)
Output a message and terminate the current script.
static singleton()
Get a RepoGroup instance.
deferred txt A few of the database updates required by various functions here can be deferred until after the result page is displayed to the user For updating the view updating the linked to tables after a etc PHP does not yet have any way to tell the server to actually return and disconnect while still running these but it might have such a feature in the future We handle these by creating a deferred update object and putting those objects on a global list
do that in ParserLimitReportFormat instead use this to modify the parameters of the image all existing parser cache entries will be invalid To avoid you ll need to handle that somehow(e.g. with the RejectParserCacheValue hook) because MediaWiki won 't do it for you. & $defaults error
Allows to change the fields on the form that will be generated $name
require_once RUN_MAINTENANCE_IF_MAIN
The wiki should then use memcached to cache various data To use multiple just add more items to the array To increase the weight of a make its entry a array("192.168.0.1:11211", 2))