wiki.techinc.nl/docs
Bartosz Dziewoński 2ee27d9a4d Introduce UploadStashFile hook, improve API handling of stash errors
UploadBase:
* Introduce a new method, tryStashFile(), as a replacement for the
  now-soft-deprecated stashFile(). The method runs the new hook and
  returns a Status object, with an error (if the hook returned an
  error) or a value (if it didn't).
* Introduce a new hook, UploadStashFile, allowing extensions to
  prevent a file from being stashed. Note that code in extensions
  which has not been updated for MediaWiki 1.28 may still call
  stashFile() directly, and therefore not call this hook. For
  important checks (not just for UI), extension authors should use
  UploadVerifyFile or UploadVerifyUpload hooks.
* Extract common code of tryStashFile() and stashFile() to
  a new protected method doStashFile().

SpecialUpload:
* Use tryStashFile() when stashing a file after a warning or
  "recoverable error" was encountered.

ApiUpload:
* Refactor stashing code so that error handling only happens in one
  place, not four different ones. Use Status objects rather than
  exception throwing/catching for control flow.
* Simplify the error messages slightly (error codes are unchanged).
  Produce better ones by always using handleStashException().
  'stashfailed' is now always at root (not nested inside 'warnings'),
  behaving the same as 'filekey' does on success.
* Use tryStashFile() when stashing. Handle errors so as to allow
  custom API results passed via ApiMessage to be preserved.

Some API result changes for different requests are shown below.

  api.php?action=upload&format=json&filename=good.png&file=...&stash=1

    Before:
      {
        "error": {
          "code": "stashfilestorage",
          "info": "Could not store upload in the stash: Stashing temporary file failed: UploadStashFileException Error storing file in '/tmp/phpB32SRT': Could not create directory \"mwstore://local-backend/local-temp/3/3a\".",
          "*": "See http://localhost:3080/w/api.php for API usage"
        }
      }

    After:
      {
        "error": {
          "code": "stashfilestorage",
          "info": "Could not store upload in the stash: Error storing file in '/tmp/phpB32SRT': Could not create directory \"mwstore://local-backend/local-temp/3/3a\".",
          "*": "See http://localhost:3080/w/api.php for API usage"
        }
      }

  api.php?action=upload&format=json&filename=[bad].png&file=...

    Before:
      {
        "upload": {
          "result": "Warning",
          "warnings": {
            "badfilename": "-bad-.png",
            "stashfailed": "Stashing temporary file failed: UploadStashFileException Error storing file in '/tmp/phpB32SRT': Could not create directory \"mwstore://local-backend/local-temp/3/3a\"."
          }
        }
      }

    After:
      {
        "upload": {
          "result": "Warning",
          "stashfailed": "Could not store upload in the stash: Error storing file in '/tmp/phpB32SRT': Could not create directory \"mwstore://local-backend/local-temp/3/3a\"."
          "warnings": {
            "badfilename": "-bad-.png",
          }
        }
      }

Bug: T140521
Change-Id: I2f574b355cd33b2e9fa7ff8e1793503b257cce65
2016-08-09 18:10:18 +02:00
..
code-coverage Tests aren't in /maintenance anymore! ;) 2012-04-15 19:21:12 +01:00
databases Remove DB2 support 2013-02-25 13:47:03 -08:00
html .gitignore for generated html doc 2012-03-31 20:17:34 +02:00
kss KSS: Make section headings links 2015-05-13 10:21:19 +05:30
php-memcached phpcs: More require/include is not a function 2013-05-21 23:26:28 +02:00
uidesign Remove WMF deployment hack for .feedlink from mediawiki.legacy.shared 2015-09-15 18:49:40 +00:00
contenthandler.txt Remove Revision::getRawText() 2016-04-01 19:57:35 +01:00
database.txt docs/database.txt: Don't mention $wgAntiLockFlags 2014-10-27 23:32:22 -04:00
deferred.txt Remove $wgEnotifUseJobQ 2016-01-29 12:24:16 -08:00
design.txt http://www.mediawiki.org --> https://www.mediawiki.org 2014-01-28 07:06:02 +00:00
distributors.txt Update and reformat docs/distributors.txt 2016-07-20 12:46:07 -07:00
doxygen_first_page.php Fix whitespace issues around parentheses 2015-06-16 22:14:02 +03:00
export-0.1.xsd Fix trailing whitespace (and mixed spaces) in XSD files 2012-05-27 14:03:29 +01:00
export-0.2.xsd Fix trailing whitespace (and mixed spaces) in XSD files 2012-05-27 14:03:29 +01:00
export-0.3.xsd Fix trailing whitespace (and mixed spaces) in XSD files 2012-05-27 14:03:29 +01:00
export-0.4.xsd Fix trailing whitespace (and mixed spaces) in XSD files 2012-05-27 14:03:29 +01:00
export-0.5.xsd Fix trailing whitespace (and mixed spaces) in XSD files 2012-05-27 14:03:29 +01:00
export-0.6.xsd Fix trailing whitespace (and mixed spaces) in XSD files 2012-05-27 14:03:29 +01:00
export-0.7.xsd xsd: fix id within contributor to allow 0 2012-06-27 11:31:41 +02:00
export-0.8.xsd Fix escaping of pattern in export-0.8.xsd 2012-11-03 19:38:58 +01:00
export-0.9.xsd Fix 2 0.8 to 0.9 in export-0.9.xsd 2014-07-30 21:08:46 +01:00
export-0.10.xsd Change position of <model> and <format> tags in XML dumps. 2014-10-31 16:49:58 +00:00
export-demo.xml Typo fixes and non-code tweaks 2014-12-12 18:31:15 +00:00
extension.schema.json resourceloader: Implement 'deprecated' option for FileModule 2016-08-04 18:01:53 +00:00
extension.schema.v1.json resourceloader: Implement 'deprecated' option for FileModule 2016-08-04 18:01:53 +00:00
globals.txt
hooks.txt Introduce UploadStashFile hook, improve API handling of stash errors 2016-08-09 18:10:18 +02:00
injection.txt Allow reset of global services (redux). 2016-05-04 19:18:29 +02:00
language.txt http://www.mediawiki.org --> https://www.mediawiki.org 2014-01-28 07:06:02 +00:00
linkcache.txt ellapsed => elapsed 2015-06-23 03:32:33 +00:00
logger.txt Move MWLogger classes to MediaWiki\Logger namespace 2015-04-03 11:32:24 -07:00
magicword.txt Fixed typo: available 2014-03-15 13:02:30 +00:00
maintenance.txt Clean up some old readme files and remove references to SVN 2013-11-16 10:38:50 +00:00
memcached.txt Fix typos in docs/memcached.txt 2016-03-22 16:03:08 -07:00
README Added a link to Developer Hub in docs/README, Sectioning minor rewording, localisation links added to extentsions/README. Other minor changes 2016-07-31 17:33:42 +00:00
schema.txt http://www.mediawiki.org --> https://www.mediawiki.org 2014-01-28 07:06:02 +00:00
scripts.txt Do not support new installations via .php5 entrypoint any longer 2015-06-02 08:38:57 -07:00
sitelist-1.0.xsd Maintenance script for importing site info. 2015-02-18 18:39:14 +01:00
sitelist.txt ellapsed => elapsed 2015-06-23 03:32:33 +00:00
sitescache.txt Split SiteLookup interface from SiteStore 2015-03-18 21:31:48 +01:00
skin.txt Fix some stuttering in comments and documentation 2014-12-17 19:44:10 +00:00
title.txt Fix case of some Title methods 2013-03-26 10:54:15 +01:00

/docs Directory README
======================

The 'docs' directory contain various text files that should help you understand
the most important parts of the code of MediaWiki. More in-depth documentation
can be found at:
  https://www.mediawiki.org/wiki/Manual:Code
  https://www.mediawiki.org/wiki/Developer_hub
API documentation is automatically generated and updated daily at:
  https://doc.wikimedia.org/mediawiki-core/master/php/html/

You can get a fresh version using 'make doc' or mwdocgen.php in the
../maintenance/ directory.


For end users, most of the documentation is located online at:
  https://www.mediawiki.org/wiki/Help:Contents
Documentation for MediaWiki site administrators is at:
  https://www.mediawiki.org/wiki/Manual:Contents