Caused the animation warning to not be present on
image description pages
Also add unit tests. Since I'm adding an animated svg file for
this unit test, also add a metadata extraction test for animated
svgs, since we're missing one.
Change-Id: Id03e1a0e1c151d3c575a695a42c54b709187d10a
follow-up: 876128f8c9
The tests currently depend on them never being renamed, which is bad.
(Actual file data in git is de-duplicated automatically AFAIK.)
Change-Id: Id2440326981218f9e7d51541a168db59183fdadf
Thumbnails for portrait-orientation images have always been "too big",
especially when displayed in a gallery. The 'upright' option did not
completely fix the issue. Using a square bounding box for thumbnails
(and 'framed' images) without an explicit size specifiction provides
a better default appearance.
This also provides a clean syntax for content authored using
Parsoid/Visual Editor, which prefers square bounding boxes.
See:
https://www.mediawiki.org/wiki/Requests_for_comment/Square_bounding_boxes
Bug: 63903
Change-Id: I665d8945843d3b5437a74e376b63c44965590116
Support reading git repository information from a JSON file in the cache
directory. When present, this file serves to provide information needed
by getHead, getHeadSHA1, getHeadCommitDate, getCurrentBranch and a new
getRemoteUrl method. A GitInfo::precomputeValues method is also provided
which can generate the cache file for a given GitInfo instance.
This support can be combined with a deployment step to reduce the need
to repeatedly gather information from the .git files/git binary. It also
allows computing information that can be lost when directory structures
differ between deployment staging hosts and hosts running MediaWiki.
This change also adds memoization of computed values for a given GitInfo
instance which may provide a small performance boost even for
deployments which are not using precomputed cache files.
Bug: 53972
Change-Id: I66e058acc5a71e5d82644f85d819f49d6ee9d1e6
Seems good in theory, though not quite usable in practice.
As with subclassing, the aliases would not work reliably
for code that uses type hints and/or instanceof.
See <https://bugs.php.net/bug.php?id=61422>, which I was
previously unaware of.
The best alternative is to add class_alias() calls to the
class files themselves, as well as duplicate entries to the
AutoLoader (just like when multiple classes are in the same
file).
There is no good way to show deprecation warnings, which
likely would have to be implemented in PHP itself. For now,
renamed classes should be indicated in RELEASE-NOTES. Maybe
I will file an RfC (at <https://wiki.php.net/rfc>) for this
and related improvements (e.g. making class names case
sensitive).
This reverts commit c61fdb4ef5.
Change-Id: I9771b4239543b543cfa078f357db1cd3918f081e
Sometimes it is desirable to change a class name that is still referenced
in extensions or config files (e.g. for consistency, as in I507ba00a).
PHP's class_alias() function can help in preserving backward compatibility;
however, creating an alias first requires that the class be loaded.
Hence this is implemented in AutoLoader. Lazy loading continues to work,
the list of class names is still maintained in a central location, and
optionally, deprecation warnings can be generated.
Change-Id: I1d3fb04a448647b5be10bed7fec05238b9fc6fc7
SVG files support having different renderings based on language.
We support changing the rendering language, but we offer no
discoverability of what languages are available.
Long term Jarry's TranslateSVG will hopefully be used and have
all the associated awesomeness. In the mean time, we should
probably have some indication on the image page what languages
are available for the SVG. This is step 1 (extract the language).
I expect to follow this up with a commit adding some sort of
simple selector on the image page.
As an aside, it should be noted, this only detects languages
if its in the first $wgSVGMetadataCutoff (256 kb). This is a
compromise to avoid OOM on huge SVG files.
Change-Id: I2a462270fe63eb3e3023419eddc8b06f5a617ab5
- Place commas correct
- Moved comments
- Add space after if/foreach/catch
- Reformat some conditions
- Removed trailing spaces/tabs
Change-Id: I40ccda72c418c4a33fcd675773cb08d971510cdb
Also added commented-out tests which should work, but don't.
Making them work in subsequent patch If9082f55.
Change-Id: I65f62493e6d10e7e90af8844f8a26e3982d75f51
- Removed double spaces
- Added space after if/switch/foreach
- Removed space on elseif
- Added space around parentheses
- Added newline at end of file
- Removed space before semicolon at end of line
Change-Id: Id40b87e04786c6111e6686d7f7eea1e588bdf37d
Currently file metadata is handler dependant. However they usually
end up extracting the same type of data (author, date, etc) plus
one or two handler specific things. This adds a handler independent
interface for getting metadata that is likely to be common for all
types of file (At the moment, this is the exif/iptc/xmp information)
This commit used to also contain stuff adding parser functions,
which is now split to its own commit. This commit is needed
by a bunch of other commits, in particular I0d957891e0.
Change-Id: I43d9252f69dc5b8ba0b848cf40aa1b97329c85ae
When MediaWiki autoloading fails, we should gracefully return false.
Instead, we have been calling strtolower roughly 1,000 times in the hope
of finding a case-insensitive match.
This patch preserves the legacy case-insensitivity, but improves its
performance by approximately 100x, by storing the case-insensitive class
lookups as a static variable.
There is a new global $wgAutoloadAttemptLowercase which will switch the
behavior if desired. The default is to support case-insensitive loading.
Change-Id: Ifb12e05614a48390b730167e9d4ddcd8545db764
This patch adds support for the LESS stylesheet language to ResourceLoader.
LESS is a stylesheet language that compiles into CSS. The patch includes
lessphp, a LESS compiler implemented in PHP. The rationale for choosing LESS is
explained in a MediaWiki RFC which accompanies this patch, available at
<https://www.mediawiki.org/wiki/Requests_for_comment/LESS>.
LESS support is provided for ResourceLoader file modules. It is triggered by
the presence of the '.less' extension in stylesheet filenames. LESS files are
compiled by lessc, and the resultant CSS is subjected to the standard set of
transformations (CSSJanus & CSSMin). The immediate result of LESS compilation
is encoded as an array, which includes the list of LESS files that were
compiled and their mtimes. This array is cached. Cache invalidation is
performed by comparing the cached mtimes with the mtimes of the files on disk.
If the compiler itself throws an exception, ResourceLoader constructs a
compilation result which consists of the error message encoded as a CSS
comment. Failed compilation results are cached too, but with an expiration time
of five minutes. The expiration time is required because the full list of
referenced files is not known.
Three configuration variables configure the global environment for LESS
modules: $wgResourceLoaderLESSVars, $wgResourceLoaderLESSFunctions, and
$wgResourceLoaderLESSImportPaths. $wgResourceLoaderLESSVars maps variable names
to CSS values, specified as strings. Variables declared in this array are
available in all LESS files. $wgResourceLoaderLESSFunctions is similar, except
it maps custom function names to PHP callables. These functions can be called
from within LESS to transform values. Read more about custom functions at
<http://leafo.net/lessphp/docs/#custom_functions>. Finally,
$wgResourceLoaderLESSImportPaths specifies file system paths in addition to the
current module's path where the LESS compiler should look up files referenced
in @import statements.
The issue of handling of /* @embed */ and /* @noflip */ annotations is left
unresolved. Earlier versions of this patch included an @embed analog
implemented as a LESS custom function, but there was enough ambiguity about
whether the strategy it took was optimal to merit discussing it in a separate,
follow-up patch.
Bug: 40964
Change-Id: Id052a04dd2f76a1f4aef39fbd454bd67f5fd282f
This was an experimental authentication system intoduced a couple
of years ago with a pretty narrow use-case. It's been pretty much
ignored since introduction, and makes login more complicated than
it needs to be.
I didn't drop the external_user table on the off-chance someone
out there actually has data in it, but they should use AuthPlugin
for their external authentication needs.
Change-Id: I794338dbb75961ee033d41fa44bb7aa22e54f447
tests/phpunit/includes/StringUtilsTest.php:42:3
- avoid function calls in a FOR loop test part
tests/phpunit/includes/PathRouterTest.php:155 to 165
- fix space/tabs indenting
- convert double quotes to single for consistency
tests/phpunit/data/xmp/7.result.php
- reindent to use tabs instead of spaces
- removed trailing whitespaces
tests/phpunit/includes/filebackend/FileBackendTest.php
- spaces in indentation
Change-Id: I9c15803f961fc88b798ada3dd6c2b292c1de2143
Fix almost all occurences of the following sniffs:
Generic.CodeAnalysis.UselessOverridingMethod.Found
Generic.Formatting.NoSpaceAfterCast.SpaceFound
Generic.Functions.FunctionCallArgumentSpacing.SpaceBeforeComma
Generic.Functions.OpeningFunctionBraceKernighanRitchie.BraceOnNewLine
Generic.PHP.LowerCaseConstant.Found
PSR2.Classes.PropertyDeclaration.ScopeMissing
PSR2.Files.EndFileNewline.TooMany
PSR2.Methods.MethodDeclaration.StaticBeforeVisibility
Change-Id: I96aacef5bafe5a2bca659744fba1380999cfc37d
In EXIF, GPSAltitude is stored as a fraction string like "1/2".
For values below sea level we were negating this value, in order
to represent the sign and the magnitude in the same value. However,
I forgot to convert that to an integer before negating it. PHP was nice
enough to do a best effort conversion of the string to an integer.
This resulted in altitudes below sea level being taken as just the
numerator of the altitude, which gives results that can be significantly
off.
Also add unit tests for the GPS related image metadata stuff. Change the
existing GPS test to use a fractional altitude (Since this issue isn't
appearent if the denominator is 1). Add tests for XMP as well, since
XMP had same issue, and has to do same processing as EXIF stuff does.
In some future time, may want to consider just converting all exif rational values
to real numbers during the extraction process for generally better sanity.
Patchset 2: rebase
Change-Id: I49032b52a4c840b28e667a6a2b8ae23c508df247
This is reverting the work done by MaxSem to support stored procedures
and stored function in MySQL. The reasons are:
- it is not needed yet
- tests are not functionals
- alter the stable include/db/Database.php and drop support for ';;'
So please create a branch to work on it and merge it back in trunk
once we have branched 1.19 :-)
I have opened bug 33654 to track this enhancement request.
Reverts r107376, r107994.
* Refactored DatabaseBase::sourceStream(), made it possible for descendant classes to alter its behaviour w/o having to redo it completely like Oracle does.
* MySQL class now supports specifying DELIMITER.
* Thrown away the mess of catering for double semicolon. If it's a problem, fix your .sql files!
* Haven't actually touched Oracle.
* Tests!
was starting to get crowded with supporting image files.
This changes the following things
*Moves the media files to a different directory
*Changes the references to the files to reference there new locations
2 semi-unrelated changes
*Modify the README file that was basically giving credit for the images where due to explain what the images are for.
*set svn:mime-type to image/svg+xml for the svg files.
* Removed the ZIP subtypes from $wgMimeTypeBlacklist, they no longer need to be there.
* Added ZipDirectoryReader. Added some small ZIP files which are used to test its various error cases. Most were constructed with a hex editor.
* Fixed getStatusArray() to return a consistent type regardless of whether the error message has parameters. This allows error messages with no parameters to work with the Status object conversion code in UploadBase::verifyFile().