Page MenuHomePhabricator

Create check hook before really uploading file with infos about description page and file
Closed, ResolvedPublic

Description

I haven't found a hook that provides me the file, the wikitext and comment for the description page.

Neither UploadVerification nor UploadVerifyFile doesn't seem to include the necessary description page infos and UploadComplete is too late as file was already uploaded and page created.
and UploadForm:BeforeProcessing doesn't allow nice abort.

I think ideally the hook would run right at the start of UploadBase::performUpload and gets the file, pagetext etc. with the ability to cancel the upload.

Needed for AbuseFilter, T89252.

Event Timeline

Se4598 created this task.Feb 11 2015, 11:15 PM
Se4598 raised the priority of this task from to Normal.
Se4598 updated the task description. (Show Details)
Se4598 added a project: MediaWiki-Uploading.
Se4598 added a subscriber: Se4598.
Restricted Application added a project: Multimedia. · View Herald TranscriptFeb 11 2015, 11:15 PM
Restricted Application added a subscriber: Aklapper. · View Herald Transcript
Se4598 updated the task description. (Show Details)Feb 12 2015, 1:08 AM
Se4598 set Security to None.
Jdforrester-WMF moved this task from Untriaged to Backlog on the Multimedia board.Sep 4 2015, 6:25 PM
Restricted Application added a subscriber: Matanya. · View Herald TranscriptSep 4 2015, 6:25 PM
matmarex raised the priority of this task from Normal to High.Jun 17 2016, 12:14 PM

Change 295252 had a related patch set uploaded (by Bartosz Dziewoński):
Introduce new hook UploadVerifyUpload to allow preventing file uploads

https://gerrit.wikimedia.org/r/295252

Some of the changes I'm making will change the action=upload responses for non-hook-related errors slightly, for example:

BeforeAfter
1{
2 "error": {
3 "code": "internal-error",
4 "info": "An internal error occurred",
5 "0": [
6 "directorycreateerror",
7 "mwstore://local-backend/local-public/a/ad"
8 ],
9 "*": "See http://localhost:3080/w/api.php for API usage"
10 }
11}
1{
2 "error": {
3 "code": "internal-error",
4 "info": "Unknown error: \"directorycreateerror\"",
5 "0": [
6 "directorycreateerror",
7 "mwstore://local-backend/local-public/a/ad"
8 ],
9 "stashfailed": "Stashing temporary file failed: UploadStashFileException Error storing file in '/tmp/phpLn0Uqt': Directory \"mwstore://local-backend/local-temp/4/4d\" is read-only.",
10 "invalidparameter": null,
11 "*": "See http://localhost:3080/w/api.php for API usage"
12 }
13}

Change 295252 merged by jenkins-bot:
Introduce new hook UploadVerifyUpload to allow preventing file uploads

https://gerrit.wikimedia.org/r/295252

matmarex closed this task as Resolved.Jul 7 2016, 6:31 AM
matmarex removed a project: Patch-For-Review.