MediaWiki  REL1_22
importImages.php File Reference

Import one or more images from the local file system into the wiki without using the web-based interface. More...

Go to the source code of this file.

Functions

 showUsage ($reason=false)

Variables

 $comment = 'Importing file'
if(isset($options['comment-file']))
elseif(isset($options['comment'])) 
$commentExt = isset( $options['comment-ext'] ) ? $options['comment-ext'] : false
 $count = count( $files )
if(count($args)==0) $dir = $args[0]
 $extensions
 $files = findFiles( $dir, $extensions, isset( $options['search-recursively'] ) )
 $license = isset( $options['license'] ) ? $options['license'] : ''
if($sleep) $limit = @$options['limit']
 $optionsWithArgs
 $processed = $added = $ignored = $skipped = $overwritten = $failed = 0
 $sleep = @$options['sleep']
 $summary = isset( $options['summary'] ) ? $options['summary'] : ''
if($limit) $timestamp = isset( $options['timestamp'] ) ? $options['timestamp'] : false
 $user
if(isset($options['protect'])&&isset($options['unprotect']))
if(isset($options['protect'])&&$options['protect']==1)
global 
$wgFileExtensions
if(!$user instanceof User$wgUser = $user

Detailed Description

Import one or more images from the local file system into the wiki without using the web-based interface.

"Smart import" additions:

  • aim: preserve the essential metadata (user, description) when importing medias from an existing wiki
  • process:
    • interface with the source wiki, don't use bare files only (see --source-wiki-url).
    • fetch metadata from source wiki for each file to import.
    • commit the fetched metadata to the destination wiki while submitting.

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. http://www.gnu.org/copyleft/gpl.html

Author:
Rob Church <[email protected]>
Mij <[email protected]>

Definition in file importImages.php.


Function Documentation

showUsage ( reason = false)

Definition at line 328 of file importImages.php.

References anything, are, data, directory, example, extensions, file, files, from, given(), is, list, name, of, options(), php, source, sysop(), t(), them, URL, used, wiki, and will.


Variable Documentation

if (isset($options['comment-file'])) elseif (isset($options['comment'])) $commentExt = isset( $options['comment-ext'] ) ? $options['comment-ext'] : false

Definition at line 118 of file importImages.php.

$count = count( $files )

Definition at line 126 of file importImages.php.

if (count($args)==0) $dir = $args[0]

Definition at line 49 of file importImages.php.

Referenced by IndexPager\__construct(), CheckSyntax\addDirectoryContent(), lessc\addImportDir(), ApiQueryBase\addTimestampWhereRange(), ApiQueryBase\addWhereRange(), EnhancedChangesList\arrow(), FileCacheBase\cachePath(), UploadFromUrlTestSuite\deleteDirs(), CliInstaller\dirIsExecutable(), SwiftFileBackend\doDirectoryExists(), TestFileOpPerformance\doPerfTest(), CountMessages\execute(), ApiQueryDeletedrevs\execute(), SpecialExport\execute(), ApiQueryFilearchive\execute(), PruneFileCache\execute(), UploadStashCleanup\execute(), ApiQueryAllUsers\execute(), FindHooks\execute(), Exif\exifGPStoNumber(), findFiles(), lessc\findImport(), SwiftFileBackend\getDirectoryListInternal(), SwiftFileBackend\getFileListInternal(), SpecialVersion\getGitHeadSha1(), SpecialRandomInCategory\getQueryInfo(), RandomImageGenerator\getRandomFilenames(), SpecialVersion\getSvnInfo(), SpecialVersion\getSvnRevision(), ForeignAPIFile\getThumbnails(), NewParserTest\getUploadDir(), lessc_parser\parseChunk(), ImageCleanup\pokeFile(), PruneFileCache\prune_directory(), ForeignAPIFile\purgeThumbnails(), ResourceLoaderFileModule\readStyleFile(), ApiQueryCategoryMembers\run(), ApiQueryAllCategories\run(), ApiQueryPagesWithProp\run(), ApiQueryAllPages\run(), WikiImporter\setImageBasePath(), UploadFromUrlTestSuite\setupUploadDir(), ParserTest\setupUploadDir(), EnhancedChangesList\sideArrow(), CdbTest\testCdb(), lessc\tryImport(), wfMkdirParents(), wfRecursiveRemoveDir(), RandomImageGenerator\writeImages(), and MessageWriter\writeMessagesArray().

$license = isset( $options['license'] ) ? $options['license'] : ''

Definition at line 123 of file importImages.php.

Referenced by RdfMetaData\getKnownLicenses().

if ($sleep) $limit = @$options['limit']

Definition at line 99 of file importImages.php.

Referenced by ImageListPager\combineResult(), Title\countAuthorsBetween(), PrefixSearch\defaultSearchBackend(), SpecialRecentchangeslinked\doMainQuery(), SpecialRecentChanges\doMainQuery(), Installer\envCheckCache(), ApiQueryDeletedrevs\execute(), SpecialExport\execute(), ApiQueryFilearchive\execute(), CleanupRemovedModules\execute(), UpdateSpecialPages\execute(), ApiQueryContributions\execute(), ApiQueryLogEvents\execute(), ApiQueryPagePropNames\execute(), ApiOpenSearch\execute(), ApiQueryAllUsers\execute(), ApiQueryRevisions\execute(), HistoryAction\feed(), HistoryAction\fetchRevisions(), WikiDiff3\find_middle_snake(), LocalRepo\findFilesByPrefix(), WikiDiff3\findMostProgress(), FileJournal\getChangeEntries(), IndexPager\getLimitLinks(), Title\getSubpages(), DatabaseMssql\limitResult(), PurgeChangedPages\pageableSortedRows(), DatabasePostgres\pg_array_parse(), ApiQueryRandom\prepareQuery(), ImageListPager\reallyDoQuery(), MagicWord\replace(), ApiQueryExtLinksUsage\run(), ApiQueryCategoryMembers\run(), ApiQueryPagesWithProp\run(), ApiQuerySearch\run(), ApiQueryAllPages\run(), ApiQueryAllImages\run(), ApiQueryAllLinks\run(), PrefixSearch\searchBackend(), ApiResult\setParsedLimit(), PrefixSearch\specialSearch(), SyncFileBackend\syncBackends(), PrefixSearch\titleSearch(), ApiBase\truncateArray(), Title\updateTitleProtection(), SpecialRecentChanges\webOutput(), wfDebugBacktrace(), wfGetAllCallers(), wfShowingResults(), and wfViewPrevNext().

$optionsWithArgs
Initial value:
 array(
    'extensions', 'comment', 'comment-file', 'comment-ext', 'summary', 'user',
    'license', 'sleep', 'limit', 'from', 'source-wiki-url', 'timestamp',
)

Definition at line 34 of file importImages.php.

$processed = $added = $ignored = $skipped = $overwritten = $failed = 0

Definition at line 40 of file importImages.php.

Referenced by SearchUpdateTest\testBug32712().

$sleep = @$options['sleep']

Definition at line 93 of file importImages.php.

Referenced by DeleteImageCache\execute(), and BagOStuff\lock().

if ($limit) $timestamp = isset( $options['timestamp'] ) ? $options['timestamp'] : false

Definition at line 104 of file importImages.php.

Referenced by Block\__construct(), ParserOutput\addImage(), ImageBuilder\addMissingImage(), ProtectionForm\buildForm(), FileCacheBase\cacheTimestamp(), RevisionDeleter\checkRevisionExistence(), ApiFeedWatchlist\createFeedItem(), RdfMetaData\date(), Xml\dateMenu(), Block\doAutoblock(), RevDel_FileList\doPostCommitUpdates(), RevDel_FileList\doQuery(), ApiSetNotificationTimestamp\execute(), SpecialWatchlist\execute(), FixUserRegistration\execute(), FixTimestamps\execute(), ApiQueryAllUsers\execute(), nextJobDB\executeReadyPeriodicTasks(), EditPageTest\forceRevisionDate(), ApiEditPageTest\forceRevisionDate(), FeedUtils\formatDiff(), FeedUtils\formatDiffRow(), CreditsAction\getAuthor(), Block\getAutoblockExpiry(), NewUsersLogFormatter\getComment(), ReverseChronologicalPager\getDateCond(), RevertFileAction\getFormFields(), ResourceLoaderModule\getHashMtime(), FSFile\getTimestamp(), Preferences\getTimezoneOptions(), ImageHistoryList\imageHistoryLine(), FileCacheBase\isCacheGood(), Block\isExpired(), Skin\lastModified(), BagOStuff\lock(), MediaWiki\main(), SpecialLockdb\onSubmit(), RevertFileAction\onSuccess(), SpecialRecentChanges\optionsPanel(), IPTC\parse(), Parser\pstPass2(), ZipDirectoryReader\readCentralDirectory(), ApiQueryRecentChanges\run(), User\setEmailAuthenticationTimestamp(), ParserOutput\setTimestamp(), TimestampTest\testInvalidOutput(), TimestampTest\testValidOutput(), TimestampTest\testValidParse(), and wfTimestamp().

$user
Initial value:
 isset( $options['user'] )
    ? User::newFromName( $options['user'] )
    : User::newFromName( 'Maintenance script' )

Definition at line 70 of file importImages.php.

if (isset($options['protect'])&&isset($options['unprotect'])) if (isset($options['protect'])&&$options['protect']==1) global $wgFileExtensions

Definition at line 56 of file importImages.php.

if (!$user instanceof User) $wgUser = $user

Definition at line 76 of file importImages.php.