25require_once __DIR__ .
'/Maintenance.php';
37 parent::__construct();
39 $this->
addOption(
'delete',
'Perform the deletion' );
40 $this->
addOption(
'filename',
'File name',
false,
true );
41 $this->
addOption(
'filekey',
'File storage key (with extension) or "*"',
true,
true );
46 $this->
output(
"Use --delete to actually confirm this script\n" );
50 $filename = $this->
getOption(
'filename' );
52 if ( $filekey ===
'*' ) {
53 if ( !strlen( $filename ) ) {
54 $this->
error(
"Missing --filename parameter.", 1 );
59 $row = $dbw->selectRow(
'filearchive',
'*',
60 [
'fa_storage_group' =>
'deleted',
'fa_storage_key' => $filekey ],
63 $this->
error(
"No deleted file exists with key '$filekey'.", 1 );
65 $filename = $row->fa_name;
70 if ( $file->exists() ) {
71 $this->
error(
"File '$filename' is still a public file, use the delete form.\n", 1 );
74 $this->
output(
"Purging all thumbnails for file '$filename'..." );
76 $this->
output(
"done.\n" );
81 $this->
output(
"Finding deleted versions of file '$filename'...\n" );
89 $res = $dbw->select(
'filearchive',
'*',
90 [
'fa_name' =>
$name,
'fa_storage_group' =>
'deleted' ],
102 $path = $repo->getZonePath(
'deleted' ) .
'/' . $repo->getDeletedHashPath( $key ) . $key;
104 $status = $repo->getBackend()->delete( [
'src' =>
$path ] );
106 $this->
output(
"Deleted version '$key' ($ts) of file '$name'\n" );
108 $this->
output(
"Failed to delete version '$key' ($ts) of file '$name'\n" );
112 $this->
output(
"Would delete version '{$key}' ({$ts}) of file '$name'\n" );
wfLocalFile( $title)
Get an object referring to a locally registered file.
Class representing a row of the 'filearchive' table.
getTimestamp()
Return upload timestamp.
static newFromRow( $row)
Loads a file object from the filearchive table.
getStorageKey()
Return the FileStore key (overriding base File class)
getName()
Return the file name.
Maintenance script to delete archived (non-current) files from storage.
scrubVersion(ArchivedFile $archivedFile)
execute()
Do the actual work.
__construct()
Default constructor.
Abstract maintenance class for quickly writing and churning out maintenance scripts with minimal effo...
error( $err, $die=0)
Throw an error to the user.
getDB( $db, $groups=[], $wiki=false)
Returns a database to be used by current maintenance script.
hasOption( $name)
Checks to see if a particular param exists.
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.
static singleton()
Get a RepoGroup instance.
design txt This is a brief overview of the new design More thorough and up to date information is available on the documentation wiki at etc Handles the details of getting and saving to the user table of the and dealing with sessions and cookies OutputPage Encapsulates the entire HTML page that will be sent in response to any server request It is used by calling its functions to add in any and then calling output() to send it all. It could be easily changed to send incrementally if that becomes useful
This document is intended to provide useful advice for parties seeking to redistribute MediaWiki to end users It s targeted particularly at maintainers for Linux since it s been observed that distribution packages of MediaWiki often break We ve consistently had to recommend that users seeking support use official tarballs instead of their distribution s and this often solves whatever problem the user is having It would be nice if this could such as
this hook is for auditing only RecentChangesLinked and Watchlist RecentChangesLinked and Watchlist e g Watchlist removed from all revisions and log entries to which it was applied This gives extensions a chance to take it off their books as the deletion has already been partly carried out by this point or something similar the user will be unable to create the tag set $status
Allows to change the fields on the form that will be generated $name
injection txt This is an overview of how MediaWiki makes use of dependency injection The design described here grew from the discussion of RFC T384 The term dependency this means that anything an object needs to operate should be injected from the the object itself should only know narrow no concrete implementation of the logic it relies on The requirement to inject everything typically results in an architecture that based on two main types of and essentially stateless service objects that use other service objects to operate on the value objects As of the beginning MediaWiki is only starting to use the DI approach Much of the code still relies on global state or direct resulting in a highly cyclical dependency which acts as the top level factory for services in MediaWiki which can be used to gain access to default instances of various services MediaWikiServices however also allows new services to be defined and default services to be redefined Services are defined or redefined by providing a callback the instantiator that will return a new instance of the service When it will create an instance of MediaWikiServices and populate it with the services defined in the files listed by thereby bootstrapping the DI framework Per $wgServiceWiringFiles lists includes ServiceWiring php
require_once RUN_MAINTENANCE_IF_MAIN