aboutsummaryrefslogtreecommitdiffstats
path: root/maintenance/importImages.php
Commit message (Collapse)AuthorAgeFilesLines
...
* | Unsuppress another phan issue (part 7)Daimona Eaytoy2019-09-031-0/+1
|/ | | | | | | Bug: T231636 Depends-On: I2cd24e73726394e3200a570c45d5e86b6849bfa9 Depends-On: I4fa3e6aad872434ca397325ed7a83f94973661d0 Change-Id: Ie6233561de78457cae5e4e44e220feec2d1272d8
* s/Import Images/Importing Files/ in importImages.phpReedy2019-06-281-1/+1
| | | | Change-Id: Ie6cc415b8440951e3a04be4f28a30aeb47b0954e
* Replace some uses of deprecated wfFindFile() and wfLocalFile()Derick Alangi2019-06-111-1/+4
| | | | | | | | | | | | | | | | | | | | | These global functions were deprecated in 1.34 and services made available to replace them. See services below; * wfFindFile() - MediaWikiServices::getInstance()->getRepoGroup()->findFile() * wfLocalFind() - MediaWikiServices::getInstance()->getRepoGroup()->getLocalRepo()->newFile() NOTES: * wfFindFile() and wfLocalFind() usages in tests have been ignored in this change per @Timo's comments about state of objects. * includes/upload/UploadBase.php also maintained for now as it causes some failures I don't fully understand, will investigate and handle it in a follow up patch. * Also, includes/MovePage.php Change-Id: I9437494de003f40fbe591321da7b42d16bb732d6
* Use AtEase::quietCall() instead of Wikimedia\quietCall()Derick Alangi2019-06-101-1/+1
| | | | | | | | | Wikimedia\quietCall() is deprecated and AtEase is here for use. I would have loved to do restoreWarnings() and suppressWarnings() in this same patch set but will continue the work for a later patch. Bug: T182273 Change-Id: I43e3a5f378c99b5c40883b35ba133cbd126fc433
* Deprecate User::isBlocked()David Barratt2019-04-251-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The method User::isBlocked() attempts to answer two questions: (1) Does the user have a block? (2) Is the user prevented from performing this action? The method can answer #1, but it cannot answer #2. Since User::getBlock() can also answer #1, this method is redundant. The method cannot answer #2 because there is not enough context in order to answer that question. If access is being checked against a Title object, all access checks can be performed with PermissionManager:userCan() which will also check the user's blocks. If performing all access checks is not desirable, using PermissionManager::isBlockedFrom() is also acceptable for only checking if the user is blocked. This method does *not* determine if the action is allowed, only that the user's block applies to that Title. If access is being checked without an existing Title, User::getBlock() can be used to get the user's block. Then Block::appliesToRight() can be used to determine if the block applies explicitly to a right (or returns null if it is unknown or false if explicitly allowed). If the user is creating a new Title, but the text of the title is not yet known (as in the case of Wikibase), access should be checked with Block::appliesToNamespace(). Bug: T209004 Change-Id: Ic0ad1b92e957797fee8dcd00bd1092fe69fa58f1
* maintenance: Replace custom .ext extraction with pathinfo()Thiemo Kreuz2019-02-281-16/+1
| | | | | | | | Note the custom code was not working correctly for filenames that do not contain a dot. I assume this is not relevant for the filenames this code needs to process. Change-Id: Id4578bc86203dcbd9f76928bbec71a2c46176e11
* Remove a few obscure "done" and "empty" commentsThiemo Kreuz2019-01-301-1/+0
| | | | | | | These don't add any knowledge to what is already obvious from the code, I find. Change-Id: Ia613b6a059f78dbeefdfd020899bd1a6e239a731
* Update MediaWiki\quietCall() -> Wikimedia\quietCall()Reedy2018-02-101-1/+1
| | | | | Bug: T182273 Change-Id: Id7d8e176fcd93040e30e46cb64fc6a3d36bc8230
* Use ::class to resolve class names in maintenance scriptsUmherirrender2018-01-231-1/+1
| | | | | | | This helps to find renamed or misspelled classes earlier. Phan will check the class names Change-Id: I1d4567f47f93eb1436cb98558388e48d35258666
* Remove @param comments that literally repeat what the code saysThiemo Mättig2018-01-101-1/+1
| | | | | | | | | These comments do not add anything. I argue they are worse than having no comments, because I have to read them first to understand they actually don't explain anything. Removing them makes room for actual improvements in the future (if needed). Change-Id: Iee70aad681b3385e9af282d5581c10addbb91ac4
* Replace MimeMagic::singleton() callsReedy2017-11-271-1/+1
| | | | Change-Id: Ieed41b5d6b0f568fe2872e7754f2feae7868fe7a
* Maintenance: add fatalError() methodBryan Davis2017-11-211-3/+3
| | | | | | | | Deprecate the second argument to Maintenance::error() in favor of a new Maintenance::fatalError() method. This is intended to make it easier to review flow control in maintenance scripts. Change-Id: I75699008638f7e99b11210c7bb9e2e131fca7c9e
* Block same-file reuploadsMatthias Mullie2017-09-181-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | When uploading a file, there are a few ways of checking for and blocking (or at least warning about) duplicate uploads already. However, it occasionally seems to happen that files get uploaded twice. The exact same file, usually - submitted at (almost) the exact same time (possibly some error in whatever submits the file upload, but still) Given 2 uploads at (almost) the exact same time, both of them are stored, even if they are the exact same files. The last upload also ends up with a `logging` entry with `log_page = 0`. I don’t believe such upload should go through: if we do find that a file is an exact duplicate of something that already exists, I don’t see any reason it should go through. Note that with this patch, it will become impossible to reupload a file with the exact same hash (which was possible before.) If we still want to allow same-file reuploads while also blocking these kind of race-condition same-uploads, we could make the check more strict (e.g. also check timestamps, or check if page already exists, or …) Bug: T158480 Change-Id: I76cbd2c64c3b893997f1f85974d6f82cbfe121e1
* Remove empty lines at begin of function, if, foreach, switchUmherirrender2017-07-011-2/+0
| | | | | | Organize phpcs.xml a bit Change-Id: Ifb767729b481b4b686e6d6444cf48b1f580cc478
* Remove X-Content-Dimensions headerGilles Dubuc2017-06-121-3/+1
| | | | | | | | Reverts 84e4d7508893, and parts of cdfe08439c3b and 4511f6fa9fa0. Bug: T150741 Bug: T167034 Change-Id: I39cfcf2cb231b6dfef569968fba6f473da258916
* Use file width/height instead of metadata for getContentHeadersGilles Dubuc2017-05-231-1/+3
| | | | | | | | | This allows us to populate X-Content-Dimensions without touching the existing metadata format. Which makes the migration of existing content a lot faster by only having to run refreshFileHeaders. Bug: T150741 Change-Id: I2c0f39b2b01f364c3fab997ccc2f874b7f101d8a
* Store original media dimensions as additional headerGilles Dubuc2017-05-091-1/+3
| | | | | | | | | | | | | | | | For storage repos that support headers (such as Swift), this will store the original media dimensions as an extra custom header, X-Content-Dimensions. The header is formatted to minimize its length when dealing with multipage documents, by expressing the information as page ranges keyed by dimensions. Example for a multipage documents with some pages of different sizes: X-Content-Dimensions: 1903x899:1-9,11/1903x873:10 Example for a single page document: X-Content-Dimensions: 800x600:1 Bug: T150741 Change-Id: Ic4c6a86557b3705cf75d074753e9ce2ee070a6df
* Miscellaneous indentation tweaksBartosz Dziewoński2017-02-271-2/+2
| | | | | | | | | | I was bored. What? Don't look at me that way. I mostly targetted mixed tabs and spaces, but others were not spared. Note that some of the whitespace changes are inside HTML output, extended regexps or SQL snippets. Change-Id: Ie206cc946459f6befcfc2d520e35ad3ea3c0f1e0
* maintenance/importImages: Don't sleep after the last uploadSébastien Santoro2017-01-161-4/+5
| | | | | | | | | | | | | | Currently, the importImages maintenance script offers an option to sleep an arbitrary amount of seconds after each upload. The current logic implementation had a side effect to also sleep after the last image upload. This is not a desired behavior, as the tasks are done and a clean exit with a report are welcome. Instead, sleep will now occur before the second upload and the ones to follow. Change-Id: Ia675f210582c3075e9b59b002a00cb1fc4b44cac
* Rewrite importImages.php to use Maintenance infrastructureMax Semenik2016-12-181-309/+427
| | | | | | I even tested it! Change-Id: I999f5842625c752f01c1eb4b012431c4a24ce7ce
* Migrate callers to new MWFileProps::getPropsFromPath() methodAaron Schulz2016-09-221-1/+2
| | | | | | | | | | | * FSFile should not be responsible for handling this much logic. * Make more MediaHandler classes aware of the fact that an object other than File might be passed in. Use the FSFile instead of a useless empty stdClass object. * Also added more fields to FSFile::placeholderProps to make it more complete. Change-Id: I9fe764b2a7261af507c6555e6a57273cf7d00d36
* Change "slave" => "replica DB" in /maintenanceAaron Schulz2016-09-061-2/+2
| | | | Change-Id: Ibd3d617901130378a935402326cd4eefbb382c9e
* Use english messages for background use of Status::getWikiTextumherirrender2016-04-121-1/+1
| | | | | | | | Status::getWikiText is used for internal logging, api error messages and maintenance scripts. All this places are usually in english, so pass an english language to getWikiText. Change-Id: I3010fca8eb5740a3a851c55a8b12e171714c78f7
* Register importImages options without arguments as actual maintenance script ↵Alex Monk2016-03-121-0/+6
| | | | | | options so they are usable Change-Id: Ia3ba7ed221a4cf7fcf78a6c64f5a59109a1b886d
* Convert all array() syntax to []Kunal Mehta2016-02-171-10/+10
| | | | | | | | | | Per wikitech-l consensus: https://lists.wikimedia.org/pipermail/wikitech-l/2016-February/084821.html Notes: * Disabled CallTimePassByReference due to false positives (T127163) Change-Id: I2c8ce713ce6600a0bb7bf67537c87044c7a45c4b
* importImages.php: Run input file names through UTF8 normalizationananay2016-01-091-1/+1
| | | | | Bug: T78060 Change-Id: I545ea8f28ff3a1aac03c29d27355c0371632ef4d
* User: Mostly remove password handlingBrad Jorsch2015-10-131-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | AuthManager is coming, which will make it easier to add alternative methods of authentication. But in order to do that, we need to finally get around to ripping the password-related bits out of the User class. The password expiration handling isn't used anywhere in core or extensions in Gerrit beyond testing for expired passwords on login and resetting the expiry date on password change. Those bits have been inlined and the functions removed; AuthManager will allow each "authentication provider" to handle its own password expiration. The methods for fetching passwords, including the fact that mPassword and other fields are public, has also been removed. This is already broken in combination with basically any extension that messes with authentication, and the major use outside of that was in creating system users like MassMessage's "MediaWiki message delivery" user. Password setting methods are silently deprecated, since most of the replacements won't be available until AuthManager. But uses in unit testing can be replaced with TestUser::setPasswordForUser() immediately. User::randomPassword() and User::getPasswordFactory() don't really belong in User either. For the former a new PasswordFactory method has been created, while the latter should just be replaced by the two lines to create a PasswordFactory via its constructor. Bug: T47716 Change-Id: I2c736ad72d946fa9b859e6cd335fa58aececc0d5
* Use mediawiki/at-ease library for suppressing warningsKunal Mehta2015-06-111-6/+6
| | | | | | | | | | | | | | | wfSuppressWarnings() and wfRestoreWarnings() were split out into a separate library. All usages in core were replaced with the new functions, and the wf* global functions are marked as deprecated. Additionally, some uses of @ were replaced due to composer's autoloader being loaded even earlier. Ie1234f8c12693408de9b94bf6f84480a90bd4f8e adds the library to mediawiki/vendor. Bug: T100923 Change-Id: I5c35079a0a656180852be0ae6b1262d40f6534c4
* Replace deprecated File::sha1Base36 callumherirrender2014-06-231-1/+1
| | | | Change-Id: I0a2485f1a9426183e1b1c5a5b6e95966f23da237
* Update formatting in maintenance/ (3/4)Siebrand Mazeland2014-04-231-21/+27
| | | | Change-Id: I4390c4ea12a6a626b0e6817b6446635116ca9fe3
* Pass phpcs-strict on maintenance/ (4/8)Siebrand Mazeland2014-04-231-25/+51
| | | | Change-Id: Ib9ee255740681f0d32d76b75ef33b369bc87bcc1
* importImages.php: Correctly generate automatic summaryReedy2013-10-181-1/+1
| | | | | | | | If the summary parameter is not set, then use the page text of the given page, NOT that of the first image uploaded. Bug: 55885 Change-Id: I00ced9d2ce62fc1a00f26ff513866359cf96d535
* Don't blindly overwrite $options in importImages.phpReedy2013-10-181-4/+4
| | | | | Bug: 55883 Change-Id: I695e080000f6abec3ded966f12af3e25c585c3ba
* phpcs: More require/include is not a functionTimo Tijhof2013-05-211-2/+2
| | | | | | | | | | | | | Follows-up I1343872de7, Ia533aedf63 and I2df2f80b81. Also updated usage in text in documentation and the installer LocalSettingsGenerator. Most of them were handled by this regex: - find: (require|include|require_once|include_once)\s*\(\s*(.+?)\s*\)\s*;$ - replace: $1 $2; Change-Id: I6b38aad9a5149c9c43ce18bd8edbab14b8ce43fa
* Change default importImages comment to "Importing file"Reedy2013-05-121-2/+2
| | | | Change-Id: Id65de095d7d7b697092a369f429b9e3b171d3e38
* echo is not a functionumherirrender2013-05-091-22/+22
| | | | | | Removed parenthesis after echo Change-Id: Ia533aedf63b11d15dcc6a5cf75a56134a4b11d86
* (bug 47483) update file metadata in importImagesJan Gerber2013-04-231-2/+11
| | | | | | | | | importImages maintenance script was not updating file metadata when overwriting files. Bring code in importImages in line with LocalFile::upload Bug: 47483 Change-Id: I0e879604ce76ed78708a36df46b58fb3b8a7d6d2
* Fixed some spacing in maintenance folderumherirrender2013-04-181-4/+6
| | | | | | | Added spaces before if, foreach Added some braces for one line statements Change-Id: I9657f72996358f8c1c154cea1ea97970d973723c
* Added/Removed spaces around string concatenationumherirrender2013-04-131-2/+2
| | | | | | | | | And added/removed spaces around some other tokens, like +, -, *, /, <, >, =, ! Fixed windows newline style Change-Id: I0b9c8c408f3f6bfc0d685a074d7ec468fb848fc8
* Add an option to importImages to search subdirectories recursivelyMarius Hoch2012-12-201-1/+2
| | | | Change-Id: I73a0d42884c1006492cd3de912eb1dc6dab08c5e
* Fix tabs inside/between statements/textumherirrender2012-10-261-1/+1
| | | | | | This tabs are strange and a space there is better Change-Id: I0885dff575ee2fcd0668d08fef3226e132c5b319
* Add 2 new options to importImages.phpMax Semenik2012-09-271-18/+32
| | | | | | | --timestamp overrides upload timestamp --summary sets upload summary Change-Id: I930c8b1ce55af0543a41f412ecf702715c82c6df
* Use __DIR__ instead of dirname( __FILE__ )jeroendedauw2012-08-271-2/+2
| | | | | | We can now do this since we finally switched to PHP 5.3 for MW 1.20 and get rid of the silly dirname(__FILE__) stuff :) Change-Id: Id9b2c9cd2e678197aa81c78adced5d1d31ff57b1
* Improve documentation of maintenance scripts.Alexandre Emsenhuber2012-07-241-3/+2
| | | | Change-Id: If0af9922ede902c2c6f18b627d5810f3e888c944
* The if should check $commentText, not $f, which is always set in this branch.Platonides2012-01-271-1/+1
| | | | Notes: http://mediawiki.org/wiki/Special:Code/MediaWiki/110168
* * Merged WikiPage::updateRestrictions() and Title::updateTitleProtection() ↵Alexandre Emsenhuber2011-12-181-23/+23
| | | | | | | | | | | | | | into WikiPage::doUpdateRestrictions(); older methods still work for backward compatibility, but marked Title::updateTitleProtection() as deprecated and for removal in 1.20 since no extension calls it * Removed permissions check from WikiPage::doUpdateRestrictions() and left it for callers, resolves the todo from documentation * Inverted $expiry and $reason parameter between WikiPage::doUpdateRestrictions() and WikiPage::updateRestrictions() for more consistency; WikiPage::doUpdateRestrictions() also requires all parameters to be passed * WikiPage::doUpdateRestrictions() returns a Status object instead of bool for the older one; only possible error at the moment is a read-only database * Updated core calls to these functions * Made maintenance scripts using it simply protect all actions returned by Title::getRestrictionTypes() instead of hardcoded 'edit' and 'move' * This also means that protect.php can be used to protect a non-existing page for creation Notes: http://mediawiki.org/wiki/Special:Code/MediaWiki/106567
* Add some bracesSam Reed2011-10-191-197/+207
| | | | | | | Unindent most of the code Notes: http://mediawiki.org/wiki/Special:Code/MediaWiki/100267
* Swap else if for elseifSam Reed2011-06-171-2/+2
| | | | | | | | | Trimming trailing whitespace also Doing in 3 commits (3/3), so hopefully reviewable in CR... Notes: http://mediawiki.org/wiki/Special:Code/MediaWiki/90282
* Merge r86398 into the old wfWaitForSlaves. Update core calls.Platonides2011-04-201-2/+2
| | | | | | | | | | maintenance/waitForSlave.php still calls the old prototype. Most instances were replaced with sed -i 's/wfWaitForSlaves( [0-9]* );/wfWaitForSlaves();/' ./maintenance/initEditCount.php ./maintenance/updateRestrictions.php ./maintenance/updateSpecialPages.php ./maintenance/importDump.php ./maintenance/moveBatch.php ./maintenance/storage/resolveStubs.php ./maintenance/storage/trackBlobs.php ./maintenance/storage/fixBug20757.php ./maintenance/storage/moveToExternal.php ./maintenance/storage/compressOld.inc ./maintenance/populateSha1.php ./maintenance/deleteDefaultMessages.php ./maintenance/migrateUserGroup.php ./maintenance/importImages.php ./maintenance/runJobs.php ./maintenance/archives/upgradeLogging.php ./maintenance/deleteBatch.php ./maintenance/populateLogSearch.php ./maintenance/populateLogUsertext.php ./maintenance/gearman/gearmanWorker.php ./maintenance/populateRevisionLength.php ./maintenance/refreshLinks.php ./maintenance/deleteSelfExternals.php ./maintenance/upgrade1_5.php ./maintenance/rebuildFileCache.php ./includes/job/RefreshLinksJob.php ./includes/installer/MysqlUpdater.php ./maintenance/convertUserOptions.php ./maintenance/populateParentId.php ./maintenance/runBatchedQuery.php ./maintenance/upgrade1_5.php ./maintenance/waitForSlave.php ./maintenance/populateCategory.php ./maintenance/importImages.php Notes: http://mediawiki.org/wiki/Special:Code/MediaWiki/86447
* (bug 26379) Make the importImages.php maintenance script give useful errorBrian Wolff2010-12-211-2/+4
| | | | | | | messages on failure. (as in pass along the errors generated from publish() ) Notes: http://mediawiki.org/wiki/Special:Code/MediaWiki/78662