Part of program to remove underscores from class names. Checked core and 675
extensions for occurrences. All uses are in core in core are updated in this
patch. There are no uses in Gerrit extensions.
Change-Id: Id3ff16710a11ce1909a83b58505b250736a073e8
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: I7f605aa9e117b5fd80d9b1440864fe526d2b14a5
* Merged the "collate at end" and "running collate" logic
into the base class to make it more unified and consistent.
* Pulled out DB code into ProfilerSimpleDB class.
* Removed the ProfilerSimple class and updated child classes.
* Made ProfilerSimpleTrace set the debug information too.
* Work around "ended by close()" bug from 99aef03f. Since the
getRawData() method gets called while some wfProfileOut() calls
have not yet happened, make it use the matched call data and let
the final logData() method work on the full data as normal.
* Let ProfilerSimple classes use getFunctionReport() for the profiler
debug log if it is setup instead of making it just return "".
* Made getRawData() work as best as possible with ProfilerMwprof.
* Removed $wgProfileToDatabase since it is now useless.
* Improved DB profile performance with sqlite.
* Updated visibility of various methods.
Change-Id: I1260bab2b5ba12dccbba701bcae4a637cb85c6e8
It's pretty much like action=opensearch but can be used as a generator
which can be handy when you need to retrieve both the list of pages and
some information about them.
Change-Id: Iaffe30a0f7402e1316c4885a805692a34bbe1a6a
Special page to implement list of Tracking Categories. Global
$wgTrackingCategories added containing list of tracking categories
Bug: 60333
Change-Id: I7d4bb90622a6bae60845942ef93cfe64f229d2d2
TitleValue is intended to be a light weight alternative to the Title
class. Any operations on TitleValue are implemented in separate
service classes, like TitleFormatter and PageLinkRenderer. See
<https://www.mediawiki.org/wiki/Requests_for_comment/TitleValue>
for more information.
This change updates SpecialCategories and SpecialLinkSearch to use
TitleValue instead of Title, to demonstrate how TitleValue would be
used, and how the necessary services can be injected and applied.
The intention is to improve testability and reusability; these
advantages will however only become apparent with further refactoring
of the respective special pages. This will be done in follow-up
changes.
More work will be needed to migrate essential functionality from
Title and Linker classes into the respective service classes,
MediaWikiTitleCodec and MediaWikiPageLinkRenderer.
Change-Id: I8eef5a165de4ffcacfbc4911fdacdb15d502fff4
I saw some comments recently on commons suggesting that
better ways are needed to manage duplicate files (There are tools
for if a specific file is a duplicate, but no backlog of
outstanding duplicate files).
This seems like a fairly easy first step in that direction.
Wasn't sure if this should be an image gallery type
query page, or just a list. I think in this case a plain
list is more useful.
Change-Id: Ibe4b9da71ca6451ec4e6b0050feaf3ca70e1b888
Per existing FIXME comment: "This is not very polite. Assume we
do not manage the class."
Reverts the remaining portion of r44296 / 2f584f68a9 while
clarifying the "Give up" comment.
Change-Id: I4471f9376cae6b3c3e8df99e960770863ebf37ca
* Moved ApiRunJobs to a special page instead of going through
ApiMain and having to fight the logic there. As a separate
internal API, this does not show up on the API help page and
is no longer effected by $wgEnableAPI.
bug: 62233
Change-Id: I1db6f526d02e130a66ee03289858a734d89e6c00
I should have done it at the beginning instead of trying to
extract it from recent changes.
Same for SpecialRecentChanges and SpecialRecentChangesLinked
(subclasses).
Created a new API module for it: ApiFeedRecentChanges.
It's somewhat un-API-like and hackish, but all feed modules are.
Old URLs redirect to new ones, so this should be fully
backwards-compatible assuming sane feed reader clients.
Change-Id: I06ee0f01d896bc66545a1800b24693ce7524e433
This makes it more feasible for Wikibase, Flow, etc. to support
enhanced changes format, and allow better support for the rc_source
column in the future.
Change-Id: I873f6b86007000a94337f0c963df4bf8fec5b715
DBUnexpectedErrors are now treated like most other exceptions; we now
hide the error messages (which could contain sensitive information
such as IP addresses) unless $wgShowExceptionDetails is true.
In that case, the messages (and redacted backtraces) would be shown
even if $wgShowDBErrorBacktrace is false, though hiding them would
add complexity to the exception handler for little benefit.
Bug: 26811
Change-Id: I063c241975ce5b12a04abc21821ac67c716b3d5e
they support via Composer.
This change allows extensions to specify they depend on a specific
version or version range of MediaWiki. This is done by adding the
package mediawiki/mediawiki in their composer.json require section.
As MediaWiki itself is not a Composer package and is quite far away
from becoming one, a workaround was needed, which is provided by
this commit.
It works as follows. When "composer install" or "composer update"
is run, a Composer hook is invoked. This hook programmatically
indicates the root package provides MediaWiki, as it indeed does
when extensions are installed into MediaWiki. The package link
of type "provides" includes the MediaWiki version, which is read
from DefaultSettings.php.
This functionality has been tested and confirmed to work. One needs
a recent Composer version for it to have an effect. The upcoming
Composer alpha8 release will suffice. See
https://github.com/composer/composer/issues/2520
Tests are included. Composer independent tests will run always,
while the Composer specific ones are skipped when Composer is
not installed.
People that already have a composer.json file in their MediaWiki
root directory will need to make the same additions there as this
commit makes to composer-json.example. If this is not done, the
new behaviour will not work for them (though no existing behaviour
will break). The change to the json file has been made in such a
way to minimize the likelihood that any future modifications there
will be needed.
Thanks go to @beausimensen (Sculpin) and @seldaek (Composer) for
their support.
Change-Id: I8df66a92971146ab79cd4fcbd181e559115ca240
* A background internal HTTP request used to load the API.
This handles job execution and related periodic tasks.
It avoids blocking the main request or breaking it on fatals.
* This method avoids problems that shelling could have:
** Mismatched apache/cli PHP config or versions.
** Had to start a new process and could not use opcode cache.
** safe_mode and open_basedir restrictions required a fallback.
** Some wiki farms may not respect the --wiki parameter.
** wgMaxShellMemory applies to spawned PHP processes.
** Spawning processes is more prone to DOS due to a lack
of proper limiting/pooling.
bug: 60208
bug: 60210
bug: 60698
bug: 60844
Change-Id: I78b0e709301ac4a0c7b7ed337d6969d7546674bf
So that they are easier to separate from the main debug log.
The two news are:
- 'autoloader' for messages sent by the AutoLoader class
- 'caches' for the list of cache types
Change-Id: Ifb6dc2666fec2323219bbfac94ab53a422e5312a
While redirects can be sort-of queried using list=backlinks with
blfilterredir=redirects, we can get more accurate results with a module
dedicated to this purpose. We can also get the fragment of the redirect
without having to load the content of the redirect page and parse it.
I'm a bit surprised I was able to put together a query for this that
will work as a prop module. Or did I overlook something?
And then we may as well add the corresponding list=allredirects, to work
like alllinks, allfileusages, and alltransclusions.
Bug: 57057
Change-Id: I81082aa9e4e3a3b2c66cc4f9970a97eed83a6a4f
Add action=revisiondelete to the API, and some functions to the
revisiondelete backend to support this.
Bug: 23005
Change-Id: Iee146fed648603b86a35927518f850771fc69bd2
Allows configuration options to be fetched from context.
Only one implementation, GlobalConfig, is provided, which
simply returns $GLOBALS[$name]. There can be more classes
in the future, possibly a database-based one. For convinience
the "wg" prefix is automatically added.
Ironically, this adds the $wgConfigClass global variable
which is used to determine which implementation of Config
to use by default.
The ContextSource getConfig and setConfig methods were introduced
in I23194d1ba (1.23), but have no uses in Gerrit, so they can safely
be re-purposed.
Change-Id: I13baec0b6d4ea7badf20b9c5f9b40846348838e4
This is similar to Special:PermanentLink added in r79036 and has been
asked for several times in different places, including:
- on the English Wikipedia (oldid=539308532)
- on mediawiki.org (lqt_oldid=31691)
- on the French Wikipedia (oldid=93029892)
- on the English Wikipedia again (oldid=588408888)
A notable use-case is linking to diffs in the edit summaries, where
external links are not yet allowed (bug 14892).
All of the following are valid usages:
- [[Special:Diff/12345]] (diff of a revision with the previous one)
- [[Special:Diff/12345/prev]] (diff of a revision with the previous one as well)
- [[Special:Diff/12345/next]] (diff of a revision with the next one)
- [[Special:Diff/12345/cur]] (diff of a revision with the latest one of that page)
- [[Special:Diff/12345/98765]] (diff between arbitrary two revisions)
Co-authored-by: Jérémie Roquet <jroquet@arkanosis.net>
Co-authored-by: Bartosz Dziewoński <matma.rex@gmail.com>
Change-Id: I77fdaf8e04375caa1d67ca4a3ec3bd93920c3309
* envCheckPHP531: Message is outdated ("downgrade to 5.3.0"; the
current minimum PHP version is 5.3.2), and PHP Bug #50394 has
not reappeared in any later version.
* envCheckZE1: zend.ze1_compatibility_mode was removed in 5.3.0.
Also updated the error message for envCheckBrokenXML to remove
the "Upgrade to PHP 5.2.9 or later" wording.
Change-Id: Ifc8754151dd23a0314c6739cb78c7ac61a306bc4
There's a lot in the base search implementations that is specific
to the database backed search. This starts moving some of that out
into a shared base class for those.
For starters, let's not grab a connection to the slave DB for
every single search for backends unless they need it.
Change-Id: Ib66696841eea901e04b21dd309784af889a45ab1
Isn't useful outside of testing as the comments state, but it's
barely even useful for that. People who are testing the cache
code can use CACHE_DB if CACHE_MEMCACHED is too hard.
Change-Id: Ief0aa148376957fdd844c8bb585a133b854a012c
mehcache isn't a caching system, it's a pun.
I'm removing Ehcache support because it's an experiment didn't pan out
and the code's just sitting here abandoned now.
Change-Id: Ief5728b4c61bb5ad8f5a5f0b55415b23ef6727eb
Most of the code has yet to be actually moved there, but it's a start!
It's full of @todo comments, I'm going to go through them later.
This should introduce no functional changes and no backwards
incompatibilities. Verified that all special pages being subclasses
work as they did before (SpecialRecentChanges, SpecialWatchlist,
SpecialRecentChangesLinked).
Change-Id: Icb7671e92a9255619e047ccbe5f457aa22581479
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
Endpoints like XMPP natively support sending XML,
which can be advantageous in some cases.
Since most of the logic is the same as the existing
JSONRCFeedFormatter, it was moved into an abstract
MachineReadableRCFeedFormatter class, which simply
creates the array and lets the implementations format
it.
Change-Id: I44f22777cb55fc1ca6527b79ef40b340e2afbd58
* Added a new curl multi wrapper under libs/.
* Used the new MultiHttpClient class instead of CloudFiles
* Removed CDN related config and code as it does not work.
well due to mutating files and tiny purge rate limits by CDNs.
* Also removed the unused and esoteric 'swiftAnonUser' parameter.
* Support concurrent 'describe' operations.
* Set ACLs on containers on intial PUT instead of in two steps.
Previously if the second step failed, prepare() would never
set the ACLs correctly since it aborts if the container exists.
* Improve token deletion to only trigger on 401s rather than other
random errors like 50X timeouts.
* Removed duplicative getResponse* code by just using one closure
called for both the concurrent and serial cases. Both cases are
now funneled through doExecuteOpHandlesInternal().
* Add the MD5 to stat info, as it might be useful for speeding up
the copy scripts in some cases (when both backends have md5 set).
* Avoid use of trigger_error() since there is a swift log group.
* A few other small code cleanups.
Change-Id: I1adb3e2df6df8cf01d3ad74158de96ea9a79da2e
ProfilerMwprof is similar to ProfilerSimpleUDP in that accumulated profiling
samples are emitted to a remote host using UDP. Profiling data for sections
that are called multiple times are aggregating using the RunningStat class I
introduced in Ifedda276d; this provides the ability to compute timing variance
across multiple requests without storing individual values for a second pass
through the data.
Entries are serialized into MessagePack arrays, using the implementation added
in Id2833c5a9. The first element of each array is an entry type specifier.
Currently two types exist: TYPE_SINGLE (single sample; no statistical moments)
and TYPE_RUNNING (aggregated entry with statistical moments). Additional entry
formats may be specified in the future.
TYPE_SINGLE entries have the format:
[ TYPE_SINGLE, name (string), CPU time (float), wall time (float ]
TYPE_RUNNING entries have the format:
[ TYPE_RUNNING, name (string), count (int),
CPU m1 (float), CPU m2 (float), CPU min (float), CPU max (float),
wall m1 (float), wall m2 (float), wall min (float), wall max (float) ]
To help reviewers test this change, I have a trivial Python script that can
serve as the back-end: <https://gist.github.com/atdt/8290191>
Change-Id: I688e7231dad9fcc9d29954afacc47f55d521f58d
Certain applications, such as the generation of PDFs, could use a list
of all non-anonymous contributors to the page (as well as a count of
anonymous contributors) without crawling the output of prop=revisions.
This patch adds a prop module to retrieve this information.
Including the IP addresses of anonymous contributors is not realistically
possible without further schema changes, so that is not done here.
Additionally, revisions with DELETED_USER will be skipped entirely.
Change-Id: Iaff50dfb09016154901a5197aa14eb9f8febcbc5
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
There is nothing about the class that mandates it be used exclusively for
profiling, or exclusively within the context of MediaWiki. The functionality it
provides is generic. So move it to libs/ to make it easier to discover & reuse.
Change-Id: Iac8f2f8e1c3231ebe76318d72cf6225e25a7b891
MessagePack is a space-efficient binary data interchange format. I am going to
use it to encode profiling data in ProfilerSimpleUDP. The official PHP
implementation is provided as a C extension, so using it would further
encumber migration to HHVM. This patch adds MWMessagePack, a class implementing
a pack() method for encoding native PHP values as MessagePack byte strings. The
implementation is based on <https://github.com/onlinecity/msgpack-php>, but
revised for clarity and conformity with MediaWiki coding conventions.
Change-Id: Id2833c5a9da659cb13ec1330de9dd57138ada9c8
RunningStat computes the central tendency, shape, and extrema of a set of
points online, in constant space. It uses a neat one-pass algorithm for
calculating variance, described here:
<en.wikipedia.org/wiki/Algorithms_for_calculating_variance#On-line_algorithm>
This particular implementation adapts a sample C++ implementation by John D.
Cook to PHP. See <http://www.johndcook.com/standard_deviation.html> and
<http://www.johndcook.com/skewness_kurtosis.html>.
RunningStat instances can be combined. The resultant RunningStat has the same
state it would have had if it had been used to accumulate each point. This
property is attractive because it allows separate threads of execution to
process a stream in parallel. More importantly, individual points can be
accumulated in stages, without loss of fidelity, at intermediate points in the
aggregation process. JavaScript profiling samples can be accumulated in the
user's browser and be combined with measurements from other browsers on the
profiling data aggregator. Functions that are called multiple times in the
course of a profiled web request can be accumulated in MediaWiki prior to being
transmitted to the profiling data aggregator.
Usage will be introduced in a dependent commit.
Change-Id: Ifedda276dfe8e0783cb8c4a95626e2aedd4ad368
* This backend passes all filebackend and parser tests
* Fixed setupUploads() in parser tests to just use create() instead
of using store() and having a race condition in the process
* Fixed 'use-filebackend=' for Parser tests
bug: 58094
Change-Id: Ib0c38183cb7f9f2325da98c8a8a1eb2b8e39a7aa
For consistency with SpecialRecentChanges.
This introduces no incompatibilities as PHP classes are case-insensitive.
Change-Id: I5855074deed52fd7492f033c8a8fced8af647602
ICU does not currently support Sorani Kurdish / Central Kurdish
language ('ckb'). CollationCkb uses the same collation rules as
Persian / Farsi ('fa'), but different characters for digits.
For use at ckb.wikipedia, which currently has 'uca-fa' collation
deployed as a workaround.
Added the MW language used for transforming digits to cache key for
first-letters data, in addition to the ICU locale.
Bug: 55630
Change-Id: I7d7f007592ede952859c5c9556b9ea5084b90e89
Separated base classes for special pages (most of them abstract) and
several actual special pages, which were previously both in the same
file.
Added license headings, @ingroup SpecialPage and updated class doc
comments; no other changes.
Most classes are now in separate files (the list of changes can be
seen by diffing AutoLoader.php), with three exceptions:
* SpecialListAdmins and SpecialListBots (redirects to
Special:ListUsers with a parameter) joined their friend in
includes/specials/SpecialListusers.php.
* SpecialMycontributions, SpecialMypage, SpecialMytalk,
SpecialMyuploads and SpecialAllMyUploads were moved into a new file
includes/specials/SpecialMyRedirectPages.php – each of them is
literally ten lines of code and any changes are likely to touch them
all, separate files seem impractical.
* RedirectSpecialArticle and SpecialRedirectToSpecial are in one file
with their parent class RedirectSpecialPage (on a side note, I filed
bug 58215 to rename them to something less silly).
Change-Id: Ida87238401b182924dbe169a6278588bc2fbecfd
* The changes refreshLinks to handle both per-title (leaf) and backlink jobs.
The base job now splits into some leaf jobs and a remaining partition job.
The partition job does the same until there are only a small number
of backlinks in the remaining range (so only leaf jobs are added).
Since the leaf jobs are pushed first, this works well for FIFO queues
to avoid bloating the queue. This also improves per-title job
de-duplication, which isQueueDeprioritized() pretty much killed.
* The refreshLinks2 class is no longer used for new jobs.
* Fix process cache bug with JobQueueGroup::push with empty arrays.
* This adds a BacklinksJobUtils with helper functions for partitioning.
* RefreshLinksJob jobs now have a simple version parameter.
* Also moved refreshLinks2Job to its own file.
Change-Id: Id378d47df17248ae02938d5a54ef7ecd29efadbd
Very little modification to extension, add some docs, and GNU license as
per the other core extensions. Removed $isNewParser, as it won't be needed
with new versions of MW, and changed the name of POST variables used.
I have not moved across any of the messages except
english, according to the bug report, translatewiki will sort this out.
The expandtemplates message section has also been added to messages.inc.
htmlspecialchars should not be performed on anything, as it will cause it
to render like <root>
Added this change into the 1.23 release notes.
Bug: 28264
Change-Id: I7ef63488dc3ad3885bcf99ff52852e1c6981942b
Part of program to remove underscores from class names. Checked core and
600+ extensions for occurrences. All uses are in core in core are updated
in this patch. No uses in extensions.
Change-Id: I86b8c6f8702e661554c7b794df09892db94a84d1
Part of program to remove underscores from class names. Checked core and
600+ extensions for occurrences. All uses are in core in core are updated
in this patch.
Change-Id: Ib3094249ab192db80f1639c5e543ece84c688b9a
Classes TitleListDependency and TitleDependency that are currently not
used. Searched core and extensions in Gerrit.
Change-Id: I51404ce36c4ef55393588817d1673fd17c81b4a2
iPart of program to remove underscores from class names. Checked core and
600+ extensions for occurrences. All uses are in core, and are updated in
this change.
Change-Id: I432dc249d22053728013ae7d0d56c3c398021c5e
Part of program to remove underscores from class names. Checked core and
600+ extensions for occurrences. All uses are in core, and are updated in
this change.
Change-Id: Ib157c3cf209677718ff184552cf872b1d3f4e969
This reverts commit 5e1efc3144.
This sort of thing needs to be discussed. Please do not self-approve changes like this.
Change-Id: I9eb9ea315d90584b7fe95db43a6759884f9506b5
Searched extensions and there is a follow-up for Translate extension. Because class
names are not case-sensitive, this change is backwards-compatible.
Change-Id: Ice6c8beea4fba5c00278c063e4f6198294efabdc
Searched core and 600+ extensions for uses. Found no more.
Class names are case-insensitive anyway.
Change-Id: I296d39be9aa3a2690f80a23691b34394aa1c6637
- Inheritance was a little funny, reduced some duplication
- Throw CdbException instead of plain MWException
- Abstracted wfDebug() to encourage reuse
- Declare visibility on a couple of public methods
- Move DBA implementations to their own file
Change-Id: I2edfeabaf62e39927abe869764ff2bd676821cd0
Also gets rid of some CodeSniffer errors. There are more cases in core
(cache, pool counter, installer, database, load balancer, diff, CSS
Janus, less (argh!), media, parser, revdel, ...), that have class names
with underscores I'd be trying to get rid of later.
Change-Id: I33709c05e597978a5574a445fa43c583cbd7e12b
Make protected, add method to allow tests to clear the protected class
property, and remove a now unneeded class from the test.
Change-Id: I269cab8d3f4419c91dfe15d5722e19ff6da828d1
These are classes that provide facilities for use by any caller, are
independent of user interface, and have a limited set of dependencies on
the rest of MediaWiki. See the README file for a more precise
definition.
These classes cannot go in includes/libs because of a dependency on the
MediaWiki framework, such as wfDebug() or MWException, but they are
otherwise similar. I thought it would be useful to put them in their own
directory, to make them more discoverable, and as part of a general
program of reducing clutter in the base includes/ directory.
I've probably missed a few classes which could be included here, but the
following classes were considered and were rejected for now:
* Fallback: single caller only
* GitInfo: getViewers() has inappropriate dependencies
* HttpFunctions: depends on configuration, $wgTitle
* PoolCounter: depends on configuration
* CacheHelper: depends on IContextSource, wfMemc()
Also moved a couple of classes into libs/ instead, where that seemed to
be more appropriate.
Change-Id: I274cff805b7d694b728a89b764a049cd62d320fe
The grouping makes at least as much sense as job/, and certainly makes
more sense than cache/. With directories named after base classes, it is
fairly easy to tell what should go where. The grouping of
DeferredUpdates, DataUpdate and CallableUpdate would surely be
uncontroversial.
The move of SearchUpdate out of search/ demonstrates the conflict between
arrangement by module versus arrangement by type, which is the most
difficult design question here. I think arrangement by type is more
consistent with e.g. the arrangement of the core root, i.e. tests/,
resources/, maintenance/, etc. where a given feature will have its files
split up into a mostly type-based hierarchy.
I also tidied up AutoLoader.php by moving includes/content to the correct
location, sorted alphabetically by subdirectory.
Verified with AutoLoaderTest.
Change-Id: Ib369411d0caca38e72978084aa57348f1b892ed0
* Move some classes to separate files to avoid having a monstrous file with a
dozen classes.
* Remove weird underscores from class names.
* Instead of prefixing members with underscores, specify visibility explicitly.
* Rename c_style -> camelCase per coding conventions.
* Throw exceptions instead of fataling out with trigger_error().
* Remove pointless constant used only once.
Change-Id: Icac23c0f6259c73f5fe07f201b83b9c332ba0469
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 a class which implements the RCFeedEngine interface by
publishing recent change notifications to Redis. The class handles the
'redis://' URI scheme. Recent changes are PUBLISHed to the channel 'rc'; a
different channel name may be specified as a path component.
Change-Id: I846036c091c45059a8947245a1efe92c9800dcf4
$wgBlockOpenProxies, $wgProxyPorts, $wgProxyScriptPath, and
$wgProxyMemcExpiry have been removed, along with the open proxy
scanner script they were added for.
Bug: 54597
Change-Id: Id4c7521443f04995df3d8762d23629c18ada76f8
Throws exception unconditionally, installer support is totally broken.
This reverts commit b2d64432ee.
Change-Id: I2edb78440806754c42d48c5da2ff74b4cb40fa2d
DatabaseBase::factory()'s parameter array now takes an optional
'driver' variable to allow specifying a specific driver for the
database class if we support more than one.
This is so we can gracefully support mysql/mysqli as the former is
deprecated, but the concept could be extended to other databases
as well.
Bug: 45288
Co-Author: Chad Horohoe <chadh@wikimedia.org>
Change-Id: I6733fe21c4aa7443e409c5dfa7c789552b2b62b7
We currently only return the image repository name for imageinfo, which
is not particularly useful, especially since image repositories aren't
accessible via the API. This patch adds meta=filerepoinfo, which will
return a list of repositories and relevant information (like the API URL
for ForeignAPIRepo ones)
Also returns the local repo now, and defaults to "all" in a more useful
fashion.
Change-Id: I1aaed0895d2a0bc224c82e93975ecf6afd8cb6b8
Intermittent error in production from top-level lambda functions:
https://bugs.php.net/bug.php?id=52144
Change-Id: I9785a601fd5d57c9d8d84b90ee29eef61a6f2e77
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 class is needed by CirrusSearch, another application will be API
prop=extracts which doesn't really belong to MobileFrontend and will also
be integrated into core soon.
Change-Id: Ic276e1604c5718e8568e120ddfb9a8fc13a682fc
Disambiguation related functions have been re-implemented in the
Disambiguator extension.
Bug: 35981
Change-Id: I4afa30bf2677c6541ef355013f8eaef46abfbe03
Dependency: I41637ea43a9e5000bcb8a782441ce36f1068881f
This solves the problem of new users on commons wanting a list of
their files, but something like cropbot modifying it and taking
it off Special:MyUploads.
I'm worried this is a bit hacky to make TablePager work with
two queries. If anyone has any suggestions on how to do this
in a less hacky way, please say.
Some notes:
* This totally removes any revdeleted entries instead
of dealing with them. Some future iteration can do selective
deletion.
* Should maybe add links to old versions of files description
page somewhere. Not sure where in ui that would fit (The date maybe)
(by old file description page I mean something like flagged revs
filetimestamp parameter)
* The latest version column should perhaps have "latest" and "old"
instead of "yes" or "no"
* This is slightly different from the suggestion on the bug report
as it shows all revisions (instead of say just first revisions).
I think showing all revisions makes more sense for the "where
are my uploads" use case. Second of all, the checkbox is not on
by default.
Bug: 30607
Change-Id: I9e58db1f212e3bb361316c05ef32d4b9c31c6490
This introduces a new configuration variable, $wgRCFeeds, which allows the user
to configure multiple destinations for RC notifications. It also allows the
notification format to be customized. Two formats are included by default: the
older IRC format and a new JSON format.
Change-Id: I270bde418a82985c94372ac4579100435b6ee026
This extension adds a "mode" parameter to the gallery
tag, allowing different formats for the gallery tag
(galleries in the ui can be controlled by a global)
The added modes are:
*traditional - The original gallery
*nolines - Like the original, no borders, less padding
*packed - All images aligned by having same height.
JS also justifies the images.
(I think this one is the one that will go over best
with users.)
*packed-overlay - like packed, but caption goes over
top the image in a transloucent box.
*packed-hover - like packed-overlay, but caption only
visible on hover. Degrades gracefully on screen
readers, and falls back to packed-overlay if
you are using a touch screen. I kind of like
this mode when the caption is not that important
(ex a category where its just the file name).
This also adds a hook to allow people to make their
own gallery version. I believe there would be interest
in this, as different people have done different
experiments. For example:
* Wikia: http://community.wikia.com/wiki/Help:Galleries,_Slideshows,_and_Sliders/wikitext
* Wikinews: https://en.wikinews.org/wiki/Template:Picture_select
What I would like to see for this patch, is first it gets
enabled, with the default still "traditional". After
about a month or two we consult with users. If feedback
is positive, we change the default mode to one of the
others (probably "packed").
Adds a "mode" parameter to gallery for different
mode, including one 'height-constrained-overlay'
which looks much more like other modern websites.
Note: This makes one change to the old gallery format.
It makes Nonexistent files be rendered like thumbnails
(i.e. they are rendered with a little grey border).
One thing I'm slightly worried about with this patch,
is that I added an option to MediaTransformOutput::toHtml
to override the width attribute. I'm not sure if that
is the best approach, and would appreciate thoughts
on that.
This should be merged at the same time as Ie82c1548
Change-Id: I33462a8b52502ed76aeb163b66e3704c8618ba23
The method used is quite biased, but I believe its the best
possible without a schema change and still being efficient.
I think it is good enough for many of the use cases that
need different articles to pop up, but not "real" randomness.
The method used
is to chose a random timestamp and look at cl_timestamp. This method
will give good results if the timestamps are uniformly distributed
(which probably is not usually true). I think it may give acceptable
results in general, especially given most people are not interested
in true randomness, but more in "give me a result I haven't seen before".
(For example, to pick a random entry in a maintenance category to clean
up).
It also fudges the result a little bit using offset to stop really
biased results from happening. This is mostly meant to stop a
category with an extremely clumped distributed from returning
the exact same article every time. It is not meant to generally
increase randomness.
Bug: 25931
Change-Id: I0c48e4a236b50fb627af94f0df47fef8372ea14d
Do not allow the user to change it directly; instead create a form
where they can reset it. (The token can still be changed via the API.)
The token is autogenerated whenever it is shown or otherwise used.
This really should have never used the preferences; however, trying to
change that now would be lots of work for very little gain, so this
keeps using that mechanism, adding a little abstraction over it.
It's not unconceivable that similar tokens could be used for other
pieces of data, like Echo's notifications; this enables that with one
new hook.
----
Things done here:
* Add getTokenFromOption() and resetTokenFromOption() methods to User,
abstracting out the get-and-generate-if-empty process of handling
tokens. Respect $wgHiddenPrefs (Watchlist didn't do that
previously).
* Create Special:ResetTokens, inspired by Special:Preferences and
Special:ChangeEmail, presenting the token resetting interface
(HTMLForm-based with CSRF protection).
* Create a new hook, SpecialResetTokensTokens, allowing extensions to
register tokens to be shown in the resetting form. Each token needs
information about the preference it corresponds to and a short
description (used for checkbox label).
* Hide the preference on Special:Preferences (use type=api to achieve
this), display a link to aforementioned special page instead. Move
info blurb to its own section at the bottom.
Bug: 21912
Change-Id: I0bdd2469972c4af81bfb480e9dde58cdd14c67a8
* The "VForm" templates replace existing templates.
* Remove useNew switch logic and $wgUseVForm{UserLogin,CreateAccount}.
* The CSS and JS files for forms lose the .vform qualifier, except for
the CSS for styling vform elements.
* Merge tiny mediawiki.special.userLogin.signup.js into createAccount.js.
* Remove replaced and obsolete messages (see
https://www.mediawiki.org/wiki/Account_creation_user_experience/Strings
for details), and remove mention of "new" forms and useNew from
MessagesQqq.php.
Bug: 46333
Change-Id: I50f25583c3aa9a4a263fb40f50256f92c18ddb4d
* This lets calling code be far more robust rather than just
silently ignoring entries due to some temporary problem.
Change-Id: I3ce2ae34f6cff5e40a80b8da5688503a387ce2a6
PHP extensions mysql and mysqli have lots in common.
In order to support mysqli, this diff separates common MySQL behavior to abstract class DatabaseMysqlBase and implements the mysql-extension specific in DatabaseMysql.
Outside behavior remains the same.
I've tried to minimize future code duplication by introducing mysql*() methods even if the parent method just unwraps the result.
Bug: 45288
Change-Id: I905d4a4550377bc849a860f0962dad710d9dc71f
spl_autoload_register exists in >=5.1.2, we require >=5.3.2
We no longer support hphpc and it looks like hhvm supports spl_autoload_register
We've got no reason to keep using __autoload.
We'll also need to exclusively use spl_autoload_register when we start using composer.json stuff.
Change-Id: I694b7b96825e5d136fa76461511efc9a002149fa
Jenkins does not run the autoloader test (will be fixed in a different
commit). This patch fix the main and test autoloader to add in all the
missing entries.
bug: 47750
Change-Id: I285fa7ed24a6fc45a4dc475b54d80cf3816436fb
Squiz.WhiteSpace.LanguageConstructSpacing:
Language constructs must be followed by a single space;
expected "require_once expression" but found
"require_once(expression)"
It is a keyword (e.g. like `new`, `return` and `print`). As
such the parentheses don't make sense.
Per our code conventions, we use a space after keywords like
these. We appeared to have an unwritten exception for `require`
that doesn't make sense. About 60% of require/include usage
was missing the space and/or had superfluous parentheses.
It is as silly as print("foo") or return("foo"), it works
because keywords have no significance for whitespace between
it and the expression that follows, and since experessions can
be wrapped in parentheses for clarity (e.g. when doing string
concatenation or mathematical operations) the parenthesis
before and after basiclaly just ignored.
Change-Id: I2df2f80b8123714bea7e0771bf94b51ad5bb4b87
This reverts commit 27104686ab.
Revert "Remove link to Special:ActiveUsers from Special:Statistics"
This reverts commit 62949af09e.
I used a sledgehammer where a scalpel would've done--and I should
be whacked with the cluebat. This should be done per-wiki, plus
improvements.
Change-Id: Ib43b42057b8d9f714a8a71ba9cbe375385254b7c
The primary purpose of this page is to redirect to a user page given a
numeric id. The numeric User ID is stable across renames, and is
therefore an appropriate primary key for identifying the user
associated with a given revision. The Parsoid API would like to
export semantic RDFa in its DOM identifying the author of a revision
by their userid, but in order to do so requires a MW redirect from
userid to the appropriate User page. (A "permalink" for the user.)
This patch adds that redirect, as
http://somewiki/Special:Redirect/user/1234
(https://bugzilla.wikimedia.org/show_bug.cgi?id=45206 is the related
Parsoid feature.)
Rather than adding a set of ad-hoc redirection pages, this patch
sets up an infrastructure for redirections. Special:Redirect also
subsumes the functions of:
* Special:Filepath (Special:Redirect/file/xxxx)
* Special:PermanentLink (Special:Redirect/revision/xxxxx)
This structure is extensible for other redirect types.
Change-Id: I8b0785f4fbdb3dd438a7a45263c5f375ff9d2208
Similar to the login form (change 55847), this presents a compact
vertically-stacked form, if a global variable is set or if you add
?useNew=1 to the query string.
The redesigned create account form also:
* Removes the remember me checkbox (see bugzilla 47267)
* Displays some wiki statistics in a benefits column.
* Repositions the FancyCaptcha image if present using JavaScript (see
bugzilla 47372).
* Sets the template skin as in change 59577.
Bug: 44628
Bug: 47267
Change-Id: I9b03d519af43de147bff0ac509a1154f67cd3a0a
- Move files in includes/externalstore to their own location for consistency
- Order MWCryptRand alphabetically
- Add missing HTMLButtonField
Change-Id: Ib3798dce6080960df68badd6237968a33473e36b
* This lets queues be horizontally partitioned onto
different servers, with weights assigned to each.
The queue classes used by the different partitions
can be hetereogenous or homogeneous.
* How partitioning is done is setup similar to LBFactory,
where wikis belong to sections and sections have config.
Change-Id: I44d59b67cf417dca28a3e9b25371dac5a7ffcb47
If a global variable is set or if you add ?useNew=1 to the query string,
Special:Userlogin loads a different login template (UserloginVForm.php)
with the new Vertical Form appearance and different messaging.
Otherwise the current unchanged template renders so that wikis can cut
over to the new look when ready (with messages and links). Once they do
so, the variable and flag will be retired.
The new template applies mw-ui-vform and mw-ui-button styles defined in
a new 'mediawiki.ui' CSS module in core to create a compact vertical
form. The mw-ui styles specify a Helvetica font stack (that we tested
in the Account creation experiment) in the form area, but NOT if the
user is using some other skin than Vector.
The CSS code is developed using Sass. The patch includes the
Sass scss files, along with a Makefile that uses their Compass build
configuration (config.rb).
The redesigned Special:Userlogin also:
* Displays a "secure login" link if HTTPS is available.
* Loads additional CSS for its form features (e.g. more attractive
errorbox, "Join wiki" messaging).
* Defines new "userlogin-xx" messages; many are the same as
existing messages but without ':' on the end.
* Uses a distinct title for Login instead of generic "Log in /
Create account".
* Removes the [mailmypassword] code branch from its login template as it
is never executed.
Bug: 44628
Change-Id: I489042c50aa060c90ca18b05097dbe25c4ae6395
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
Standard, Simple, Chick and MySkin have all been removed.
Nostalgia has been moved to an extension for posterity.
Change-Id: Ia6d73c2deb9428d214b7d69b29235094de75c52e
This will help with improving human readability of JS and JSON
objects encoded by both ResourceLoader and the API. This patch
also adds new "utf8" parameter to the JSON formatter of the API.
Changes to FormatJson class:
* Added escaping of '<', '>', and '&' by default to protect against XSS.
* Removed unnecessary escaping of '/' and added an additional option to
unescape non-ASCII characters (those above U+007F) as well.
* Added PHP 5.3 pretty printing code (to replace Services_JSON) that
uses a four-space indent as PHP 5.4 does.
Changes to Xml class:
* Defined Xml::encodeJsVar() in terms of FormatJson::encode()
and added a pretty printing option. Also added a pretty printing
option to Xml::encodeJsCall() as well.
* Deprecated Xml::escapeJsString() and QuickTemplate::jstext();
callers have to add quotes themselves, hence the escaping of
both double quotes and apostrophes.
Bug: 26818
Change-Id: I1987190f1ba5bf41738e7bd611209706c1f6bb5c
This feature was poorly thought out from the start. It's a huge
performance drain when used, for a mimimally useful set of data
Change-Id: I138622e1c184f74e2a7ce13a9a544ab4e610d7a0
Except LegacyLogFormatter.
includes/logging/LogFormatter.php is getting bigger and bigger with
the addition of new formatters when logs are changed to use them
instead of the old method, so better doing this now before we get
new formatters for remaining log types.
Change-Id: I6aab19c8d68bf47beddad42632b0360a7b12f251
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
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
It would be useful to be able to list pages using a particular page
property, particularly in light of the new Disambiguator extension.
This adds a special page Special:PagesWithProp and an API query module
list=pageswithprop to do just this. It also adds an API query module
list=pagepropnames to list the prop names currently in use on the wiki.
Change-Id: Ib0d4e17f22b8d0cb9894eac6095962315480e809
* The default class is JobQueueAggregatorMemc.
This essentially has the logic that nextJobDB.php used.
* Also created a JobQueueAggregatorRedis class.
This is much more efficient and more responsive.
* This can speed up calls to getQueuesWithJobs().
* Removed unused getDefaultQueuesWithJobs() function.
Change-Id: Ifb3c6c881decd643da1b662956ded69db4b39431
* (bug 44080) Also carry-over the IP and HTTP header info.
* This adds a RequestContext::importScopedSession() function.
Change-Id: Ie9c0a4d78fb719569c8149b9cc8a5430f0ac5673
* Made DBLockManager abstract instead of a hacky blocking implementation.
With a PG and MySQL option, that option is no longer useful.
Change-Id: I939551bd2283608f2d017d9d2fca1334a533c005
* This is useful for making IDs for object in partitioned stores.
* The "UID" functions are not called "UUIDs" since they don't follow RFC4122.
This is for performance reasons since the ID fields tend to be indexed.
* This includes newUUIDv4(), which is compliant with the aforementioned RFC.
This reverts commit 86f895bfe3.
Change-Id: I989626dfb7976d17f5931a34fe040f41cf14dfe3
To reduce the maintenance burden for changes such as Id7ec4e69. The
project to optimise the preprocessor for hiphop is incomplete and is not
especially useful given the present state of hiphop support.
Change-Id: Iebcfe4d40f74520e29e7feb522251892fab2f652
See I4542f57a. Meant as a temporary meassure until such a time
generic tailoring code is implemented for uca. This patch
is mostly Lejonel's code, with the class renamed.
Change-Id: Id39406c37a5277d9e7a9216544de2140411c2b01
This is a non-versioned part of the larger patch #41014https://gerrit.wikimedia.org/r/#/c/41014
It will allow help subsystem optimization (merging paraminfo and help),
path towards per-module or per-system versioning, removal of the
manually maintained generator lists.
Changes:
* ApiModuleManager now handles all submodules (actions,props,lists) and instantiation
* ApiModuleManager maintains a cache of all instantiated modules
* Query stores prop/list/meta as submodules
* action=help suports generalized submodules (modules=query+value), querymodules obsolete
Change-Id: Ie2dee41e44a29cd5d5935eeaa5240b708d95a8f0
* Added ExternalStoreMedium base class
* Moved up two functions in ExternalStoreDB
* Various documentation tweaks
Change-Id: I6790aab7799609422e7af4fb31d2ad60610298ec
* The Job class now includes an extra "metadata" field now for usage
by the queue classes. This is useful for stores that lack IDs.
* A RedisConnectionPool class was added for reusability.
Change-Id: Ie72536240e27fe1caf11096cdc4c85dfa821d181