MediaWiki  REL1_19
importImages.php File Reference

Maintenance script to 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

if($limit) $comment = 'Importing image 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 )
 $license = isset( $options['license'] ) ? $options['license'] : ''
if($sleep) $limit = @$options['limit']
 $optionsWithArgs = array( 'extensions', 'comment', 'comment-file', 'comment-ext', 'user', 'license', 'sleep', 'limit', 'from', 'source-wiki-url' )
 $processed = $added = $ignored = $skipped = $overwritten = $failed = 0
 $sleep = @$options['sleep']
 $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

Maintenance script to 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 306 of file importImages.php.

References echo.


Variable Documentation

if ($limit) $comment = 'Importing image file'

Definition at line 103 of file importImages.php.

Referenced by Orphans\checkOrphans(), Linker\commentBlock(), ApiFeedWatchlist\createFeedItem(), ApiTestCaseUpload\deleteFileByTitle(), GenderCache\doQuery(), WikiPage\doQuickEdit(), ApiQueryRevisions\extractRowInfo(), Linker\formatAutocomments(), Linker\formatAutocommentsCallback(), Linker\formatComment(), FeedUtils\formatDiffRow(), SpecialUndelete\formatFileRow(), Linker\formatLinksInComment(), Linker\formatLinksInCommentCallback(), SpecialMergeHistory\formatRevisionRow(), SpecialUndelete\formatRevisionRow(), DeletedContribsPager\formatRow(), SpecialNewpages\formatRow(), ContribsPager\formatRow(), LogFormatter\getComment(), UploadBase\getFilenamePrefixBlacklist(), RevDel_RevisionItem\getHTML(), RevisionItem\getHTML(), RevDel_LogItem\getHTML(), ApiQueryImageInfo\getInfo(), SpecialUpload\getInitialPageText(), RecentChange\getIRCLine(), GIFMetadataExtractor\getMetadata(), UploadFromUrl\insertJob(), SearchEngineTest\insertPage(), LogEventsList\logActionLinks(), LogEventsList\logLine(), SpecialMergeHistory\merge(), Title\moveTo(), Title\moveToInternal(), RecentChange\notifyEdit(), RecentChange\notifyNew(), RevertFileAction\onSubmit(), UploadFromChunks\performUpload(), UploadFromStash\performUpload(), UploadFromUrl\performUpload(), UploadBase\performUpload(), WikiPage\quickEdit(), OldLocalFile\recordOldUpload(), LocalFile\recordUpload2(), ImportReporter\reportPage(), RevDel_List\setVisibility(), EditPage\showEditForm(), SpecialRevisionDelete\submit(), PageArchive\undelete(), PageArchive\undeleteRevisions(), LocalFile\upload(), and OldLocalFile\uploadOld().

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

Definition at line 114 of file importImages.php.

$count = count( $files )

Definition at line 120 of file importImages.php.

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

Definition at line 47 of file importImages.php.

Referenced by IndexPager\__construct(), FSFileBackendFileList\__construct(), FileBackendStoreShardListIterator\__construct(), CheckSyntax\addDirectoryContent(), OutputPage\addStyle(), ApiQueryBase\addTimestampWhereRange(), ApiQueryBase\addWhereRange(), EnhancedChangesList\arrow(), FileCacheBase\cachePath(), SqliteInstaller\dataDirOKmaybeCreate(), UploadFromUrlTestSuite\deleteDirs(), ParserTest\deleteDirs(), CliInstaller\dirIsExecutable(), Installer\dirIsExecutable(), FileBackendStore\doClean(), FSFileBackend\doCleanInternal(), SwiftFileBackend\doCleanInternal(), FileBackendStore\doPrepare(), FSFileBackend\doPrepareInternal(), FileBackendStore\doSecure(), FSFileBackend\doSecureInternal(), Installer\envCheckUploadsDirectory(), CountMessages\execute(), PruneFileCache\execute(), ApiQueryAllUsers\execute(), ApiQueryDeletedrevs\execute(), ApiQueryLangLinks\execute(), ApiQueryIWLinks\execute(), MergeMessageFileList\execute(), ApiQueryFilearchive\execute(), SpecialExport\execute(), FindHooks\execute(), Exif\exifGPStoNumber(), findFiles(), Lang2Po\generatePo(), WebInstallerOutput\getCSS(), FileBackendStore\getFileList(), FSFileBackend\getFileListInternal(), SwiftFileBackend\getFileListInternal(), SwiftFileBackend\getFileListPageInternal(), SqliteInstaller\getLocalSettings(), RandomImageGenerator\getRandomFilenames(), SpecialVersion\getSvnInfo(), SpecialVersion\getSvnRevision(), ForeignAPIFile\getThumbnails(), LocalFile\getThumbnails(), NewParserTest\getUploadDir(), FileRepo\initDeletedDir(), SqliteInstaller\needsUpgrade(), SqliteInstaller\openConnection(), ImageCleanup\pokeFile(), PruneFileCache\prune_directory(), LocalFile\purgeOldThumbnails(), LocalFile\purgeThumbList(), ForeignAPIFile\purgeThumbnails(), LocalFile\purgeThumbnails(), ResourceLoaderFileModule\readStyleFile(), FileBackendTest\recursiveClean(), ApiQueryImages\run(), ApiQueryCategoryMembers\run(), ApiQueryDuplicateFiles\run(), ApiQueryAllCategories\run(), ApiQueryCategories\run(), ApiQueryAllpages\run(), ApiQueryAllimages\run(), ApiQueryLinks\run(), WikiImporter\setImageBasePath(), SqliteInstaller\setupDatabase(), UploadFromUrlTestSuite\setupUploadDir(), ParserTest\setupUploadDir(), Article\showCssOrJsPage(), EnhancedChangesList\sideArrow(), SqliteInstaller\submitConnectForm(), ExifRotationTest\tearDownFiles(), FileBackendTest\tearDownFiles(), CdbTest\testCdb(), wfMkdirParents(), wfRecursiveRemoveDir(), RandomImageGenerator\writeImages(), and MessageWriter\writeMessagesArray().

$extensions
$license = isset( $options['license'] ) ? $options['license'] : ''
if ($sleep) $limit = @$options['limit']

Definition at line 97 of file importImages.php.

Referenced by Maintenance\adjustMemoryLimit(), Parser\braceSubstitution(), Title\countAuthorsBetween(), PrefixSearch\defaultSearchBackend(), SpecialRecentchangeslinked\doMainQuery(), SpecialRecentChanges\doMainQuery(), Installer\envCheckMemory(), UpdateSpecialPages\execute(), CleanupRemovedModules\execute(), ApiQueryAllUsers\execute(), ApiQueryDeletedrevs\execute(), ApiOpenSearch\execute(), ApiQueryFilearchive\execute(), SpecialExport\execute(), ApiQueryContributions\execute(), ApiQueryLogEvents\execute(), ApiQueryRevisions\execute(), IndexPager\extractResultInfo(), HistoryAction\feed(), SpecialNewpages\feed(), HistoryAction\fetchRevisions(), WikiDiff3\find_middle_snake(), WikiDiff3\findMostProgress(), WikiPage\flattenRestrictions(), SwiftFileBackend\getFileListPageInternal(), LocalFile\getHistory(), IndexPager\getLimitLinks(), WebRequest\getLimitOffset(), TablePager\getLimitSelect(), Category\getMembers(), DifferenceEngine\getMultiNotice(), ActiveUsersPager\getPageHeader(), SpecialWhatLinksHere\getPrevNext(), Title\getSubpages(), ImagePage\imageLinks(), DifferenceEngine\intermediateEditsMsg(), DatabaseMssql\limitResult(), DatabaseIbm_db2\limitResult(), DatabaseBase\limitResult(), Preprocessor_DOM\memCheck(), Maintenance\memoryLimit(), Language\numLink(), User\pingLimiter(), ApiQueryRandom\prepareQuery(), ImagePage\queryImageLinks(), IndexPager\reallyDoQuery(), AllmessagesTablePager\reallyDoQuery(), MagicWord\replace(), ApiQuerySearch\run(), ApiQueryExtLinksUsage\run(), ApiQueryCategoryMembers\run(), ApiQueryAllLinks\run(), ApiQueryAllpages\run(), ApiQueryAllimages\run(), PrefixSearch\searchBackend(), DatabaseIbm_db2\select(), IndexPager\setLimit(), ApiResult\setParsedLimit(), SpecialWhatLinksHere\showIndirectLinks(), PrefixSearch\specialSearch(), LoginForm\throttleHit(), PrefixSearch\titleSearch(), ApiBase\truncateArray(), Article\updateRestrictions(), WikiPage\updateRestrictions(), Title\updateTitleProtection(), Language\viewPrevNext(), SpecialRecentChanges\webOutput(), wfDebugBacktrace(), wfGetAllCallers(), wfShowingResults(), and wfViewPrevNext().

$optionsWithArgs = array( 'extensions', 'comment', 'comment-file', 'comment-ext', 'user', 'license', 'sleep', 'limit', 'from', 'source-wiki-url' )

Definition at line 35 of file importImages.php.

$processed = $added = $ignored = $skipped = $overwritten = $failed = 0
$sleep = @$options['sleep']

Definition at line 91 of file importImages.php.

Referenced by DeleteImageCache\execute().

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

Definition at line 68 of file importImages.php.

Referenced by UploadFromChunks\__construct(), UploadFromStash\__construct(), DatabaseSqlite\__construct(), Block\__construct(), DatabaseOracle\__construct(), ParserOptions\__construct(), DatabaseIbm_db2\__construct(), DatabaseBase\__construct(), EmailNotification\actuallyNotifyOnPageChange(), MediaWikiTestCase\addCoreDBData(), ApiBlockTest\addDBData(), BlockTest\addDBData(), NewParserTest\addDBData(), UserrightsPage\addLogEntry(), LoginForm\attemptAutoCreate(), EmailConfirmation\attemptConfirm(), EmailInvalidation\attemptInvalidate(), SpecialChangePassword\attemptReset(), RdfMetaData\basics(), SkinTemplate\buildContentNavigationUrls(), SkinTemplate\buildNavUrls(), SpecialBlock\canBlockEmail(), userOptions\CHANGER(), Title\checkActionPermissions(), Title\checkCascadingSourcesRestrictions(), Title\checkCSSandJSPermissions(), ApiMain\checkExecutePermissions(), CompareParsers\checkOptions(), Title\checkPageRestrictions(), Title\checkPermissionHooks(), ApiFileRevert\checkPermissions(), ApiUpload\checkPermissions(), Title\checkQuickPermissions(), Title\checkReadPermissions(), Title\checkSpecialsAndNSPermissions(), SpecialBlock\checkUnblockSelf(), Title\checkUserBlock(), EmailNotification\compose(), Article\confirmDelete(), SpecialContributions\contributionsSub(), ApiFeedWatchlist\createFeedItem(), User\createNew(), Installer\createSysop(), Preferences\datetimePreferences(), ApiDelete\delete(), Article\delete(), SpecialUndelete\diffHeader(), ApiTestCase\doApiRequest(), ApiTestCase\doApiRequestWithToken(), FileDeleteForm\doDelete(), WikiPage\doDeleteArticleReal(), WikiPage\doEdit(), WikiPage\doEditUpdates(), SpecialImport\doImport(), Article\doRollback(), UserrightsPage\doSaveUserGroups(), MovePageForm\doSubmit(), Preferences\editingPreferences(), UserrightsPage\editUserGroupsForm(), ImportSiteScripts\execute(), DeleteDefaultMessages\execute(), SpecialPreferences\execute(), ResetUserTokens\execute(), Undelete\execute(), SpecialBlockme\execute(), SpecialUserlogout\execute(), RollbackEdits\execute(), SpecialChangePassword\execute(), ApiMove\execute(), SpecialWatchlist\execute(), Protect\execute(), ApiImport\execute(), SpecialContributions\execute(), ApiWatch\execute(), ApiQueryDeletedrevs\execute(), ChangePassword\execute(), CreateAndPromote\execute(), ApiLogout\execute(), ApiUserrights\execute(), ApiQueryFilearchive\execute(), ApiEditPage\execute(), ApiPurge\execute(), InitEditCount\execute(), SpecialChangeEmail\execute(), ApiUnblock\execute(), ApiUpload\execute(), ApiQueryLogEvents\execute(), MovePageForm\execute(), DeleteBatch\execute(), ApiBlock\execute(), ApiDelete\execute(), ApiLogin\execute(), MoveBatch\execute(), SpecialImport\execute(), UserrightsPage\execute(), ApiQueryUsers\execute(), SpecialRevisionDelete\execute(), SpecialUpload\execute(), DeletedContributionsPage\execute(), QueryPage\execute(), SpecialUndelete\execute(), UserrightsPage\fetchUser(), SpecialUndelete\formatFileRow(), MIMEsearchPage\formatResult(), FileDuplicateSearchPage\formatResult(), SpecialUndelete\formatRevisionRow(), NewFilesPager\formatRow(), DeletedContribsPager\formatRow(), ContribsPager\formatRow(), WatchedItem\fromUserTitle(), ParserTest\fuzzTest(), CoreParserFunctions\gender(), Preferences\generateSkinOptions(), CreditsAction\getAuthor(), ApiQueryUsers\getAutoGroups(), Revision\getComment(), CreditsAction\getContributors(), WikiPage\getContributors(), ApiQueryUserInfo\getCurrentUserInfo(), UserDupes\getDupes(), LogEventsList\getExtraInputs(), SpecialUndelete\getFileLink(), SpecialBlock\getFormFields(), Preferences\getFormObject(), UsersPager\getGroups(), OutputPage\getHeadLinks(), ApiQueryImageInfo\getInfo(), RecentChange\getIRCLine(), Title\getNotificationTimestamp(), Preferences\getOptionFromUser(), UploadForm\getOptionsSection(), SpecialUndelete\getPageLink(), ResourceLoaderUserGroupsModule\getPages(), Article\getParserOutput(), ApiDelete\getPermissionsError(), SpecialEmailUser\getPermissionsError(), Preferences\getPreferences(), DeletedContribsPager\getQueryInfo(), NewPagesPager\getQueryInfo(), ContribsPager\getQueryInfo(), ApiQueryUserInfo\getRateLimits(), Skin\getRelevantUser(), DifferenceEngine\getRevisionHeader(), RollbackEdits\getRollbackTitles(), DeletedContributionsPage\getSubTitle(), Revision\getText(), ApiTestCase\getTokenList(), ApiUserrights\getUrUser(), SpecialPage\getUsablePages(), SpecialPageFactory\getUsablePages(), DoubleRedirectJob\getUser(), Revision\getUser(), LogEventsList\getUserInput(), Title\getUserPermissionsErrors(), Title\getUserPermissionsErrorsInternal(), ApiQueryUsers\getUserrightsToken(), Parser\getUserSig(), Revision\getUserText(), ApiQueryInfo\getWatchedInfo(), ApiBase\getWatchlistUser(), UserrightsPage\groupCheckboxes(), DumpRenderer\handleRevision(), HistoryPager\historyLine(), ImageHistoryList\imageHistoryLine(), ParserOptions\initialiseFromUser(), ReassignEdits\initialiseUser(), UploadFromUrl\insertJob(), SearchEngineTest\insertPage(), UploadFromUrl\isAllowed(), UploadBase\isAllowed(), LogPager\limitPerformer(), LogPager\limitTitle(), SpecialSearch\load(), Block\load(), User\loadFromUserObject(), Preferences\loadOldSearchNs(), SpecialUndelete\loadRequest(), LoginForm\mainLoginForm(), ResourceLoader\makeLoaderQuery(), ResourceLoader\makeLoaderURL(), WikiPage\makeParserOptions(), OutputPage\makeResourceLoaderLink(), ChangesList\newFromContext(), Block\newFromDB(), DatabaseBase\newFromParams(), User\newFromRow(), User\newFromSession(), ExternalUser\newFromUser(), ParserOptions\newFromUser(), RecentChange\newLogEntry(), RecentChange\notifyEdit(), RecentChange\notifyLog(), RecentChange\notifyNew(), SpecialPasswordReset\onSubmit(), MarkpatrolledAction\onView(), DatabaseMysql\open(), DatabaseMssql\open(), DatabasePostgres\open(), DatabaseOracle\open(), DatabaseIbm_db2\open(), DatabaseIbm_db2\openCataloged(), PostgresInstaller\openConnectionToAnyDB(), PostgresInstaller\openConnectionWithParams(), SkinTemplate\outputPage(), MediaWiki\performAction(), MediaWiki\performRequest(), UploadFromChunks\performUpload(), UploadFromStash\performUpload(), UploadFromUrl\performUpload(), UploadBase\performUpload(), SpecialBlock\postText(), Skin\preloadExistence(), ApiQueryContributions\prepareQuery(), WikiPage\prepareTextForEdit(), ApiQueryContributions\prepareUsername(), ApiQueryBlocks\prepareUsername(), BlockListPager\preprocessResults(), WikiPage\preSaveTransform(), SpecialBlock\processForm(), LoginForm\processLogin(), Preferences\profilePreferences(), Parser\pstPass2(), ManualLogEntry\publish(), CologneBlueTemplate\quickBar(), Title\quickUserCan(), Preferences\rcPreferences(), RebuildRecentchanges\rebuildRecentChangesTablePass4(), LocalFile\recordUpload2(), ApiQueryWatchlistRaw\run(), ApiQueryWatchlist\run(), ApiQueryRecentChanges\run(), ParserTest\runTest(), ApiTest\runTokenTest(), UserrightsPage\saveUserGroups(), Block\setBlocker(), PreferencesForm\setModifiedUser(), ParserTest\setupDatabase(), ApiBase\setWatch(), EditAction\show(), WatchAction\show(), LoginForm\showCreateOrLoginLink(), DifferenceEngine\showDiffPage(), UserrightsPage\showEditUserGroupsForm(), SpecialUndelete\showFileConfirmationForm(), SpecialChangeEmail\showForm(), MovePageForm\showForm(), SpecialChangePassword\showForm(), SpecialImport\showForm(), EditPage\showIntro(), LogEventsList\showLogExtract(), UserrightsPage\showLogFragment(), Article\showMissingArticle(), LogEventsList\showOptions(), EmailConfirmation\showRequestForm(), SpecialUndelete\showRevision(), SpecialUpload\showViewDeletedLinks(), Preferences\skinPreferences(), SeleniumServerManager\startServerOnUnix(), WebInstaller_Name\submit(), SpecialPreferences\submitReset(), ApiTest\testApiGotCookie(), ApiTest\testApiLoginBadPass(), ApiTest\testApiLoginGoodPass(), ArticleTablesTest\testbug14404(), NewParserTest\testFuzzTests(), ApiTest\testGettingToken(), ApiUploadTest\testLogin(), ApiBlockTest\testMakeNormalBlock(), NewParserTest\testParserTest(), NostalgiaTemplate\topLinks(), Preferences\tryFormSubmit(), PageArchive\undeleteRevisions(), WikiPage\updateRestrictions(), LocalFile\upload(), userOptions\USAGER(), HTMLFileCache\useFileCache(), ChangesList\userCan(), LogEventsList\userCan(), Revision\userCan(), Title\userCan(), LogEventsList\userCanBitfield(), Revision\userCanBitfield(), ReassignEdits\userConditions(), MysqlInstaller\userDefinitelyExists(), SearchEngine\userNamespaces(), ReassignEdits\userSpecification(), UploadBase\verifyPermissions(), UploadFromUrl\verifyTitlePermissions(), UploadBase\verifyTitlePermissions(), Preferences\watchlistPreferences(), and UserRightsProxy\whoIs().

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

Definition at line 54 of file importImages.php.

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

Definition at line 74 of file importImages.php.