Motivation
Currently it may happen, that you are not allowed to move a file, but the error message you see first is about something fixable (and you will only be stopped from making the move, after you corrected the first issue. Ideally people are confronted with the hard bugs first.
Acceptance Criteria
- Reorder the checks so that we reach the following order:
- Check if the user is allowed to perform
a movean upload. - Check if the file move is allowed to happen, e.g.
- File exists on Commons
- File extension and MIME type do not match
- Check if there are any solvable issues, e.g.
- Title has already been given
- Title includes forbidden characters
- Check if the user is allowed to perform
- The AbuseFilter is currently run on submit. Since we are not clear yet, what the final interaction between it and FileImporter should look like, integrating the AbuseFilter will be handled later.
Notes
Currently run tests in current order:
- runCommonsHelperChecksAndConversions does all CommonsHelper validations and cleanup.
- runWikiLinkConversions prefixes and unlocalizes namespaces in wiki links.
- runBasicTitleCheck is some basic sanity. This also reports if automatic changes have been made to the file name.
- runPermissionTitleChecks checks if the user can upload files.
- runFileExtensionCheck checks if file extensions are given, and match.
- runDuplicateFilesCheck checks for duplicate uploads based on their SHA1 hash.
- runFileTitleCheck checks if the file name is allowed on the target wiki.
- runLocalTitleConflictCheck checks if a file with the same name already exists.
- runRemoteTitleConflictCheck only runs in case the file was renamed. It checks if there is another file on the source wiki with this name.
Side note
Note it was impossible to fix this before https://gerrit.wikimedia.org/r/510589, because the two checks for CommonsHelper stuff and duplicates happened in two entirely different places, impossible to swap. Now it's really easy: ImportPlanValidator lists all checks.