| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Now largely automated:
VARS=$(grep -o "'[A-Za-z0-9_]*'" includes/MainConfigNames.php | \
tr "\n" '|' | sed "s/|$/\n/;s/'//g")
sed -i -E "s/'($VARS)'/MainConfigNames::\1/g" \
$(grep -ERIl "'($VARS)'" includes/)
Then git add -p with lots of error-prone manual checking. Then
semi-manually add all the necessary "use" lines:
vim $(grep -L 'use MediaWiki\\MainConfigNames;' \
$(git diff --cached --name-only --diff-filter=M HEAD^))
I didn't bother fixing lines that were over 100 characters unless they
were over 120 and triggered phpcs.
Bug: T305805
Change-Id: I74e0ab511abecb276717ad4276a124760a268147
|
|
|
|
|
|
|
|
| |
Allow phan to assume that some array keys are always set after call to
normaliseParams to avoid phan suppression
Follow-Up: I701f12ab94478c3b8e7fd82110ade74a8e6b04ef
Change-Id: I8d14e49340d30c56642422cd88169019dd2c4286
|
|
|
|
|
|
|
|
|
|
|
| |
Make phan stricter about array keys
Remaining false positive issues are suppressed.
The suppression and the setting change can only be done together
Bug: T304887
Depends-On: I3105a5fd4826f8667b5232834defc5ec93be32a1
Depends-On: Ie9610a6e83731468311edb3ed17f80fc509de385
Change-Id: I701f12ab94478c3b8e7fd82110ade74a8e6b04ef
|
|
|
|
|
|
|
|
|
|
|
|
| |
Automatically refactors wg prefixed globals to use MediaWikiServices config using Rector. Doesn't include files that set globals or files that fail CI.
Rector Gist: https://gist.github.com/tchin25/7cc54f6d23aedef010b22e4dfbead228
* This patch uses a modified source code rector library for our specific use case and the rector will have different effects without it.
A writeup for future reference is here: https://meta.wikimedia.org/wiki/User:TChin_(WMF)/Using_Rector_On_MediaWiki
Change-Id: I1a691f01cd82e60bf41207d32501edb4b9835e37
|
|
|
|
|
|
|
|
| |
This should not be needed anymore but given that third parties might
still use non-split option, let's keep the cache.
Bug: T296001
Change-Id: I4f8da7e17f868852e05adc4ca06ef23c4168ae2f
|
|
|
|
|
|
|
|
| |
All of production has been migrated to json and this patch also adds an
update entry for third parties.
Bug: T275268
Change-Id: I916127896bdce95472823ae7be12fc5e6e16691a
|
|
|
|
| |
Change-Id: Id4e0235ea4cee249f8b1e137cbd7f865e5ef6f15
|
|
|
|
|
|
|
|
| |
Currently, it's fataling on the beta cluster because metadata can't be
extracted there:
https://commons.wikimedia.beta.wmflabs.org/wiki/File:PrasadSpaceTime.djvu
Change-Id: Ib6cf21de02c50f3b4a975469e6af9d15390dd0e3
|
|
|
|
|
|
|
|
|
|
| |
It has to keep backward compatibility for loading metadata.
Tested locally and works fine.
Bug: T275268
Bug: T192866
Change-Id: Ied61736e329e0e0f37b1db35bd3f7a4b343c01a2
|
|
|
|
| |
Change-Id: Ieefa5bbfddb803ceb41196725c1f344f175c10c3
|
|
|
|
|
|
|
|
|
|
| |
The software behind this is abandoned and we are migrating djvu metadata
to json instead.
This doesn't affect production as we already use djvudump
Bug: T275268
Change-Id: If45ae5746ba91ba305f93603dc1e3aafba80a369
|
|
|
|
|
|
| |
When both branches returns a bool, use the condition as return value
Change-Id: I59416aa021d0ada77d84fda4aaf7def0eea54009
|
|
|
|
|
|
|
| |
This change doesn't change any UI messages.
Bug: T54687
Change-Id: Ia62899a2a6fe8910618c35cd667291e397ddb055
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Image metadata is usually a serialized string representing an array.
Passing the string around internally and having everything unserialize
it is an awkward convention.
Also, many image handlers were reading the file twice: once for
getMetadata() and again for getImageSize(). Often getMetadata()
would actually read the width and height and then throw it away.
So, in filerepo:
* Add File::getMetadataItem(), which promises to allow partial
loading of metadata per my proposal on T275268 in a future commit.
* Add File::getMetadataArray(), which returns the unserialized array.
Some file handlers were returning non-serializable strings from
getMetadata(), so I gave them a legacy array form ['_error' => ...]
* Changed MWFileProps to return the array form of metadata.
* Deprecate the weird File::getImageSize(). It was apparently not
called by anything, but was overridden by UnregisteredLocalFile.
* Wrap serialize/unserialize with File::getMetadataForDb() and
File::loadMetadataFromDb() in preparation for T275268.
In MediaHandler:
* Merged MediaHandler::getImageSize() and MediaHandler::getMetadata()
into getSizeAndMetadata(). Deprecated the old methods.
* Instead of isMetadataValid() we now have isFileMetadataValid(), which
only gets a File object, so it can decide what data it needs to load.
* Simplified getPageDimensions() by having it return false for non-paged
media. It was not called in that case, but was implemented anyway.
In specific handlers:
* Rename DjVuHandler::getUnserializedMetadata() and
extractTreesFromMetadata() for clarity. "Metadata" in these function
names meant an XML string.
* Updated DjVuImage::getImageSize() to provide image sizes in the new
style.
* In ExifBitmapHandler, getRotationForExif() now takes just the
Orientation tag, rather than a serialized string. Also renamed for
clarity.
* In GIFMetadataExtractor, return the width, height and bits per channel
instead of throwing them away. There was some conflation in
decodeBPP() which I picked apart. Refer to GIF89a section 18.
* In JpegMetadataExtractor, process the SOF0/SOF2 segment to extract
bits per channel, width, height and components (channel count). This
is essentially a port of PHP's getimagesize(), so should be bugwards
compatible.
* In PNGMetadataExtractor, return the width and height, which were
previously assigned to unused local variables. I verified the
implementation by referring to the specification.
* In SvgHandler, retain the version validation from unpackMetadata(),
but rename the function since it now takes an array as input.
In tests:
* In ExifBitmapTest, refactored some tests by using a provider.
* In GIFHandlerTest and PNGHandlerTest, I removed the tests in which
getMetadata() returns null, since it doesn't make sense when ported to
getMetadataArray(). I added tests for empty arrays instead.
* In tests, I retained serialization of input data since I figure it's
useful to confirm that existing database rows will continue to be read
correctly. I removed serialization of expected values, replacing them
with plain data.
* In tests, I replaced access to private class constants like
BROKEN_FILE with string literals, since stability is essential. If
the class constant changes, the test should fail.
Elsewhere:
* In maintenance/refreshImageMetadata.php, I removed the check for
shrinking image metadata, since it's not easy to implement and is
not future compatible. Image metadata is expected to shrink in
future.
Bug: T275268
Change-Id: I039785d5b6439d71dcc21dcb972177dba5c3a67d
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Some MediaHandler subclasses were setting custom properties on the File
object in order to cache file-associated state. So:
* Add File::getHandlerState() and File::setHandlerState().
* Put them in an interface, which will be used in a subsequent commit in
MediaHandler::getSizeAndMetadata().
* Use them in DjvuHandler.
* Provide a trivial implementation of the interface, for use in testing
and in the subsequent commit.
Change-Id: Ic365384ff13f7898c1203da38c4405abf03d7563
|
|
|
|
|
|
|
|
|
| |
This is micro-optimization of closure code to avoid binding the closure
to $this where it is not needed.
Created by I25a17fb22b6b669e817317a0f45051ae9c608208
Change-Id: I0ffc6200f6c6693d78a3151cb8cea7dce7c21653
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Use false instead of bool in PHPDocs, because that's the only bool
value that's allowed.
* This patch also fixes DjVuHandler::getPageText() not returning
strings, but XML objects. This kind of "worked" because all consuming
code magically casts these to strings. But this is an actual violation
of the contract of the method. This is also why the test was doing this
weird (string) cast, instead of actually testing the type of the return
value.
Change-Id: I00db6b910f1de6d37a80543b8a5dd5ea3bab3c76
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
A terminating line break has not been required in wfDebug() since 2014,
however no migration was done. Some of these line breaks found their way
into LoggerInterface::debug() calls, where they mess up the formatting
of the debug log.
So, remove terminating line breaks from wfDebug() and
LoggerInterface::debug() calls.
Also:
* Fix the stripping of leading line breaks from the log header emitted
by Setup.php. This feature, accidentally broken in 2014, allows
requests to be distinguished in the log file.
* Avoid using the global variable $self.
* Move the logging of the client IP back to Setup.php. It was moved to
WebRequest in the hopes that it would not always be needed, however
$wgRequest->getIP() is now called unconditionally a few lines up in
Setup.php. This means that it is put in its proper place after the
"start request" message.
* Wrap the log header code in a closure so that variables like $name do
not leak into global scope.
* In Linker.php, remove a few instances of an unnecessary second
parameter to wfDebug().
Change-Id: I96651d3044a95b9d210b51cb8368edc76bebbb9e
|
|
|
|
|
|
|
| |
Follow-up to I93bd71ec1.
Bug: T252228
Change-Id: I45c9fc592c9e41e0868e7d965206d4c04f4f92e1
|
|
|
|
| |
Change-Id: I2bf5543b99dc2ae05f7de02940d120dee353adfe
|
|
|
|
| |
Change-Id: I80ec7aa44b1ea5e7b7d6193732b7da03d7f11960
|
|
|
|
|
|
|
| |
And remove the issue from the exclusions list.
Bug: T231636
Change-Id: Iee73ddb554e354abe52d13dcfc453f9a15bb8877
|
|
|
|
| |
Change-Id: I4046d593d1450cfffc489ca2abadba1084a540e4
|
|
|
|
| |
Change-Id: I429e68c8642a00afa812f5ae900c1fb4f8308528
|
|
|
|
|
|
|
|
|
| |
Proof this method is really not called from anywhere else, except the
ImageHandler class itself, and one subclass:
https://codesearch.wmflabs.org/search/?q=%5CSgetScriptParams&i=1
Change-Id: I57e75ce0cb7c9e52d545b8e8226610bcc6e06c44
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Note I'm intentionally not touching the entire file, but only methods
I'm absolutely sure are already called from outside, e.g. from
MediaHandlerFactory, and must be public because of this.
I'm intentionally not doing anything with private or protected in this
patch, as such changes are much more fragile.
This is a direct follow up for the changes proposed in Iaa4f60d.
Change-Id: Ida817b289ddd5e9a8c162cc1fa3335c639a0bbe5
|
|
|
|
|
| |
Bug: T201491
Change-Id: Ic983889a5702b8b8552c88ebc4d676f35e9fe61e
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
This will make jumping from file to file much easier in text
editors when file name lookups will autocomplete naturally when
looking for a class by name.
Change-Id: I4b2e55a2e72674b619d5a592866c8a019a2b0224
|