X-Git-Url: http://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/operations/recherche.php?a=blobdiff_plain;f=maintenance%2FimportImages.php;h=d94b9485767ab28c360245c06db84a3f64e62416;hb=46f3a2c79c76c20568a50323d7ec226ba3053434;hp=8d92383d0a53a70c4aa02a43999484b402a0e12a;hpb=9838840f427db366114b7b9422a3578e4d6b88c1;p=lhc%2Fweb%2Fwiklou.git diff --git a/maintenance/importImages.php b/maintenance/importImages.php index 8d92383d0a..d94b948576 100644 --- a/maintenance/importImages.php +++ b/maintenance/importImages.php @@ -31,7 +31,10 @@ * @author Mij */ -$optionsWithArgs = array( 'extensions', 'comment', 'comment-file', 'comment-ext', 'user', 'license', 'sleep', 'limit', 'from', 'source-wiki-url' ); +$optionsWithArgs = array( + 'extensions', 'comment', 'comment-file', 'comment-ext', 'summary', 'user', + 'license', 'sleep', 'limit', 'from', 'source-wiki-url', 'timestamp', +); require_once( __DIR__ . '/commandLine.inc' ); require_once( __DIR__ . '/importImages.inc' ); $processed = $added = $ignored = $skipped = $overwritten = $failed = 0; @@ -98,6 +101,8 @@ if ( $limit ) { $limit = (int)$limit; } +$timestamp = isset( $options['timestamp'] ) ? $options['timestamp'] : false; + # Get the upload comment. Provide a default one in case there's no comment given. $comment = 'Importing image file'; @@ -112,6 +117,8 @@ if ( isset( $options['comment-file'] ) ) { $commentExt = isset( $options['comment-ext'] ) ? $options['comment-ext'] : false; +$summary = isset( $options['summary'] ) ? $options['summary'] : ''; + # Get the license specifier $license = isset( $options['license'] ) ? $options['license'] : ''; @@ -230,9 +237,14 @@ if ( $count > 0 ) { } } + $commentText = SpecialUpload::getInitialPageText( $commentText, $license ); + if ( !$summary ) { + $summary = $commentText; + } + if ( isset( $options['dry'] ) ) { echo( "done.\n" ); - } elseif ( $image->recordUpload( $archive->value, $commentText, $license ) ) { + } elseif ( $image->recordUpload2( $archive->value, $summary, $commentText, false, $timestamp ) ) { # We're done! echo( "done.\n" ); @@ -314,25 +326,27 @@ USAGE: php importImages.php [options] : Path to the directory containing images to be imported Options: ---extensions= Comma-separated list of allowable extensions, defaults to \$wgFileExtensions ---overwrite Overwrite existing images with the same name (default is to skip them) ---limit= Limit the number of images to process. Ignored or skipped images are not counted. ---from= Ignore all files until the one with the given name. Useful for resuming - aborted imports. should be the file's canonical database form. ---skip-dupes Skip images that were already uploaded under a different name (check SHA1) ---sleep= Sleep between files. Useful mostly for debugging. ---user= Set username of uploader, default 'Maintenance script' ---check-userblock Check if the user got blocked during import. ---comment= Set upload summary comment, default 'Importing image file'. ---comment-file= Set upload summary comment the the content of . ---comment-ext= Causes the comment for each file to be loaded from a file with the same name - but the extension . If a global comment is also given, it is appended. ---license= Use an optional license template ---dry Dry run, don't import anything +--extensions= Comma-separated list of allowable extensions, defaults to \$wgFileExtensions +--overwrite Overwrite existing images with the same name (default is to skip them) +--limit= Limit the number of images to process. Ignored or skipped images are not counted. +--from= Ignore all files until the one with the given name. Useful for resuming + aborted imports. should be the file's canonical database form. +--skip-dupes Skip images that were already uploaded under a different name (check SHA1) +--sleep= Sleep between files. Useful mostly for debugging. +--user= Set username of uploader, default 'Maintenance script' +--check-userblock Check if the user got blocked during import. +--comment= Set file description, default 'Importing image file'. +--comment-file= Set description to the content of . +--comment-ext= Causes the description for each file to be loaded from a file with the same name + but the extension . If a global description is also given, it is appended. +--license= Use an optional license template +--dry Dry run, don't import anything --protect= Specify the protect value (autoconfirmed,sysop) +--summary= Upload summary, description will be used if not provided +--timestamp= Override upload time/date, all MediaWiki timestamp formats are accepted --unprotect Unprotects all uploaded images ---source-wiki-url if specified, take User and Comment data for each imported file from this URL. - For example, --source-wiki-url="http://en.wikipedia.org/" +--source-wiki-url If specified, take User and Comment data for each imported file from this URL. + For example, --source-wiki-url="http://en.wikipedia.org/" TEXT; exit( 1 );