Commit graph

22 commits

Author SHA1 Message Date
Timo Tijhof
8df0342eef filebackend: Add normalization for stat errors
Bug: T205567
Change-Id: I75f1eb6dc2cbff0ea0dc0706cca0ad79c54fc612
2018-10-04 23:00:48 +00:00
Aaron Schulz
ec7dfb4a34 filebackend: switch callers from ProcessCacheLRU to MapCacheLRU
Change-Id: I6efe7122ff30053a85461d31be7b5ddad0a5d2af
2018-07-14 11:27:09 +00:00
Umherirrender
130ec2523d Fix PhanTypeMismatchDeclaredParam
Auto fix MediaWiki.Commenting.FunctionComment.DefaultNullTypeParam sniff

Change-Id: I865323fd0295aabd06f3e3c75e0e5043fb31069e
2018-07-07 00:34:30 +00:00
Bartosz Dziewoński
485f66f174 Use PHP 7 '??' operator instead of '?:' with 'isset()' where convenient
Find: /isset\(\s*([^()]+?)\s*\)\s*\?\s*\1\s*:\s*/
Replace with: '\1 ?? '

(Everywhere except includes/PHPVersionCheck.php)
(Then, manually fix some line length and indentation issues)

Then manually reviewed the replacements for cases where confusing
operator precedence would result in incorrect results
(fixing those in I478db046a1cc162c6767003ce45c9b56270f3372).

Change-Id: I33b421c8cb11cdd4ce896488c9ff5313f03a38cf
2018-05-30 18:06:13 -07:00
Bartosz Dziewoński
4fd27f006f Use PHP 5.6 '**' operator instead of 'pow()' function
Change-Id: Ieb22e1dbfcffaa4e7b3dcfabbcc999e5dd59a4bf
2018-05-30 18:05:19 -07:00
Reedy
39f0f919c5 Update suppressWarning()/restoreWarning() calls
Bug: T182273
Change-Id: I9e1b628fe5949ca54258424c2e45b2fb6d491d0f
2018-02-10 08:50:12 +00:00
Chad Horohoe
5c93fabafd Drop XCache support
It was never super popular anyway, APC was always the best option.
The project has no plans to move to PHP7, so it's quickly reaching
its end of life. Oh, and Fedora dropped it from their repos 2 years
ago.

Change-Id: Ia3257e86a6323d8943f04a5c05c72c0bd4c4b0a9
2018-02-07 13:45:40 -08:00
Umherirrender
3124a990a2 Use ::class to resolve class names in includes files
This helps to find renamed or misspelled classes earlier.
Phan will check the class names

Change-Id: I07a925c2a9404b0865e8a8703864ded9d14aa769
2018-01-27 20:34:29 +01:00
Umherirrender
86463f3df6 build: Updating mediawiki/mediawiki-codesniffer to 0.12.0
Change-Id: Iefaae5043fa77d5d556c31079549dab8f61bd3ef
2017-09-10 21:11:37 +02:00
Timo Tijhof
7f000f8681 Re-introduce use of mime_content_type()
Follows-up eac059c722. See also https://stackoverflow.com/a/39676272/319266.

This function was never deprecated. For a short time, the www.php.net
manual page for `mime_content_type` wrongly documented it as having been
deprecated in PHP 5.3, but this wasn't true, and it has been present in
every PHP version since PHP 4.3, including PHP 7 and HHVM 2.3+.

Between PHP 4.3.0-4.3.2 and PHP 5.0-5.3, the function would be absent
if the Mimemagic extension was not enabled at compile-time. However, while
mime_content_type was first introduced by the Mimemagic PHP ext, it is
backend by the Finfo extension since PHP 5.3.0.

Confirmed via https://3v4l.org/IQC1Q.

* CSSMin: Revert conditional use of finfo back to unconditional use
  of mime_content_type.

* MimeAnalyzer: Replace conditional use of finfo with unconditional use
  use of mime_content_type. Also remove the now-redundant 'else' branch.
  The 'else' branch existed because this code was written at a time where
  MediaWiki still supported PHP 4, of which some minor versions could
  sometimes be compiled without this function.

Change-Id: Iee4a0b6f616a469bb779c40e386045f9c3200446
2017-07-27 02:18:43 +00:00
Aaron Schulz
82e2c924e4 Remove "@author Aaron Schulz" annotations
Bug: T139301
Change-Id: Ib5248e8e27d60611c7373bce4b29dd5e85aa3489
2017-06-27 15:24:14 -07:00
Gilles Dubuc
c2ea52a545 Remove X-Content-Dimensions header
Reverts 84e4d75088, and parts of cdfe08439c and 4511f6fa9f.

Bug: T150741
Bug: T167034
Change-Id: I39cfcf2cb231b6dfef569968fba6f473da258916
2017-06-12 18:07:28 +00:00
Gilles Dubuc
cdfe08439c Store original media dimensions as additional header
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
2017-05-09 15:49:28 -07:00
Aaron Schulz
8d4b97f364 Use executeOpHandlesInternal() in SwiftFileBackend
Instead calling doExecuteOpHandlesInternal() directly, use the
wrapper parent class method instead so that closeResources() is
called on all of the handles.

Change-Id: Iab0d4f7c08d155639a44f48147b78283059a6d24
2017-03-20 18:04:40 +00:00
Timo Tijhof
50a035cd6b Clean up get_class($this) -> static::class in /includes/cache and /includes/libs
* get_class()        -> __CLASS__ (same as self::class)
* get_called_class() -> static::class
* get_class($this)   -> static::class

Change-Id: I22c62851bcc88405f4bdd77258d6e28ec1a14924
2017-03-07 21:06:06 +00:00
Kunal Mehta
a57b64436c Use wikimedia/timestamp
Bug: T100924
Depends-On: I0a067367cda6885fa45631ed7c18799d653dc9bf
Change-Id: I69ba64e364df8af089c1c918cdf32f99454e693a
2017-02-28 21:15:38 -08:00
Erik Bernhardson
d67197fa11 Cleanup some incorrect return annotations
Most of these are simply changing annotations to reflect
reality. If a function can return false to indicate failure
the @return should indicate it.

Some are fixing preg_match calls, preg match returns 1, 0 or false,
but the functions all claim to return booleans.

This is far from all the incorrect return types in mediawiki, there
are around 250 detected by phan, but have to start somewhere.

Change-Id: I1bbdfee6190747bde460f8a7084212ccafe169ef
2016-12-12 10:15:05 -08:00
Aaron Schulz
177e151174 Fix FileBackendStore IDEA warnings due to var reuse
Change-Id: I1b667fb7e891053c7898a0c247745b4376061590
2016-10-18 23:10:58 -07:00
jenkins-bot
69761488b7 Merge "Fix IDEA warnings in FileBackendStore" 2016-09-26 09:58:08 +00:00
Aaron Schulz
600222938d Fix IDEA warnings in FileBackendStore
Change-Id: Icd0fa697645c9a315f49f22216b669c5288c1176
2016-09-24 03:55:38 -07:00
Aaron Schulz
dc522cf0a3 Depedencency cleanups to SwiftFileBackend
* Avoid wf* function MediaWiki dependencies.
* Don't bother with getLocalClusterInstance() caching for the CLI case.
* Give FileBackend a default 'resetOutputBuffer' callback.

Change-Id: I359da1ad77c62880ea799b65cd3a16ad673a64eb
2016-09-24 02:15:32 +00:00
Aaron Schulz
6e5329cd8e Move FileBackendStore and FileOp classes to /libs
Change-Id: If490f64bec282e5dfcdaf7feb1cbf46d3dce1064
2016-09-23 14:46:53 -07:00
Renamed from includes/filebackend/FileBackendStore.php (Browse further)