Commit graph

984 commits

Author SHA1 Message Date
jenkins-bot
a51ae81f11 Merge "Added a simple JobSpecification class for pushing jobs" 2014-01-29 16:58:18 +00:00
jenkins-bot
1d551bdf7b Merge "Split Title and User ArrayFromResult classes to own files" 2014-01-28 23:50:33 +00:00
Aaron Schulz
e049bcb87f Added a simple JobSpecification class for pushing jobs
* Both this and the full Job class can be used to push jobs

bug: 60403
Change-Id: I7e78321b5919e48fd8228580ddde7c90a6e4024e
2014-01-28 10:35:48 -08:00
jenkins-bot
529c02dc47 Merge "Config: Add Config and GlobalConfig classes" 2014-01-28 05:15:26 +00:00
Kunal Mehta
fbfe789b98 Config: Add Config and GlobalConfig classes
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
2014-01-27 21:10:30 -08:00
addshore
e3c0ab20bf Split Title and User ArrayFromResult classes to own files
Change-Id: I8744627330eb9c8f183a8d418d6eb168e6c5407b
2014-01-26 18:32:43 +00:00
jenkins-bot
a6f0a996eb Merge "Add Special:Diff as an internally-linkable redirect to diff pages" 2014-01-26 04:52:59 +00:00
Jérémie Roquet
ecc8114014 Add Special:Diff as an internally-linkable redirect to diff pages
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
2014-01-25 21:41:08 +01:00
addshore
853291c7d6 Split Timestamp.php into class and exception files
Change-Id: I438adfe5479a1017baee8f2b663f3fb2e49c685a
2014-01-25 16:24:04 +01:00
jenkins-bot
5bd46a50a9 Merge "Create ChangesListSpecialPage as a base class for Watchlist and RC" 2014-01-24 00:51:07 +00:00
jenkins-bot
bb70f87a13 Merge "Begin abstracting more of the database-specific search backend out" 2014-01-23 23:39:34 +00:00
Kevin Israel
1d049a7451 Installer: Remove two environmental checks
* 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
2014-01-22 19:41:19 -05:00
Siebrand Mazeland
eabdda4fba Remove FakeMemCachedClient
Was deprecated in 1.18. Not used in core or Gerrit extensions.

Change-Id: I06bc9c6f01f21386c772fa7fad57b55a7c7b2fe4
2014-01-22 17:17:18 +00:00
Chad Horohoe
110eb02f3a Begin abstracting more of the database-specific search backend out
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
2014-01-21 17:53:16 -08:00
jenkins-bot
e6cf2f1af4 Merge "Removed RdfMetaData" 2014-01-21 17:02:18 +00:00
Aaron Schulz
4ebd4debf4 Removed RdfMetaData
* Unused by core or extensions

Change-Id: I3454d605a741bc97a51a1ad471a17eb3053d662f
2014-01-17 16:20:53 -08:00
Aaron Schulz
a0eef4ef0d Removed expiremental LSLockManager class
* This is pretty much obsoleted by RedisLockManager

Change-Id: I0feff44b5833072c8eb5a598169e1bb271d49de2
2014-01-17 15:16:01 -08:00
jenkins-bot
b2c14382e3 Merge "Removed ZhClient; unused by core and extensions" 2014-01-16 20:42:55 +00:00
Aaron Schulz
9f38f56fb5 Removed ZhClient; unused by core and extensions
Change-Id: Ieda34368b8e1c4a09dc244f47f7e09d943849b1e
2014-01-16 12:25:41 -08:00
Aaron Schulz
d8ca8c5df1 Moved SpecialPageFactory to specialpage/
Change-Id: Iaef958ea7831ec61e76002362672d5340e596348
2014-01-16 12:11:45 -08:00
Chad Horohoe
736820f8f2 Remove DBABagOStuff
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
2014-01-16 11:43:59 -08:00
Chad Horohoe
19873e7693 Ehcache more like mehcache
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
2014-01-16 18:44:09 +00:00
Bartosz Dziewoński
eabfeda3be Create ChangesListSpecialPage as a base class for Watchlist and RC
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
2014-01-16 19:25:27 +01:00
jenkins-bot
ef92af800a Merge "Revert "Mechanism for renaming/aliasing classes"" 2014-01-13 04:25:38 +00:00
PleaseStand
cb77e59f7c Revert "Mechanism for renaming/aliasing classes"
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
2014-01-11 21:48:30 +00:00
Kunal Mehta
c1bc3607f8 Add XMLRCFeedFormatter
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
2014-01-10 17:50:41 -08:00
jenkins-bot
3de8536d3e Merge "Remove classes and functions deprecated in MediaWiki 1.17" 2014-01-09 21:11:51 +00:00
Aaron Schulz
2af7ad827d Removed cloudfiles dependency in SwiftFileBackend
* 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
2014-01-07 23:56:34 -08:00
Aaron Schulz
bb519a91df Moved HashRing to /libs
Change-Id: I0b74b386f7459f550816f99aa7e00970c3cff4c7
2014-01-07 22:18:09 +00:00
Aaron Schulz
deec3478c7 Moved MappedIterator to /libs and changed exception type
Now throws UnexpectedValueException rather than MWException.

Change-Id: Id466b66f43db97c5837030d166b9abd66fd56e0d
2014-01-07 21:12:43 +00:00
jenkins-bot
d2d519f482 Merge "Add ProfilerMwprof" 2014-01-07 21:11:11 +00:00
Ori Livneh
c5e6ce0f9e Add ProfilerMwprof
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
2014-01-07 13:03:11 -08:00
Brad Jorsch
e06ad68419 API: Add prop=contributors
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
2014-01-07 04:09:47 +00:00
Kevin Israel
c61fdb4ef5 Mechanism for renaming/aliasing classes
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
2014-01-06 10:36:18 -05:00
Kevin Israel
4a7d1b86cd No need to return true/false from AutoLoader
Partially reverts r36942 (7e627faec6).

Change-Id: I5b3dfd148863413025c71de5fadef1cb5bd70dce
2014-01-05 21:21:53 -05:00
Siebrand Mazeland
52ba6500df Remove classes and functions deprecated in MediaWiki 1.17
Removed classes:
- WikiError (deprecated in 1.17)
- WikiXmlError (deprecated in 1.17)
- WikiErrorMsg (deprecated in 1.17)

Removed methods:
- ApiBase::getValidNamespaces() (deprecated in 1.17)
- ApiMain::setCachePrivate() (deprecated in 1.17)
- ApiMain::setVaryCookie (deprecated in 1.17)
- CategoryViewer::addSubcategory() (deprecated in 1.17)
- WebRequest::getFileSize() (deprecated in 1.17)
- WebRequest::isPathInfoBad() (deprecated in 1.17)

Change-Id: Id715c2391742c136d09f5369f88d67e798842af7
2014-01-05 18:54:27 +01:00
Ori Livneh
4d23c15a6a Move RunningStat from profiler/ to libs/
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
2014-01-02 22:52:37 -08:00
Ori Livneh
681607e55b Add class implementing MessagePack serialization
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
2014-01-02 18:04:24 -08:00
Ori Livneh
766c11b516 Add RunningStat class, tests
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
2013-12-31 14:45:58 -05:00
jenkins-bot
d0fc29d788 Merge "Moved ScopedCallback to /libs" 2013-12-27 15:46:01 +00:00
Siebrand Mazeland
210edff11b Remove underscore from classes LBFactory_*, LoadBalancer_*, LoadMonitor_*
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.

Patches for extensions:
* https://gerrit.wikimedia.org/r/#/c/96463/ CentralAuth
* https://gerrit.wikimedia.org/r/#/c/96460/ SimpleSecurity
* https://gerrit.wikimedia.org/r/#/c/96459/ WikiBase
* https://gerrit.wikimedia.org/r/#/c/96472/ Wikimedia configuration

Antoine added tests to test the back compatibility.

Change-Id: I507ba00a83bca8375a0215f00891b47e3c7afb9f
2013-12-26 16:30:15 -05:00
Aaron Schulz
9ee2b6f7fc Added a MemoryFileBackend class and made MockFileBackend subclass it
* 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
2013-12-19 12:38:00 -08:00
Bartosz Dziewoński
f2e55d1273 Rename SpecialRecentchangeslinked class to SpecialRecentChangesLinked
For consistency with SpecialRecentChanges.

This introduces no incompatibilities as PHP classes are case-insensitive.

Change-Id: I5855074deed52fd7492f033c8a8fced8af647602
2013-12-18 20:00:34 +00:00
Aaron Schulz
22af3c78c6 Moved ScopedCallback to /libs
* The MWException is now a standard PHP exception type

Change-Id: I59e3b435cee32efe84c67766e29976b126384389
2013-12-17 10:16:14 -08:00
Bartosz Dziewoński
0f614669b6 IcuCollation: Add CollationCkb subclass for Sorani Kurdish
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
2013-12-12 04:44:33 +00:00
Bartosz Dziewoński
22c9aa5ec0 Split includes/SpecialPage.php
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
2013-12-09 18:05:37 +01:00
addshore
976276338a Split includes/HTMLForm
Change-Id: I6eabfdb064c0e35b69efe9d6142e94df4128b632
2013-12-08 23:13:56 +01:00
Aaron Schulz
a0878fe2b4 filebackend: exception handling cleanups
* Split out FileBackendException class and reduced direct use of MWException

Change-Id: I325c1798b6d90972c12a5dccc37989af34d857f3
2013-12-07 23:22:07 -07:00
Aaron Schulz
77f7e9ba65 Added MapCacheLRU class, a simpler cousin to ProcessCacheLRU
Change-Id: Ibe1b44c8e168a086afb3481b4bb7660dc7d31ae7
2013-12-03 19:47:02 +00:00
Aaron Schulz
721731f43c Improved partitioning scheme for refreshLinks jobs
* 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
2013-11-26 16:02:44 -08:00