MediaWiki  1.29.1
importImages.php
Go to the documentation of this file.
1 <?php
35 require_once __DIR__ . '/Maintenance.php';
36 
37 class ImportImages extends Maintenance {
38 
39  public function __construct() {
40  parent::__construct();
41 
42  $this->addDescription( 'Imports images and other media files into the wiki' );
43  $this->addArg( 'dir', 'Path to the directory containing images to be imported' );
44 
45  $this->addOption( 'extensions',
46  'Comma-separated list of allowable extensions, defaults to $wgFileExtensions',
47  false,
48  true
49  );
50  $this->addOption( 'overwrite',
51  'Overwrite existing images with the same name (default is to skip them)' );
52  $this->addOption( 'limit',
53  'Limit the number of images to process. Ignored or skipped images are not counted',
54  false,
55  true
56  );
57  $this->addOption( 'from',
58  "Ignore all files until the one with the given name. Useful for resuming aborted "
59  . "imports. The name should be the file's canonical database form.",
60  false,
61  true
62  );
63  $this->addOption( 'skip-dupes',
64  'Skip images that were already uploaded under a different name (check SHA1)' );
65  $this->addOption( 'search-recursively', 'Search recursively for files in subdirectories' );
66  $this->addOption( 'sleep',
67  'Sleep between files. Useful mostly for debugging',
68  false,
69  true
70  );
71  $this->addOption( 'user',
72  "Set username of uploader, default 'Maintenance script'",
73  false,
74  true
75  );
76  // This parameter can optionally have an argument. If none specified, getOption()
77  // returns 1 which is precisely what we need.
78  $this->addOption( 'check-userblock', 'Check if the user got blocked during import' );
79  $this->addOption( 'comment',
80  "Set file description, default 'Importing file'",
81  false,
82  true
83  );
84  $this->addOption( 'comment-file',
85  'Set description to the content of this file',
86  false,
87  true
88  );
89  $this->addOption( 'comment-ext',
90  'Causes the description for each file to be loaded from a file with the same name, but '
91  . 'the extension provided. If a global description is also given, it is appended.',
92  false,
93  true
94  );
95  $this->addOption( 'summary',
96  'Upload summary, description will be used if not provided',
97  false,
98  true
99  );
100  $this->addOption( 'license',
101  'Use an optional license template',
102  false,
103  true
104  );
105  $this->addOption( 'timestamp',
106  'Override upload time/date, all MediaWiki timestamp formats are accepted',
107  false,
108  true
109  );
110  $this->addOption( 'protect',
111  'Specify the protect value (autoconfirmed,sysop)',
112  false,
113  true
114  );
115  $this->addOption( 'unprotect', 'Unprotects all uploaded images' );
116  $this->addOption( 'source-wiki-url',
117  'If specified, take User and Comment data for each imported file from this URL. '
118  . 'For example, --source-wiki-url="http://en.wikipedia.org/',
119  false,
120  true
121  );
122  $this->addOption( 'dry', "Dry run, don't import anything" );
123  }
124 
125  public function execute() {
126  global $wgFileExtensions, $wgUser, $wgRestrictionLevels;
127 
128  $processed = $added = $ignored = $skipped = $overwritten = $failed = 0;
129 
130  $this->output( "Import Images\n\n" );
131 
132  $dir = $this->getArg( 0 );
133 
134  # Check Protection
135  if ( $this->hasOption( 'protect' ) && $this->hasOption( 'unprotect' ) ) {
136  $this->error( "Cannot specify both protect and unprotect. Only 1 is allowed.\n", 1 );
137  }
138 
139  if ( $this->hasOption( 'protect' ) && trim( $this->getOption( 'protect' ) ) ) {
140  $this->error( "You must specify a protection option.\n", 1 );
141  }
142 
143  # Prepare the list of allowed extensions
144  $extensions = $this->hasOption( 'extensions' )
145  ? explode( ',', strtolower( $this->getOption( 'extensions' ) ) )
147 
148  # Search the path provided for candidates for import
149  $files = $this->findFiles( $dir, $extensions, $this->hasOption( 'search-recursively' ) );
150 
151  # Initialise the user for this operation
152  $user = $this->hasOption( 'user' )
153  ? User::newFromName( $this->getOption( 'user' ) )
154  : User::newSystemUser( 'Maintenance script', [ 'steal' => true ] );
155  if ( !$user instanceof User ) {
156  $user = User::newSystemUser( 'Maintenance script', [ 'steal' => true ] );
157  }
158  $wgUser = $user;
159 
160  # Get block check. If a value is given, this specified how often the check is performed
161  $checkUserBlock = (int)$this->getOption( 'check-userblock' );
162 
163  $from = $this->getOption( 'from' );
164  $sleep = (int)$this->getOption( 'sleep' );
165  $limit = (int)$this->getOption( 'limit' );
166  $timestamp = $this->getOption( 'timestamp', false );
167 
168  # Get the upload comment. Provide a default one in case there's no comment given.
169  $commentFile = $this->getOption( 'comment-file' );
170  if ( $commentFile !== null ) {
171  $comment = file_get_contents( $commentFile );
172  if ( $comment === false || $comment === null ) {
173  $this->error( "failed to read comment file: {$commentFile}\n", 1 );
174  }
175  } else {
176  $comment = $this->getOption( 'comment', 'Importing file' );
177  }
178  $commentExt = $this->getOption( 'comment-ext' );
179  $summary = $this->getOption( 'summary', '' );
180 
181  $license = $this->getOption( 'license', '' );
182 
183  $sourceWikiUrl = $this->getOption( 'source-wiki-url' );
184 
185  # Batch "upload" operation
186  $count = count( $files );
187  if ( $count > 0 ) {
188 
189  foreach ( $files as $file ) {
190 
191  if ( $sleep && ( $processed > 0 ) ) {
192  sleep( $sleep );
193  }
194 
195  $base = UtfNormal\Validator::cleanUp( wfBaseName( $file ) );
196 
197  # Validate a title
199  if ( !is_object( $title ) ) {
200  $this->output(
201  "{$base} could not be imported; a valid title cannot be produced\n" );
202  continue;
203  }
204 
205  if ( $from ) {
206  if ( $from == $title->getDBkey() ) {
207  $from = null;
208  } else {
209  $ignored++;
210  continue;
211  }
212  }
213 
214  if ( $checkUserBlock && ( ( $processed % $checkUserBlock ) == 0 ) ) {
215  $user->clearInstanceCache( 'name' ); // reload from DB!
216  if ( $user->isBlocked() ) {
217  $this->output( $user->getName() . " was blocked! Aborting.\n" );
218  break;
219  }
220  }
221 
222  # Check existence
224  if ( $image->exists() ) {
225  if ( $this->hasOption( 'overwrite' ) ) {
226  $this->output( "{$base} exists, overwriting..." );
227  $svar = 'overwritten';
228  } else {
229  $this->output( "{$base} exists, skipping\n" );
230  $skipped++;
231  continue;
232  }
233  } else {
234  if ( $this->hasOption( 'skip-dupes' ) ) {
235  $repo = $image->getRepo();
236  # XXX: we end up calculating this again when actually uploading. that sucks.
237  $sha1 = FSFile::getSha1Base36FromPath( $file );
238 
239  $dupes = $repo->findBySha1( $sha1 );
240 
241  if ( $dupes ) {
242  $this->output(
243  "{$base} already exists as {$dupes[0]->getName()}, skipping\n" );
244  $skipped++;
245  continue;
246  }
247  }
248 
249  $this->output( "Importing {$base}..." );
250  $svar = 'added';
251  }
252 
253  if ( $sourceWikiUrl ) {
254  /* find comment text directly from source wiki, through MW's API */
255  $real_comment = $this->getFileCommentFromSourceWiki( $sourceWikiUrl, $base );
256  if ( $real_comment === false ) {
257  $commentText = $comment;
258  } else {
259  $commentText = $real_comment;
260  }
261 
262  /* find user directly from source wiki, through MW's API */
263  $real_user = $this->getFileUserFromSourceWiki( $sourceWikiUrl, $base );
264  if ( $real_user === false ) {
265  $wgUser = $user;
266  } else {
267  $wgUser = User::newFromName( $real_user );
268  if ( $wgUser === false ) {
269  # user does not exist in target wiki
270  $this->output(
271  "failed: user '$real_user' does not exist in target wiki." );
272  continue;
273  }
274  }
275  } else {
276  # Find comment text
277  $commentText = false;
278 
279  if ( $commentExt ) {
280  $f = $this->findAuxFile( $file, $commentExt );
281  if ( !$f ) {
282  $this->output( " No comment file with extension {$commentExt} found "
283  . "for {$file}, using default comment. " );
284  } else {
285  $commentText = file_get_contents( $f );
286  if ( !$commentText ) {
287  $this->output(
288  " Failed to load comment file {$f}, using default comment. " );
289  }
290  }
291  }
292 
293  if ( !$commentText ) {
294  $commentText = $comment;
295  }
296  }
297 
298  # Import the file
299  if ( $this->hasOption( 'dry' ) ) {
300  $this->output(
301  " publishing {$file} by '{$wgUser->getName()}', comment '$commentText'... "
302  );
303  } else {
304  $mwProps = new MWFileProps( MimeMagic::singleton() );
305  $props = $mwProps->getPropsFromPath( $file, true );
306  $flags = 0;
307  $publishOptions = [];
308  $handler = MediaHandler::getHandler( $props['mime'] );
309  if ( $handler ) {
310  $publishOptions['headers'] = $handler->getStreamHeaders( $props['metadata'] );
311  } else {
312  $publishOptions['headers'] = [];
313  }
314  $archive = $image->publish( $file, $flags, $publishOptions );
315  if ( !$archive->isGood() ) {
316  $this->output( "failed. (" .
317  $archive->getWikiText( false, false, 'en' ) .
318  ")\n" );
319  $failed++;
320  continue;
321  }
322  }
323 
324  $commentText = SpecialUpload::getInitialPageText( $commentText, $license );
325  if ( !$this->hasOption( 'summary' ) ) {
326  $summary = $commentText;
327  }
328 
329  if ( $this->hasOption( 'dry' ) ) {
330  $this->output( "done.\n" );
331  } elseif ( $image->recordUpload2(
332  $archive->value,
333  $summary,
334  $commentText,
335  $props,
336  $timestamp
337  ) ) {
338  # We're done!
339  $this->output( "done.\n" );
340 
341  $doProtect = false;
342 
343  $protectLevel = $this->getOption( 'protect' );
344 
345  if ( $protectLevel && in_array( $protectLevel, $wgRestrictionLevels ) ) {
346  $doProtect = true;
347  }
348  if ( $this->hasOption( 'unprotect' ) ) {
349  $protectLevel = '';
350  $doProtect = true;
351  }
352 
353  if ( $doProtect ) {
354  # Protect the file
355  $this->output( "\nWaiting for replica DBs...\n" );
356  // Wait for replica DBs.
357  sleep( 2.0 ); # Why this sleep?
358  wfWaitForSlaves();
359 
360  $this->output( "\nSetting image restrictions ... " );
361 
362  $cascade = false;
363  $restrictions = [];
364  foreach ( $title->getRestrictionTypes() as $type ) {
365  $restrictions[$type] = $protectLevel;
366  }
367 
369  $status = $page->doUpdateRestrictions( $restrictions, [], $cascade, '', $user );
370  $this->output( ( $status->isOK() ? 'done' : 'failed' ) . "\n" );
371  }
372  } else {
373  $this->output( "failed. (at recordUpload stage)\n" );
374  $svar = 'failed';
375  }
376 
377  $$svar++;
378  $processed++;
379 
380  if ( $limit && $processed >= $limit ) {
381  break;
382  }
383  }
384 
385  # Print out some statistics
386  $this->output( "\n" );
387  foreach (
388  [
389  'count' => 'Found',
390  'limit' => 'Limit',
391  'ignored' => 'Ignored',
392  'added' => 'Added',
393  'skipped' => 'Skipped',
394  'overwritten' => 'Overwritten',
395  'failed' => 'Failed'
396  ] as $var => $desc
397  ) {
398  if ( $$var > 0 ) {
399  $this->output( "{$desc}: {$$var}\n" );
400  }
401  }
402  } else {
403  $this->output( "No suitable files could be found for import.\n" );
404  }
405  }
406 
415  private function findFiles( $dir, $exts, $recurse = false ) {
416  if ( is_dir( $dir ) ) {
417  $dhl = opendir( $dir );
418  if ( $dhl ) {
419  $files = [];
420  while ( ( $file = readdir( $dhl ) ) !== false ) {
421  if ( is_file( $dir . '/' . $file ) ) {
422  list( /* $name */, $ext ) = $this->splitFilename( $dir . '/' . $file );
423  if ( array_search( strtolower( $ext ), $exts ) !== false ) {
424  $files[] = $dir . '/' . $file;
425  }
426  } elseif ( $recurse && is_dir( $dir . '/' . $file ) && $file !== '..' && $file !== '.' ) {
427  $files = array_merge( $files, $this->findFiles( $dir . '/' . $file, $exts, true ) );
428  }
429  }
430 
431  return $files;
432  } else {
433  return [];
434  }
435  } else {
436  return [];
437  }
438  }
439 
446  private function splitFilename( $filename ) {
447  $parts = explode( '.', $filename );
448  $ext = $parts[count( $parts ) - 1];
449  unset( $parts[count( $parts ) - 1] );
450  $fname = implode( '.', $parts );
451 
452  return [ $fname, $ext ];
453  }
454 
469  private function findAuxFile( $file, $auxExtension, $maxStrip = 1 ) {
470  if ( strpos( $auxExtension, '.' ) !== 0 ) {
471  $auxExtension = '.' . $auxExtension;
472  }
473 
474  $d = dirname( $file );
475  $n = basename( $file );
476 
477  while ( $maxStrip >= 0 ) {
478  $f = $d . '/' . $n . $auxExtension;
479 
480  if ( file_exists( $f ) ) {
481  return $f;
482  }
483 
484  $idx = strrpos( $n, '.' );
485  if ( !$idx ) {
486  break;
487  }
488 
489  $n = substr( $n, 0, $idx );
490  $maxStrip -= 1;
491  }
492 
493  return false;
494  }
495 
496  # @todo FIXME: Access the api in a saner way and performing just one query
497  # (preferably batching files too).
498  private function getFileCommentFromSourceWiki( $wiki_host, $file ) {
499  $url = $wiki_host . '/api.php?action=query&format=xml&titles=File:'
500  . rawurlencode( $file ) . '&prop=imageinfo&&iiprop=comment';
501  $body = Http::get( $url, [], __METHOD__ );
502  if ( preg_match( '#<ii comment="([^"]*)" />#', $body, $matches ) == 0 ) {
503  return false;
504  }
505 
506  return html_entity_decode( $matches[1] );
507  }
508 
509  private function getFileUserFromSourceWiki( $wiki_host, $file ) {
510  $url = $wiki_host . '/api.php?action=query&format=xml&titles=File:'
511  . rawurlencode( $file ) . '&prop=imageinfo&&iiprop=user';
512  $body = Http::get( $url, [], __METHOD__ );
513  if ( preg_match( '#<ii user="([^"]*)" />#', $body, $matches ) == 0 ) {
514  return false;
515  }
516 
517  return html_entity_decode( $matches[1] );
518  }
519 
520 }
521 
522 $maintClass = 'ImportImages';
523 require_once RUN_MAINTENANCE_IF_MAIN;
SpecialUpload\getInitialPageText
static getInitialPageText( $comment='', $license='', $copyStatus='', $source='', Config $config=null)
Get the initial image page text based on a comment and optional file status information.
Definition: SpecialUpload.php:593
$wgUser
$wgUser
Definition: Setup.php:781
captcha-old.count
count
Definition: captcha-old.py:225
Maintenance\addDescription
addDescription( $text)
Set the description text.
Definition: Maintenance.php:287
$status
this hook is for auditing only RecentChangesLinked and Watchlist RecentChangesLinked and Watchlist Do not use this to implement individual filters if they are compatible with the ChangesListFilter and ChangesListFilterGroup structure use sub classes of those in conjunction with the ChangesListSpecialPageStructuredFilters hook This hook can be used to implement filters that do not implement that or custom behavior that is not an individual filter e g Watchlist and Watchlist you will want to construct new ChangesListBooleanFilter or ChangesListStringOptionsFilter objects When constructing you specify which group they belong to You can reuse existing or create your you must register them with $special registerFilterGroup 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
Definition: hooks.txt:1049
$user
please add to it if you re going to add events to the MediaWiki code where normally authentication against an external auth plugin would be creating a account $user
Definition: hooks.txt:246
ImportImages\splitFilename
splitFilename( $filename)
Split a filename into filename and extension.
Definition: importImages.php:446
$wgFileExtensions
$wgFileExtensions
This is the list of preferred extensions for uploading files.
Definition: DefaultSettings.php:865
wfBaseName
wfBaseName( $path, $suffix='')
Return the final portion of a pathname.
Definition: GlobalFunctions.php:2798
$fname
if(!defined( 'MEDIAWIKI')) $fname
This file is not a valid entry point, perform no further processing unless MEDIAWIKI is defined.
Definition: Setup.php:36
NS_FILE
const NS_FILE
Definition: Defines.php:68
RUN_MAINTENANCE_IF_MAIN
require_once RUN_MAINTENANCE_IF_MAIN
Definition: maintenance.txt:50
User\newFromName
static newFromName( $name, $validate='valid')
Static factory method for creation from username.
Definition: User.php:556
ImportImages\__construct
__construct()
Default constructor.
Definition: importImages.php:39
Maintenance
Abstract maintenance class for quickly writing and churning out maintenance scripts with minimal effo...
Definition: maintenance.txt:39
$type
do that in ParserLimitReportFormat instead use this to modify the parameters of the image and a DIV can begin in one section and end in another Make sure your code can handle that case gracefully See the EditSectionClearerLink extension for an example zero but section is usually empty its values are the globals values before the output is cached my talk my contributions etc etc otherwise the built in rate limiting checks are if enabled allows for interception of redirect as a string mapping parameter names to values & $type
Definition: hooks.txt:2536
$base
$base
Definition: generateLocalAutoload.php:10
wfWaitForSlaves
wfWaitForSlaves( $ifWritesSince=null, $wiki=false, $cluster=false, $timeout=null)
Waits for the replica DBs to catch up to the master position.
Definition: GlobalFunctions.php:3214
php
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
Definition: injection.txt:35
ImportImages\getFileUserFromSourceWiki
getFileUserFromSourceWiki( $wiki_host, $file)
Definition: importImages.php:509
User\newSystemUser
static newSystemUser( $name, $options=[])
Static factory method for creation of a "system" user from username.
Definition: User.php:684
$title
namespace and then decline to actually register it file or subcat img or subcat $title
Definition: hooks.txt:934
ImportImages\findFiles
findFiles( $dir, $exts, $recurse=false)
Search a directory for files with one of a set of extensions.
Definition: importImages.php:415
WikiPage\factory
static factory(Title $title)
Create a WikiPage object of the appropriate class for the given title.
Definition: WikiPage.php:120
ImportImages\getFileCommentFromSourceWiki
getFileCommentFromSourceWiki( $wiki_host, $file)
Definition: importImages.php:498
$page
do that in ParserLimitReportFormat instead use this to modify the parameters of the image and a DIV can begin in one section and end in another Make sure your code can handle that case gracefully See the EditSectionClearerLink extension for an example zero but section is usually empty its values are the globals values before the output is cached $page
Definition: hooks.txt:2536
$matches
$matches
Definition: NoLocalSettings.php:24
FSFile\getSha1Base36FromPath
static getSha1Base36FromPath( $path)
Get a SHA-1 hash of a file in the local filesystem, in base-36 lower case encoding,...
Definition: FSFile.php:218
Maintenance\addOption
addOption( $name, $description, $required=false, $withArg=false, $shortName=false, $multiOccurrence=false)
Add a parameter to the script.
Definition: Maintenance.php:215
$limit
this hook is for auditing only RecentChangesLinked and Watchlist RecentChangesLinked and Watchlist Do not use this to implement individual filters if they are compatible with the ChangesListFilter and ChangesListFilterGroup structure use sub classes of those in conjunction with the ChangesListSpecialPageStructuredFilters hook This hook can be used to implement filters that do not implement that or custom behavior that is not an individual filter e g Watchlist and Watchlist you will want to construct new ChangesListBooleanFilter or ChangesListStringOptionsFilter objects When constructing you specify which group they belong to You can reuse existing or create your you must register them with $special registerFilterGroup 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 and then return false from the hook function Ensure you consume the ChangeTagAfterDelete hook to carry out custom deletion actions as context called by AbstractContent::getParserOutput May be used to override the normal model specific rendering of page content as context as context the output can only depend on parameters provided to this hook not on global state indicating whether full HTML should be generated If generation of HTML may be but other information should still be present in the ParserOutput object to manipulate or replace but no entry for that model exists in $wgContentHandlers please use GetContentModels hook to make them known to core if desired whether it is OK to use $contentModel on $title Handler functions that modify $ok should generally return false to prevent further hooks from further modifying $ok inclusive $limit
Definition: hooks.txt:1049
MWFileProps
MimeMagic helper wrapper.
Definition: MWFileProps.php:28
global
when a variable name is used in a it is silently declared as a new masking the global
Definition: design.txt:93
MimeMagic\singleton
static singleton()
Get an instance of this class.
Definition: MimeMagic.php:33
list
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
Definition: deferred.txt:11
$dir
$dir
Definition: Autoload.php:8
$image
this hook is for auditing only or null if authentication failed before getting that far or null if we can t even determine that probably a stub it is not rendered in wiki pages or galleries in category pages allow injecting custom HTML after the section Any uses of the hook need to handle escaping see BaseTemplate::getToolbox and BaseTemplate::makeListItem for details on the format of individual items inside of this array or by returning and letting standard HTTP rendering take place modifiable or by returning false and taking over the output modifiable modifiable after all normalizations have been except for the $wgMaxImageArea check $image
Definition: hooks.txt:783
Http\get
static get( $url, $options=[], $caller=__METHOD__)
Simple wrapper for Http::request( 'GET' )
Definition: Http.php:98
Title\makeTitleSafe
static makeTitleSafe( $ns, $title, $fragment='', $interwiki='')
Create a new Title from a namespace index and a DB key.
Definition: Title.php:538
$handler
this hook is for auditing only or null if authentication failed before getting that far or null if we can t even determine that probably a stub it is not rendered in wiki pages or galleries in category pages allow injecting custom HTML after the section Any uses of the hook need to handle escaping see BaseTemplate::getToolbox and BaseTemplate::makeListItem for details on the format of individual items inside of this array or by returning and letting standard HTTP rendering take place modifiable or by returning false and taking over the output modifiable modifiable after all normalizations have been except for the $wgMaxImageArea check set to true or false to override the $wgMaxImageArea check result gives extension the possibility to transform it themselves $handler
Definition: hooks.txt:783
ImportImages\findAuxFile
findAuxFile( $file, $auxExtension, $maxStrip=1)
Find an auxilliary file with the given extension, matching the give base file path.
Definition: importImages.php:469
Maintenance\getOption
getOption( $name, $default=null)
Get an option, or return the default.
Definition: Maintenance.php:250
$ext
$ext
Definition: NoLocalSettings.php:25
Maintenance\addArg
addArg( $arg, $description, $required=true)
Add some args that are needed.
Definition: Maintenance.php:267
MediaHandler\getHandler
static getHandler( $type)
Get a MediaHandler for a given MIME type from the instance cache.
Definition: MediaHandler.php:46
as
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
Definition: distributors.txt:9
Maintenance\error
error( $err, $die=0)
Throw an error to the user.
Definition: Maintenance.php:392
Maintenance\output
output( $out, $channel=null)
Throw some output to the user.
Definition: Maintenance.php:373
Maintenance\hasOption
hasOption( $name)
Checks to see if a particular param exists.
Definition: Maintenance.php:236
Maintenance\getArg
getArg( $argId=0, $default=null)
Get an argument.
Definition: Maintenance.php:306
User
The User object encapsulates all of the user-specific settings (user_id, name, rights,...
Definition: User.php:50
wfLocalFile
wfLocalFile( $title)
Get an object referring to a locally registered file.
Definition: GlobalFunctions.php:3112
ImportImages\execute
execute()
Do the actual work.
Definition: importImages.php:125
ImportImages
Definition: importImages.php:37
$flags
it s the revision text itself In either if gzip is the revision text is gzipped $flags
Definition: hooks.txt:2749
$maintClass
$maintClass
Definition: importImages.php:522