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