Commit graph

1120 commits

Author SHA1 Message Date
Bartosz Dziewoński
bf1168b8cd Fix CSSJanus flipping in LESS mixins and remove broken custom LESS functions
Custom LESS functions are problematic for us for a number of reasons,
as outlined by Timo on bug 67368. We should get rid of them.

The only use case was implementing CSSMin data: URI embedding in LESS,
which used to be impossible due to lessc not preserving comments (bug
54673). However, thanks to new syntax added in f3779e06 we can insert
the annotations in such a way that the compiler won't mess with them.
The same technique is used in OOjs UI since 584ed144.

The LESS-function-based embedding implementation also meant that we
were unable to flip images for RTL (bug 66091 and friends: bug 66773,
bug 68326). The annotation one doesn't have this limitation.

Bug: 67368
Bug: 66091
Bug: 66773
Bug: 68326
Change-Id: I3062346ed63272a1c22b5df27b4cc1de2a699d9a
2014-09-20 20:28:22 +00:00
jenkins-bot
30646afb36 Merge "Add Special:MediaStatistics page for file type stats" 2014-09-19 08:03:42 +00:00
Brad Jorsch
8e938814c4 API: Add prop modules for backlinks
With the success of prop=redirects, let's create prop=linkshere,
prop=transcludedin, and prop=fileusage.

Let's also add a miser-mode-sensitive 'namespace' parameter to
prop=redirects, since the other three have a 'namespace' parameter using
the new *_from_namespace fields.

Change-Id: Ib650db9988a553771582eed0c183d0cae4b71252
2014-09-18 17:04:42 -04:00
Brian Wolff
e632eba946 Add Special:MediaStatistics page for file type stats
There used to be a bot on commons that did this, but it broke, and
this seems like the sort of thing that should be built in to
MediaWiki anyhow.

In order to do this, it abuses the querycache table somewhat
(Storing non-titles things in the title column).

Also changes the link on Special:Statistics for number of
uploads to link to new page. It seemed appropriate to link
to more detailed statistics instead of to Special:ListFiles.

Change-Id: I9ab768584b02a32b450d5f3981ff775ee07fecfa
2014-09-18 14:28:57 -03:00
jenkins-bot
c4ed6d1898 Merge "Add MultiConfig for fallback logic" 2014-09-18 13:13:39 +00:00
Kunal Mehta
412c4668f1 Add MultiConfig for fallback logic
This change adds MultiConfig and HashConfig classes,
but does not actually use them anywhere. In a future
change, we can convert DefaultSettings.php into
a HashConfig instance and use MultiConfig as the
'main' config instance.

Bug: 69418
Change-Id: I0ef2fbb86d5c27602d70240219ee08be31e2d09b
2014-09-17 15:55:04 -07:00
jenkins-bot
53e8f804e7 Merge "Start moving page move logic out of Title" 2014-09-16 22:51:37 +00:00
jenkins-bot
96efe0bc66 Merge "Revamp classic edit toolbar not to hardcode paths in HTML" 2014-09-16 12:51:21 +00:00
jenkins-bot
ed7ae208a4 Merge "Split BitmapHandler into two classes." 2014-09-16 08:27:49 +00:00
Yuri Astrakhan
3a28ee5acb CSS/JSON/JavaScript ContentHandler refactoring
* All content handlers that deal with code/data tend to have
English as their page language & pageview language, so moved common
code to the abstract CodeContentHandler class.

* Renamed JSONContent & JSONContentHandler into JsonContent*

Change-Id: I46819a0572ef5becc211d0d82471ff7102edaa3c
2014-09-15 08:24:15 +00:00
Kunal Mehta
77698193f9 Start moving page move logic out of Title
This moves most of the Title::moveTo() function into a new MovePage
class, and the entirety of the Title::moveToInternal() function.

No actual code was changed except for requiring a User object in
function arguments instead of relying up on $wgUser, and changes
to "$this" as necessary.

Change-Id: I5479fa8f3920a51ddf789d55edae7dd0d9b24382
2014-09-14 19:29:53 -07:00
Brian Wolff
757a70ae0a Split BitmapHandler into two classes.
BitmapHandler has a lot of generic-ish functionality that could
be re-usable by extension classes (Such as how it organizes
$scalerParams array, or various image magick escaping methods).
However it's combined with a lot of very format specific things,
such as the shell-out call to image magick.

Try to separate out the more generic stuff into
TransformationalImageHandler. In order to do this, I also made
canRotate, autoRotateEnabled, and getScalerType non-static. No
extensions in our repo appeared to be using these methods, and they
don't really make sense to be static (imo).

In particular, I think code duplication can be reduced in
PagedTiffHandler by extending this new class. See comments
on I1b9a77a4a56eeb65.

Change-Id: Id3a8b25a598942572cb5791a95e86054d7784961
2014-09-14 22:10:37 +00:00
Kunal Mehta
bf8810d6bc Split UserMailer.php into includes/mail/
Change-Id: Ic435bbdbb690028a5d34e8176522fcf4aa44fa92
2014-09-14 19:03:03 +00:00
Bartosz Dziewoński
285c52039b Revamp classic edit toolbar not to hardcode paths in HTML
Also, try out a way to have per-module LESS variables defined in PHP.
This might come in handy in the future… Maybe for skin theme support?

(I recommend reviewing the file changes in the order below. :D)

includes/resourceloader/ResourceLoaderFileModule.php
  * Pass the context (ResourceLoaderContext) deeper down via
    readStyleFiles() and readStyleFile(). We need it to compile the
    .less files for the right language.
  * Extract LESS compiler creation to getLessCompiler().
  * Allow passing a LESS compiler instance to compileLessFile(), rather
    than getting one after the method is called.

  All of the changes are backwards-compatible.

includes/resourceloader/ResourceLoaderEditToolbarModule.php
  * New module to support getting the language data and passing it to
    LESS variables.

  It might be a good idea to factor out a reusable class for a LESS
  module with additional variables, but that would require more
  attention to design than I gave it.

resources/src/mediawiki.action/mediawiki.action.edit.toolbar/mediawiki.action.edit.toolbar.less
  * Glue code to use the language data defined by the module above and
    put it in final CSS.

includes/EditPage.php
  * Do not hardcode image URLs in output HTML, as they are provided in
    CSS now. This gets rid of some usage of globals.

  In fact, we should be able to finally move the inline JavaScript
  calls out of getEditToolbar(), but I'm already introducing too many
  changes for one patch. That can be done later.

languages/Language.php
  * Add getImageFiles() to complement existing getImageFile() method.
    Misleadingly named, it returns paths for images for the toolbar
    only (and no other ones at all).

skins/common/ → resources/src/mediawiki.action/mediawiki.action.edit.toolbar/
  * Moved all of the button images to new location.

  Also, boring cleanup that was harder before because we treated the
  paths as public API:
  * Placed default ones in en/ subdirectory.
  * Renamed cyrl/ to ru/.
  * Renamed ksh/button_S_italic.png → ksh/button_italic.png.

languages/messages/
  * Adjusting paths and filenames for the changes above.

resources/src/mediawiki.action/mediawiki.action.edit.css
resources/src/mediawiki.action/mediawiki.action.edit.js
  * Added styles and updated the script to make it possible to have
    non-<img> elements as toolbar buttons.
  * Consolidated styles that were already required, but defined
    somewhere else:
    * `cursor: pointer;` (from shared.css)
    * `vertical-align: middle;` (from commonElements.css)

Bug: 69277
Change-Id: I39d8ed4258c7da0fe4fe4c665cdb26c86420769c
2014-09-13 23:16:23 +02:00
Kunal Mehta
9382608922 Move Config::set() to MutableConfig::set()
Introduces a new interface for Config types
that are mutable. Not all Config instances
should be mutable, like MultiConfig.

Change-Id: I56e193cbbf72b7afdf551f60ea635fc347e14b3e
2014-09-11 08:26:43 -07:00
jenkins-bot
4dd56b2268 Merge "API: created a new api to flag messages as read" 2014-09-08 15:20:30 +00:00
Petr Bena
2077a43b5a API: created a new api to flag messages as read
New api is called "ClearHasMsg" and does nothing but erase a new message
flag from currently logged in user.

This is useful for tools that can read the new messages using some api, or some
other way (loading the text using different session, preload the text using a
buffer where it's unrevealed later if user actually did read it, or closed the
application before), so it can be useful in situations when you need to flag new
messages as read in a different time than that when you actually read them.

Bug: 64238
Change-Id: Ife575711c32bb8e3bcac789de4a6b37e1888d032
2014-09-06 21:26:40 +00:00
Aaron Schulz
b1d215726e Removed LCStoreAccel class
* Since individual message keys can expire, this can cause broken
  messages when such a key is needed (the message is treated as if
  it did not exist). The base class clearly documents a need for
  more atomicity (only top level keys can fall it separately).

Change-Id: I992bba77a0afdeeeade8be013708277b79f22314
2014-09-05 13:33:10 -07:00
Aaron Schulz
a9ba7d45f4 Added BloomCache classes
* Implemented a version of BloomCache using Redis
* Added a BloomCheckTitleHasLogs handler class for avoiding
  slow logging table queries when large amounts of 404 pages
  are viewed (by various web crawlers at the moment).

bug: 67439
Change-Id: I26e5034755e3a7208a45991b1cf2f12467679cc1
2014-09-03 17:43:21 +00:00
Chad Horohoe
a7ab193d45 Category finder style cleanups
* Renamed class to CategoryFinder (camel case)
* Removed pointless empty constructor
* Swapped wfProfileIn/Out for ProfileSection
* Renamed scan_next_layer() to scanNextLayer() because underscores
  are ugly (no public callers)
* Made scanNextLayer() and check() private, no callers outside class
* Explicitly made run() and seed() public
* Removed ugly underscores from seed() parameter
* More useful variable name in single caller

Change-Id: Iaffea7634c7b17ed5324b3b5c9b938c1a1348555
2014-08-29 11:52:42 -07:00
Brad Jorsch
2bb0768d3c API: Organize classes
* Group methods in ApiBase by function
* ApiBase::validateLimit and ApiBase::validateTimestamp are now
  protected; there are no callers in any extensions in Gerrit
* Group methods in ApiQueryBase by function
* Move ApiFormatFeedWrapper out of ApiFormatBase.php
* Deprecate some methods in ApiQueryBase that seem useless and are
  unused in core or any extensions in Gerrit

Change-Id: I32092f13906b6826d2137401724c21ccefa6f670
2014-08-27 16:39:24 -04:00
Brad Jorsch
f637ad308f Add HTMLAutoCompleteSelectField
This is much like the one OAuth has in
Special:OAuthConsumerRegistration/propose, except it stores the
autocompletion options in a data property rather than a global and uses
jquery.suggestions rather than jquery.ui.autocomplete.

Change-Id: I42473cea75f3706cc0125167f9191275ca6cb3b0
2014-08-26 15:14:23 -04:00
jenkins-bot
c1ad8bd3a7 Merge "API: Overhaul token handling" 2014-08-26 19:09:21 +00:00
Brad Jorsch
fdddf94570 API: Overhaul token handling
The current token handling is a mess. This simplifies things greatly:
* *All* tokens are obtained from action=query&meta=tokens, rather than
  being spread over action=tokens, action=query&prop=info,
  action=query&prop=revisions, action=query&prop=recentchanges, and
  action=query&prop=users. All these old methods are deprecated.
* Similarly, there is only one hook to register new token types. All old
  hooks are deprecated.
* All tokens are cacheable.
* Most token types are dropped in favor of a 'csrf' token. They already
  were returning the same token anyway.
* All token-using modules will document the required token type in a
  standard manner in action=help and are documented in machine-readable
  fashion in action=paraminfo.

Note this will require updates to all extensions using tokens.

Change-Id: I2793a3f2dd64a4bebb0b4d065e09af1e9f63fb89
2014-08-26 14:53:45 -04:00
Bartosz Dziewoński
7d04663398 Split includes/Pager.php
Change-Id: I67fcffca4e3de081a895deb1a285a5545940ece9
2014-08-23 14:25:02 +02:00
umherirrender
fbba43358e Split RevisionDeleteAbstracts.php to separate files
Same as I244a66fe19c089df4bcabcf745536d99b2103bc4

Change-Id: I90cea070a8e24d82f0675f122c79326988351e08
2014-08-20 19:08:33 +02:00
jenkins-bot
a15fe7dd93 Merge "Turn HTMLBlockedUsersItemSelect into HTMLSelectLimitField" 2014-08-15 21:40:32 +00:00
withoutaname
e53c6dbd8d actions: Move SubmitAction class out of EditAction.php
Straight move, except for the slight change in the comparison operator
for session_id().

Change-Id: I9404f48ee75ff3d3655f2f5b75a05d66f334b80d
2014-08-12 22:26:54 +00:00
Kunal Mehta
eb37e9d1ff Introduce SkinFactory
Modeled similar to ConfigFactory, this lets skins
register themselves via a callback, allowing for
proper dependency injection.

Loading via $wgValidSkinNames is still supported,
but considered "legacy", not deprecated though.

Skin::newFromKey is now deprecated (and had only
one caller in an extension, which I'll update
afterwards).

Change-Id: I1960483f87c2ef55c994545239b728fa376f17f4
2014-08-09 21:40:54 +01:00
Tom Arrow
9ae72401fa Split SkinFallback and SkinfallbackTemplate
Change-Id: I55c866c08d4f442021c43068efe64be871afb96b
2014-08-09 12:17:08 +00:00
addshore
880e496a30 Split PoolCounterWorkViaCallback into own file
Change-Id: I9c920cd03351a2b2b155247d58fbb2280d4d3775
2014-08-09 00:44:59 +01:00
Kunal Mehta
d2a82fcb60 Add JSONContent and handler from EventLogging
As was discussed at the architecture summit, a basic JSON content
class which handles validation and basic display. Not intended to
be used directly, but for extensions to subclass.

Co-Authored-By: addshore <addshorewiki@gmail.com>
Change-Id: Ifcde9bcd0efcf15a3ab692dd2a0a3038559e0254
2014-08-08 23:31:26 +00:00
Reedy
be02da8e1a Split RevisionDelete.php to separate files
Change-Id: I244a66fe19c089df4bcabcf745536d99b2103bc4
2014-08-07 20:46:46 +00:00
Chad Horohoe
af87cb4a3f Remove score display from search engine
Scores are an internal metric that should not be exposed to
users, plus most backends fail to even support it.

Removes PostgresSearch*-specific result classes as they're not
needed anymore.

Change-Id: I00acaabad0565b9a5b3524c992feea366eb74bcc
2014-08-07 14:19:37 +01:00
addshore
3263900481 Split UnwatchAction into own class
Change-Id: Ief650c115237214345bef7733d33967f0e042521
2014-08-07 01:40:35 +01:00
addshore
f902738503 Split UnprotectAction into own file
Change-Id: Ibde9dca89631522a25e2f0eef2790c2654a2bbd9
2014-08-07 01:33:12 +01:00
Bartosz Dziewoński
0b191ba970 Use a special fallback skin when selected skin is unavailable
It just displays a helpful message that explains why and how to
install and enable skins. There is no navigation nor other basic page
elements (like the logo or site notice), since this is not intended to
be a fully functional skin.

Bug: 68332
Change-Id: Id14fbb8733cd8fbb912a724ac658f5e7244364b5
2014-08-06 16:41:36 +00:00
withoutaname
72462041c0 Move PasswordError under includes/password/ file
Change-Id: I7256325492b2f6451223714efb8b3e07fca9ee3e
2014-07-29 02:07:50 -07:00
Bartosz Dziewoński
3971d0646c resourceloader: Allow skins to provide additional styles for any module
The newly introduced $wgResourceModuleSkinStyles global enables skins to
provide additional stylesheets to existing ResourceLoader module.

This both makes it easier (or at all possible) to override default
styles and lowers the style footprint by making it possible not to
load styles unused on most pages.

----

Example:

Use the file 'foo-styles.css' for the 'mediawiki.foo' module when using
the MySkin skin:

  $wgResourceModuleSkinStyles['myskin'] = array(
    'mediawiki.foo' => 'foo-styles.css',
    'remoteSkinPath' => 'MySkin',
    'localBasePath' => __DIR__,
  );

For detailed documentation, see the doc comment in DefaultSettings.php.
For a practical usage example, see Vector.php.

----

Implementation notes:

* The values defined in $wgResourceModuleSkinStyles are embedded into
  the modules as late as possible (in ResourceLoader::register()).
* Only plain file modules are supported, setting module skin styles
  for other module types has no effect.
* ResourceLoader and ResourceLoaderFileModule now support loading
  files from arbitrary paths to make this possible, defined using
  ResourceLoaderFilePath objects.
  * This required some adjustments in seemingly unrelated places for
    code which didn't handle the paths fully correctly before.
* ResourceLoader and ResourceLoaderFileModule are now a bit more
  tightly coupled than before :(
* Included a tiny example change for the Vector skin, a lot more of
  similar cleanup is possible and planned for the future.
* Many of the non-essential mediawiki.* modules defined in
  Resources.php should be using `'skinStyles' => array( 'default' => … )`
  instead of `'styles' => …` to allow more customizations, this is
  also planned for the future after auditing which ones would actually
  benefit from this.

Change-Id: Ica4ff9696b490e35f60288d7ce1295766c427e87
2014-07-29 00:53:41 +02:00
Tyler Anthony Romeo
95a8974c6b
Added password hashing API
Deprecated the old User::crypt, et. al password hashing
system and implemented an extensible password hashing
API.

The new Password class allows registering of child classes
and provides factory functions for creating new Password
objects. The built-in hash types are the old MediaWiki MD5
types, which are for backwards-compatibility only, and bcrypt.

Also included is support for wrapping existing hashes as well
as encrypting passwords with a configured encryption key.

Bug: 54948
Bug: 28419
Change-Id: I0a9c972931a0eff0cfb2619cef3ddffd03710285
2014-07-27 15:51:18 -04:00
This, that and the other
13ea23c484 Remove unused XMLReader2 class
Undocumented and unused within core. Was previously used in WikiImporter,
but that use was removed in r81437.

Change-Id: I45f4ff3fae19a7d9c1a0dacb2e02d53ee4bdaefb
2014-07-26 11:53:51 +10:00
Aaron Schulz
094d901b88 Refactored duplicated code into JobRunner.php
* Also added an async flag to SpecialRunJobs so that it can be
  set to false to get a JSON blob back with a regular 200 status.

Change-Id: I2f5763e017684c3c61f3d3f27ddf7f7834bdfce2
2014-07-25 17:28:10 +00:00
umherirrender
1c68a1ee86 Cleanup some docs (includes/*.php)
- Swap "$variable type" to "type $variable"
- Added missing types
- Fixed spacing inside docs
- Makes beginning of @param/@return/@var/@throws in capital
- Changed some types to match the more common spelling

Change-Id: I783e4dbfe5f6f98b32b9a03ccf6439e13e132bcc
2014-07-24 19:42:24 +02:00
jenkins-bot
2896cf38d6 Merge "Integrate Special:MyLanguage from the Translate extension" 2014-07-23 22:23:56 +00:00
withoutaname
6080ded0cc Remove deprecated class StubContLang
Change-Id: I4569f5d59018f0d5082888fdc737cf30370bcbdd
2014-07-22 22:07:04 -07:00
Max Semenik
062cfffeb2 Integrate Special:MyLanguage from the Translate extension
In practice, this means the MediaWiki canonical way to uniquely and
humanly name translation pages on a multilingual wiki becomes
$source_page_title + '/' + $target_language_code, irrespective of
the enabling of the navigational subtitle and of the relative
titles (..) syntax for linking and transcluding, which are unrelated
and keep being controlled by $wgNamespacesWithSubpages.

This syntax has been prevalent on most wikis including mediawiki.org
since at least 2009, also thanks to #titleparts in ParserFunctions.

The part of the special page's functionality that made links to it red
when destination page wasn't present will be integrated with a follow-up
commit because they require more performance work.

I'm also including some Title tests that were written for testing the
redlinking functionality but are useful in general.

Bug: 66762
Change-Id: I520077c931431b5919e0208f75c20b5b25f3159d
2014-07-22 11:33:15 -07:00
Aaron Schulz
b8c038f678 Redo WhatLinksHere query and add a *_from_namespace field to link tables
* Also tweaked the query so MySQL avoids doing a page_name
  index scan when it should start with the link table index
* Added population script (triggered by update.php)
* Also removed uniqueness from some indexes where it is redundant
* Renamed two confusing variables

Bug: 60618
Change-Id: Icca99b6ae0ef76cb77695faf82c615516191da36
2014-07-21 12:04:56 -07:00
withoutaname
3702d19788 Remove deprecated RawPage class
Change-Id: I7a75a09de934250604317983a4446ecaa9fa6550
2014-07-20 22:58:44 -07:00
jenkins-bot
897c7fce96 Merge "Collation: Workaround for incorrect collation of Estonian" 2014-07-21 05:05:50 +00:00
withoutaname
071353c89a Remove deprecated HistoryPage class
Change-Id: I3db4d5a1a2c574a73e2fcfe1fd1da49f3570e4b6
2014-07-21 04:54:40 +00:00