* Use backend-specific makeGlobalKey() method instead of
deprecated wfGlobalCacheKey().
* Call makeCacheKey() inline and reduce to only producing
part of the key (makeCacheKeyHash).
* Add a $ttl (1 month), instead of the previously unspecified
expiry (default: indefinite).
Change-Id: I913a768a3b61cc31ce14fa086a563ceecca7c603
The recursive call is somewhat counter-intuitive, and seems like it could
easily break if forgotten. Instead, move the part that we want to re-use
out into its own method.
Change-Id: I64ced0da211155299744d3c86f7818e751ad027e
* Move "empty tag" case to earlier in highlight() by comparing to
empty string without strlen(). Follows-up cda15b184.
* Turn "shell disabled" case into 'elseif' after length check,
instead of subsequent 'if'. That way, in case of a too large
string, we don't need to check if shell is disabled, and it
also provides the user with the size-related error instead of
the shell-related one.
* Add a few clarifying code comments.
Change-Id: Ib0ef9e683ac4aadd0461fe061ddbe9bfb0a27a82
We cannot set this in the normal "require-dev" because the plugin
depends on exactly PHP 7.0, preventing running tests on any other PHP
version.
Instead, CI will read the version number out of the "extra" field to
figure out what version to install.
Bug: T187497
Change-Id: I36cb5e14e740afabdd42a04ff19b6d59a59a502e
If enabled, apply the default restrictions and take away network access
from pygments.
Bug: T182468
Change-Id: I4e5a6e01a24229a3923642af8de880dbf9167562
We originally started using symfony/process because kzykhys/pygments
depended upon it. But that library was unmaintained and became broken,
so we stopped using it, and just used symfony/process directly.
At the time, the main reason in favor of symfony/process was that it
could pass stdin to pygments, while Shell\Command couldn't - but it can
now (T182463)! On top of that, there are downsides, like not respecting
the default MediaWiki shell limits, being incompatible with core's
firejail support, and requiring an external composer dependency.
Note that because Shell::command() will enforce MediaWiki's normal
limits, it's possible that some large pages may no longer render with
syntax highlighting if they pass those limits.
Bug: T182467
Bug: T181771
Change-Id: Ie1cb72b7eb17d943f79ecae4d94a2110546ef039
Python 2 is dying, <https://pythonclock.org/>, it's time to move on.
The create_pygmentize_bundle script now requires Python 3 to run, and will
generate a bundle with a python3 shebang. Technically the bundle is still
compatible with Python 2 as long as the shebang is modified.
Bug: T182851
Change-Id: Ifb9d0abf092e2c08d9a638a7dda3bda0bc808789
Add phan configuration for static analysis, and fix phan warnings.
`PhanDeprecatedClass` and `PhanDeprecatedFunction` rules are supressed.
Bug: T179554
Change-Id: I7cbb410ed88ba58198d0557cafd9e6df968ed885
The CSS already has this modifier prefixed with -webkit-, -ms- and
-moz-, some browsers now support this without any prefix (according to
caniuse.com: Chrome 54+, Opera 41+).
Change-Id: Icd67250c26bec61be0fb101f1db077ee13ccf6b7
The following sniffs are failing and were disabled:
* MediaWiki.Files.ClassMatchesFilename.NotMatch
* MediaWiki.Files.ClassMatchesFilename.WrongCase
Change-Id: I2781f52be104163ba58e30055bc7593da6ded29a