Commit graph

41 commits

Author SHA1 Message Date
Aaron Schulz
c11e38e3db Dependency inject $wgTmpDirectory into FileBackend classes
Change-Id: I219daffa67ff672bf5bd38921f4b1ca058d96b0f
2016-09-21 04:00:49 +00:00
Aaron Schulz
c64c3ef9a8 Make Status extend StatusValue and start FileBackend update
* This avoids code duplication.
* Callers can safely start type-hinting StatusValue as well.
* Also moved the wrap() logic out of Status::__construct(), which
  only wrap() was (and should have been) using. Use "static" as
  well, so subclass behave properly.
* The docs and type-hints in /filebackend are updated as an example.
* A migration pattern is to inject a StatusValue wrapper
  into the backend and use it on all returned statuses, so MediaWiki
  will still get Status for message methods.

Change-Id: Iff9255f34870ea6b0c4b91f6ddc69eea95186aba
2016-09-17 15:45:40 -07:00
Bartosz Dziewoński
c161c46d26 Improve code suffering from PHP 5.3's lack of support for foo()[]
I searched for /\$(\S+) = (.+?\(.*?\);)\n.*?\$\1\[/, ignored
everything involving isset(), unset() or array assigments, then
skimmed through the remaining results and changed things where they
made sense. These changes were not automated, so please review them.

Change-Id: Ib37b4c66fc57648470f151ad412210b3629c2538
2016-02-28 22:49:20 +01:00
Kunal Mehta
6e9b4f0e9c Convert all array() syntax to []
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
2016-02-17 01:33:00 -08:00
Aaron Schulz
1e03c50891 Fix some FSFileBackend IDEA errors
Change-Id: I372ad7af21f223b670498ac17ecac90918ceb2a8
2015-12-29 01:46:05 -08:00
Thiemo Mättig
d71f05290e Fix and make PHPDoc tags in FileBackend more specific
A pure documentation patch. Should almost be a no-brainer. ;-)

Change-Id: I9bf4d6056f7cde193fe5882a04a7973af9b5a7f4
2015-03-18 17:22:52 +01:00
umherirrender
489d793882 Fixed spacing
- Added/removed spaces around parenthesis
- Added newline in empty blocks
- Added space after switch/foreach/function
- Use tabs at begin of line
- Add newline at end of file

Change-Id: I244cdb2c333489e1020931bf4ac5266a87439f0d
2014-12-05 22:28:07 +01:00
Gilles Dubuc
d984dcbcd6 Improve doPrepareInternal error messages
Bug: 73229
Change-Id: Iee6c478d02c3d6f8d5f7d516c799d9bd53b0272f
2014-11-10 19:52:13 +01:00
umherirrender
b883e8c7c0 Cleanup some docs (includes/[e-l])
- Swap "$variable type" to "type $variable"
- Added missing types
- Fixed spacing inside docs
- Makes beginning of @param/@return/@var/@throws in capital
- Changed some types to match the more common spelling

Change-Id: I41a84e8e1dec39170aa655250325ffc485eaeaef
2014-07-24 19:43:03 +02:00
umherirrender
53c420e278 Fixed spacing
- use tab as indent instead of spaces
- Added space after closures "function"
- Added spaces around string_concat
- Added newline inside empty blocks
- Removed four spaces after comma

Change-Id: I4425b0c6a69b36f40acfea6511b8950cf09ce2b2
2014-07-20 21:41:41 +02:00
umherirrender
de39f3e019 Use some callable hints on @param docs
Callbacks can be given as a string or array, so the hint 'callable' is
used.

Change-Id: I3842606f74c8c3705dffc70bf13e31f44a37fa65
2014-07-03 21:20:35 +02:00
Aaron Schulz
4e72a7dfa4 Fixed FSFileOpHandle comment
Change-Id: Ie89d18f173f4fb172c35317cee9403e5f5f43d47
2014-06-13 10:17:33 -07:00
Aaron Schulz
c36eb818f8 Made FSFileBackend use closures for doExecuteOpHandlesInternal()
Change-Id: I8401a92384cb454eb79a4607b350c50d432a9510
2014-06-12 13:40:03 -07:00
Aaron Schulz
0d54e6e0bf Added unicode encoding support flags to FileBackend
* Fixed bug where even using Swift/Azure on Windows
  would disallow non-ASCII file names.

bug: 1780
Change-Id: I19ed72da0b099d35cae74fb08eeb22c113da1065
2014-05-13 14:11:36 -07:00
umherirrender
957adbef22 Fixed some @params documentation (includes/[file...|upload])
Swapped some "$var type" to "type $var" or added missing types
before the $var. Changed some other types to match the more common
spelling. Makes beginning of some text in captial.
Also added some missing @param.

Change-Id: I8804ebe0922d3a414863b162a2110e0b9e49b80f
2014-04-19 17:19:17 +02:00
jenkins-bot
ba7c6b4594 Merge "Remove leading underscore from methods _getResponse*" 2013-11-24 03:20:23 +00:00
Siebrand Mazeland
26d203e2e5 Remove leading underscore from methods _getResponse*
Resolves CodeSniffer warning PSR2.Methods.MethodDeclaration.Underscore

Change-Id: I6cf0fccb47a7e1070999ee510b4d3e0112c41cea
2013-11-24 03:11:57 +00:00
Siebrand Mazeland
34a4bcbd48 Update documentation of file backend classes
Change-Id: I2113aecc53f1b361d9c276113bc0a9f7076cd21c
2013-11-23 19:24:43 +01:00
Siebrand Mazeland
a5c35215e2 Update formatting of file backend classes
Change-Id: Ie69c324e2f1ea0b8a654adee06ebda494cebd10c
2013-11-22 22:17:15 +01:00
Aaron Schulz
754b8babca filebackend: throw exceptions during file iteration.
* This lets calling code be far more robust rather than just
  silently ignoring entries due to some temporary problem.

Change-Id: I3ce2ae34f6cff5e40a80b8da5688503a387ce2a6
2013-06-15 23:01:47 -07:00
Aaron Schulz
7242d938f3 Cleaned up variable/type order in docs.
* A few other minor doc cleanups and obvious type hints.

Change-Id: I454fad0c1942068b4f3632ebd1b605bfbb9dfe7c
2013-06-13 11:18:52 -07:00
Aaron Schulz
a379dbf9db Removed redundant documentation for some methods.
Change-Id: Iad422716f6796cc4b69405182f4a74daa0c93663
2013-06-12 19:58:15 +00:00
Jakub Vrana
2696437506 Fix visibility of error handlers
I've hit this error when $wgDBuser didn't have access to $wgDBname.
I've also checked all other error handlers in core.

An alternative approach would be to use an anonymous function but it doesn't support $this until PHP 5.4 so it would be messier.

Change-Id: I89db2e8c88b84d9b53c4b828ac0208b05a3d3783
2013-05-04 10:10:06 -07:00
umherirrender
1bfc8feb25 Fixed spacing in actions/cache/filebackend/filerepo/job folder
Added spaces before if, foreach
Added some braces for one line statements

Change-Id: Idb93d34e314e5f314223b79208968d6bcd30c40e
2013-04-20 19:18:13 +02:00
ASchulz
c328cf6401 [FileBackend] Cleanup behavior for coping/moving a file over itself.
* Previously, for doQuickOperations(), the default move function
  would just delete the file if it was moved over itself. In fact,
  the php-cloudfiles bindings have this same bug in its move function.
* For both copy and move, when the source and destination are the
  same path, make sure that the headers get updated as specified.
  This only applies for the 'overwrite' case (not 'overwriteSame').
* Fixed bad status for doQuickOperations() when copying a file over
  itself using FSFileBackend.
* Clarified the documentation for 'overwriteSame' option.
* Renamed destSameAsSource to overwriteSameCase in FileOp for clarity.

Change-Id: I3f609d9413795c654de27958b1e807b1fc785f31
2013-03-25 17:06:30 -07:00
Tyler Anthony Romeo
4dcc7961df Fixed @param tags to conform with Doxygen format.
Doxygen expects parameter types to come before the
parameter name in @param tags. Used a quick regex
to switch everything around where possible. This
only fixes cases where a primitve variable (or a
primitive followed by other types) is the variable
type. Other cases will need to be fixed manually.

Change-Id: Ic59fd20856eb0489d70f3469a56ebce0efb3db13
2013-03-11 13:15:01 -04:00
Reedy
c3e4057e06 Kill off numerous unused variables
Change-Id: I7039f1328f37ee669b694f73ee282602186bffd1
2013-03-08 02:36:24 +00:00
umherirrender
d63121016d fix some spacing
Added/removed spaces around logical/arithmetic operator
Reduced multiple empty lines to one empty line
Removed wrong tabs before comments at end of line
Removed too many spaces in assigments

Change-Id: I2bba4e72f9b5f88c53324d7b70e6042f1aad8f6b
2013-03-07 17:53:21 +01:00
MarkAHershberger
e4ff0c7567 Bug 44157 - The return value of realpath should be tested
Change-Id: Id178ee2fa5e294e858ee2af188e02c67f3205da9
2013-01-31 04:53:22 +00:00
Aaron Schulz
81d0f396b5 [FileBackend] Suppress most file warnings but log them to an FSFileBackend log.
* Also removed a few returns that are not really useful.

Change-Id: I329ff4ffd52675f6a36e48a95d103d850a61fe7a
2012-12-31 11:17:28 -08:00
Reedy
bfbabaab02 Suppress warnings around copy call
Attempt to shut some noise in production logs

Change-Id: I4bac4027d82e4194b6ec46658d52f49038db573c
Warning:  copy(/mnt/thumbs2/wikipedia/commons/thumb/8/8c/Map_of_USA_AK_full.png/120px-Map_of_USA_AK_full.png) [<a href='function.copy'>function.copy</a>]: failed to open stream: No such file or directory in /usr/local/apache/common-local/php-1.21wmf6/includes/filebackend/FSFileBackend.php on line 254
2012-12-22 18:25:34 +00:00
Reedy
faf7d6b7d9 Suppress warnings around unlink call
Attempt to shut a lot of noise in production logs

e.g.
1 Warning:  unlink(/mnt/thumbs2/wikipedia/commons/thumb/f/f2/Members_only_jacket.jpg/800px-Members_only_jacket.jpg) [<a href='function.unlink'>function.unlink</a>]: No such file or directory in /usr/lo
cal/apache/common-local/php-1.21wmf6/includes/filebackend/FSFileBackend.php on line 422

Change-Id: I9e1407c4b11301f468f8e291105955ade9a731d0
2012-12-17 20:27:05 +00:00
Aaron Schulz
3e2bb97cc7 Moved "create" function definitions before "store" for consistency.
Change-Id: Ic44470d7a178cb8dcd8f6a9343f961c26fb92988
2012-11-15 09:22:43 +00:00
Aaron Schulz
84f94fdfd2 [FileBackend] Avoid some stat calls in various operations.
* copy() and rename() will overwrite any destination, including on Windows.
  Tested with Windows 7, and even rename() does this. The /Y flag is also
  set for Windows cmd commands now.
* Set the "binary mode" /B flag for Windows cmd commands.

Change-Id: Id11f31b020f786d5b66b0c57298ecc2b9d6170fb
2012-11-08 06:35:05 +00:00
Aaron Schulz
24a6e8eab6 [FileBackend] Support "ignoreMissingSource" for copy and move operations.
* This lets callers use "copy if exist" semantics more easily and avoids extra stat
  queries to the backend (since the cache is cleared before doOperations()).
* Tweaked FileOp::fileSha1() to reduce backend stat requests as 404s are not cached.

Change-Id: Icb5ca14b3316f273d53593f48979d14e113990e1
2012-10-31 04:24:05 +00:00
Aaron Schulz
9fd48446a1 [FileBackend] Simplified code for handling "overwrite" parameter.
* Since doQuickOperations() implicitely sets "overwrite", and doOperations() handles it
  via FileOp, there is no reason to also have each backend double checking this parameter
  to handle it. The parameter is no implicit for all the *Internal() functions. This does
  not affect callers. It does reduce the amount of HEAD requests since 404s are not cached.

Change-Id: I7d827e16bc55fe5c7b9aa51ec0c6b2f7c0bb629e
2012-10-29 17:13:02 -07:00
Aaron Schulz
8a423dc44e [FileBackend] Added more tests and fixed some local copy/reference bugs.
Change-Id: I21f635174310a1ce406483b546ae98dec218e5ba
2012-10-17 13:15:41 -07:00
Aaron
ae65453e84 [FileBackend] Added getLocalCopyMulti() and getLocalReferenceMulti().
* Optimized these in Swift to use pipelined GETs.
* This can also be used to improve concatenate().

Change-Id: Ibeb5df7532f9f5c16736b20c28b7c0d9ddfb412f
2012-09-21 21:10:54 -07:00
Aaron Schulz
e74ba4b4fd [FileBackend] Made getLocalCopy() handle long file names better.
Change-Id: I54d7c610dba8cb3e7bc0ef4d4bfbb2327e63db07
2012-08-29 22:06:16 -07:00
Aaron
dcec58e09b [FileBackend] Allow enforcing POSIX file owner names.
Change-Id: I9c703bc497f5d6983ef812d105357877c154e17b
2012-08-20 13:03:50 -07:00
Aaron Schulz
a47892abef [FileBackend] Moved filerepo/backend/ up to filebackend
Change-Id: I62ba23bd22e0f177fb48acaf6bcc38cbffacd3e7
2012-08-08 18:20:57 -07:00
Renamed from includes/filerepo/backend/FSFileBackend.php (Browse further)