summaryrefslogtreecommitdiff
path: root/maintenance/importImages.php
diff options
context:
space:
mode:
Diffstat (limited to 'maintenance/importImages.php')
-rw-r--r--maintenance/importImages.php19
1 files changed, 8 insertions, 11 deletions
diff --git a/maintenance/importImages.php b/maintenance/importImages.php
index abf0ec09..8302982c 100644
--- a/maintenance/importImages.php
+++ b/maintenance/importImages.php
@@ -4,8 +4,7 @@
* Maintenance script to import one or more images from the local file system into
* the wiki without using the web-based interface
*
- * @package MediaWiki
- * @subpackage Maintenance
+ * @addtogroup Maintenance
* @author Rob Church <robchur@gmail.com>
*/
@@ -25,15 +24,13 @@ if( count( $args ) > 1 ) {
# Search the directory given and pull out suitable candidates
$files = findFiles( $dir, $exts );
- # Set up a fake user for this operation
- if( isset( $options['user'] ) ) {
- $wgUser = User::newFromName( $options['user'] );
- } else {
- $wgUser = User::newFromName( 'Image import script' );
- }
- if ( $wgUser->isAnon() ) {
- $wgUser->addToDatabase();
- }
+ # Initialise the user for this operation
+ $user = isset( $options['user'] )
+ ? User::newFromName( $options['user'] )
+ : User::newFromName( 'Maintenance script' );
+ if( !$user instanceof User )
+ $user = User::newFromName( 'Maintenance script' );
+ $wgUser = $user;
# Get the upload comment
$comment = isset( $options['comment'] )