Commit graph

884 commits

Author SHA1 Message Date
jenkins-bot
0732467b6d Merge "Add language handling to imageinfo/extmetadata API" 2013-10-29 18:33:32 +00:00
jenkins-bot
498693b9ea Merge "Add "extended" file metadata to API" 2013-10-29 18:29:32 +00:00
tgr
042f1c77a6 Add language handling to imageinfo/extmetadata API
Adds options to return metadata in all available languages, or in
a single selected language.

Change-Id: I78f096318904a08abd317a5ed3f74ee33d3289cb
2013-10-29 17:49:19 +00:00
Brian Wolff
d141781396 Add "extended" file metadata to API
Part of the point of this, is to add a hook to allow extensions to add
their own metadata (I intend to create a companion extension to parse
Commons description pages - I5e6bc45f9751)

It's hoped that this would provide a simple system to get file metadata,
and would be able to return information on any wiki (even without any
extensions installed to provide additional information). So it could
fallback to exif data, if there's no better source of information for
the file available. It's also meant to be done in such a way that, in
the future, when Wikibase is deployed on Commons, it could be integrated
without too much fuss.

marktraceur changed this patch to be a little less heavy-handed: it will
now return unformatted data by default from the API, but there's also a
method for formatting that data in the way that bawolff originally
intended. I'm still trying to figure out if there's much use in that
method, but for now it's not particularly useful.

Change-Id: I77303d8e535fc1c42e14cfb853814e5c434a81ec
2013-10-29 17:47:59 +00:00
Bartosz Dziewoński
dfc3e3df90 Correctly update wl_notificationtimestamp when viewing old revisions
== Prelude ==
wl_notificationtimestamp controls sending the user e-mail
notifications about changes to pages, as well as showing the "updated
since last visit" markers on history pages, recent changes and
watchlist.

== The bug ==
Previously, on every view of a page, the notification timestamp was
cleared, regardless of whether the user as actually viewing the latest
revision. When viewing a diff, however, the timestamp was cleared only
if one of the revisions being compared was the latest one of its page.

The same behavior applied to talk page message indicators (which are
actually stored sepately to cater to anonymous users).

This was inconsistent and surprising when one was attempting to, say,
go through the 50 new posts to a discussion page in a peacemeal
fashion.

== The fix ==
If the revision being viewed is the latest (or can't be determined),
the timestamp is cleared as previously, as this is necessary to
reenable e-mail notifications for given user and page.

If the revision isn't the latest, the timestamp is updated to
revision's timestamp plus one second. This uses up to two simple
(selectField) indexed queries per page view, only fired when we
do not already know we're looking at the latest version.

Talk page indicator is updated to point at the next revision after the
one being viewed, or cleared if viewing the latest revision. The
UserClearNewTalkNotification hook gained $oldid as the second argument
(a backwards-compatible change). In Skin, we no longer ignore the
indicator being present if we're viewing the talk page, as it might
still be valid.

== The bonus ==
Comments and formatting was updated in a few places, including
tables.sql and Wiki.php.

The following functions gained a second, optional $oldid parameter
(holy indirection, Batman!):
* WikiPage#doViewUpdates()
* User#clearNotification()
* WatchedItem#resetNotificationTimestamp()

DifferenceEngine gained a public method mapDiffPrevNext() used
to parse the ids from URL parameters like oldid=12345&diff=prev,
factored out of loadRevisionIds(). A bug where the NewDifferenceEngine
hook would not be called in some cases, dating back to its
introduction in r45518, was fixed in the process.

Bug: 41759
Change-Id: I4144ba1987b8d7a7e8b24f4f067eedac2ae44459
2013-10-27 17:47:53 +00:00
Erik Bernhardson
9efb7a7339 New hook accommodates non-revision rc queries
Within Special:RecentChanges the default non-extended query contains

    ( rc_this_oldid=page_latest OR rc_type=3 )

Wikidata has previously used the SpecialWatchlistQuery hook to look for
this exact string and change rc_type=3 to rc_type IN (3,5).  Flow is another
type of change that doesn't have a matching row in revisions to match
page_latest for and needs to be added to this query.

This patch adds a new hook, SpecialWatchlistGetNonRevisionTypes, which allows
different extensions to add to a list of values for rc_type (or rc_source once
85787 is merged).  This will allow multiple extensions to affect the resulting
query without them breaking eachother.

Change-Id: Id6916fe999c0faa38de878b7b5687e7ea00901bd
2013-10-24 10:38:54 +11:00
Erik Bernhardson
0f33c14576 Remove 'Debug' hook from wfDebug and wfDebugLog
Per the bug report, the 'Debug' hook was triggering an infinite loop when
wgDebugFunctionEntry is enabled.  The Debug hook is used if an extension wants
to stop a debug message from being sent out.  Ideally the wfDebug and related
functions should be as low-level and avoid calling other code as much as
possible to avoid situations like this.

Bug: 55818
Change-Id: I679782489b683503fc624cfea3c7ad72a989b005
2013-10-17 15:45:05 -07:00
Kunal Mehta
370f4c4618 Add APIQuerySiteInfoStatisticsInfo hook
Allows extensions to modify the output of
action=query&meta=siteinfo&siprop=statstics

Accompanies the SpecialStatsAddExtra hook for Special:Statistics

Change-Id: I712748077a0ac2fb729bfe3b6616ac4981cb754e
2013-10-11 19:12:21 -07:00
jenkins-bot
265cb52243 Merge "Make thumb_handler.php use MediaHandler::parseParamString" 2013-09-30 18:11:09 +00:00
Brian Wolff
ccf89be91a Make thumb_handler.php use MediaHandler::parseParamString
Use MediaHandler::parseParamString to parse the parameter string
of a thumbnail. This seems to make much more sense given the
design of the Handler class. Also mark ExtractThumbParameters hook
as deprecated.

This should be reviewed by someone familar with the 404 thumbnailing
infrastructure. I'm unclear if there was a reason for why it wasn't
using MediaHandler::parseParamString in the first place.

Bug: 49629
Change-Id: I43a0e7d6f0e45536e4e24b72140157791f5f027f
2013-09-28 20:32:40 -03:00
jenkins-bot
6d0a4f463e Merge "Added new MWTimestamp::getRelativeTimestamp for pure relative." 2013-09-27 17:45:26 +00:00
Aaron Schulz
bc69502492 Support rate limiting backlink purges, including null edits
Change-Id: I86e45b7d0eba7d87f65150b34e190e04d8342b3e
2013-09-27 05:37:39 +00:00
Tyler Anthony Romeo
fa84729e54 Added new MWTimestamp::getRelativeTimestamp for pure relative.
Since MWTimestamp::getHumanTimestamp just makes a pretty
timestamp, and not a purely relative one, this commit adds
MWTimestamp::getRelativeTimestamp, which does just that.

Change-Id: I8b3e3fc6eeb4afd58f85fa7d05b5ea1a51b0afb6
2013-09-24 19:40:48 -04:00
Jan Gerber
386ba287d7 Add TitleMove hook
some things need access to the old file before its moved,
adding hook to allow extensions to do something before
file is moved.

Change-Id: Ic5e659abc79c41e3331d42074e7f21eec9b9ba7c
2013-09-17 08:07:17 +00:00
jenkins-bot
26c4f5fa77 Merge "Delete docs/upload.txt" 2013-08-31 13:05:41 +00:00
MatmaRex
c9100aa34f Delete docs/upload.txt
"This document describes how the current uploading system is build up and how
custom backends can be built. (At least someday it will)."

It says this since 2009 (r55604). I see no need to keep that red herring here.

Change-Id: I70d20bf21527bee26bf244381a9d75d96856dd52
2013-08-31 14:31:05 +02:00
MatmaRex
f86a8c9706 docs/scripts.txt: Remove docs about deleted files
trackback.php has been removed in 1.18, redirect.php sometime sooner.

This highlights the state of disarray these docs are in…

Change-Id: I8115ca5649e82537a638b2cd3775717e43099124
2013-08-31 14:28:18 +02:00
Tychay
bfaa602229 Merge "Make it slightly easier for extensions to hook into page protection." 2013-08-26 22:03:18 +00:00
Matthias Mullie
92859c59c3 Make it slightly easier for extensions to hook into page protection.
Split parts of doUpdateRestrictions() into several more concise functions.
The biggest drawback is increasing $dbw->encodeExpiry() calls times 3. This is
not much of a problem given that's a very inexpensive function and it is only
called very few times ($limit holds 2 values in current codebase)

Added $reason to the ProtectionForm::save hook, so that other code hooking into
and adding their own settings into page protection form can also process the
reason for the protection change.

Change-Id: I879290ed83e4e47e9561d4c352fbd50c07d7e18a
2013-08-26 14:13:43 -07:00
Tim Starling
f0b346d6d0 Core support for disabling HTTPS based on GeoIP
* Introduce a hook allowing automatic redirects to HTTPS to be
  disabled on the basis of client IP address.
* Make User::requiresHTTPS() return false if the client IP is
  blacklisted as such.
* On login, make the "stick HTTPS" option default to false if the
  client IP address is blacklisted as such.
* Do not redirect anonymous requests to HTTPS.
* If $wgSecureLogin is enabled, link to the HTTPS login page *via*
  the HTTP redirect, so that there is no need to vary the cache of
  anonymous page view HTML on client IP address.

Change-Id: Iaa9dd2108431b8c35e05db4bfe78a629018a003c
2013-08-21 13:43:46 +10:00
Max Semenik
1f64960d83 New hook, UserRequiresHTTPS
Intended for situations where current user can't technically access the
site over a secure connection, e.g. due to a terribly obsolete browser or
WP Zero carrier that provides only insecure free access to the site.

Change-Id: I343985092c49a21fa347ca4dc0e5ec27774ad11d
2013-08-20 19:58:12 +04:00
Brian Wolff
14b3f8767b New more slick gallery display
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
2013-08-14 20:56:05 -03:00
Chad Horohoe
2bda9a37fe Allow individual search backends to control whether they SearchUpdate
$wgDisableSearchUpdate is a sledgehammer for disabling all indexing
which is fine for most people, but sometimes you've got multiple
search backends and you want some to update but not others. This
allows each backend to tell core whether they support the feature.

This also removes the SearchUpdate hook which really doesn't make
sense and nobody uses but CirrusSearch and an abandoned extension
from 7 years ago.

Will require parallel change to MWSearch (Ibd002347) and Cirrus (I87a5b8cc)

Change-Id: I2063fe05000044225fa6bec2171ed0071b84a5cf
2013-08-14 17:55:04 +00:00
Brad Jorsch
2b20038ce7 Add limit report data on preview pages
While we've long had the "NewPP limit report" hidden in an HTML comment,
it is hard for users to find this as they're not likely to look for
profiling information hidden in an HTML comment. Even for those aware of
it, it's not particularly convenient to find.

This changeset adds a table showing this information at the bottom of
the page preview. It also adds the ability for this information to be
added to the ParserOutput object in a structured manner, and various
messages so the report can be localized for the end user.

Note that, for backwards compatability, the default English messages are
used for the "NewPP limit report" comment rather than the localized
messages.

Change-Id: Ie065c7b5a17bbf1aa484d0ae1f3ee0f5d41f8495
2013-08-13 05:54:03 +00:00
Brad Jorsch
136861fe3a Add wfResetSessionID()
The code for changing the session id cookie from Special:Userlogin is
also needed in CentralAuth. So let's factor it out to avoid code
duplication.

Change-Id: I777f76ee8e2b953a1e972327bedc28e0ab1acf0d
2013-08-07 23:18:46 +00:00
Brad Jorsch
54bf87d346 Improve WebResponse::setcookie
Various bits of code are not using this because it doesn't support
various use cases, e.g. session cookies, httpOnly, custom paths, etc.

Refactor it to add all those options. Also add a hook so extensions can
override the setting of the cookie.

Change-Id: Ia0c424a48d9455a8574d91631cde0f00c9882288
2013-08-07 17:43:06 -04:00
C. Scott Ananian
fa2e54dc34 Update outdated references to maintenance/ in documentation comments.
Change-Id: I2e424addb27b980dd5e8658b8ce79590b7b5db62
2013-08-06 12:04:35 -04:00
Ori Livneh
7e18081ec4 Add a usage note to 'CanonicalNamespaces' hook docs
It seems natural to defer namespace configuration until the namespace is
actually registered, but in the case of namespaces that are registered in
CanonicalNamespaces hook, doing so will not work or cause unpredictable
results. This patch adds a note of warning to hooks.txt. See bug 45031 for
context.

Change-Id: I3f2d56dc7ded5e00974de0baf1a84188eade823c
2013-07-30 18:44:01 -07:00
MatmaRex
ed7979a970 Refactor watchlist token handling
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
2013-07-24 22:06:15 +02:00
nischayn22
50ca5a7d17 hook to intercept upload_by_url
This is planned to be used for intercepting by UW for Flickr blacklisting.

Bug: 42307
Change-Id: Ia3daaeba1ce5e69e751ffc2ae5afd5e449cf4aa7
2013-07-24 19:11:33 +02:00
Roan Kattouw
6bf642d80a Add a hook to Title::getEditNotices() so extensions can add them
FlaggedRevs will have to use this to expose its edit notices to
VisualEditor.

Also add an $oldid parameter so edit notices can be generated based
on the revision ID being edited.

Change-Id: Ie44a01ebfa7002fa3a89f081e0f831442666ac03
2013-07-23 17:31:27 -07:00
Brad Jorsch
76623e75da Add User::isEveryoneAllowed function
User::groupHasPermission is used for various purposes, from checking
whether it makes sense to show a "hide logged-in users" on
Special:NewPages to showing different error messages in some places when
'user' or 'autoconfirmed' is allowed the action to avoiding unstubbing
$wgUser to check $wgUser->isAllowed( 'read' ) in the common case where
'read' permission is granted to everyone.

For the OAuth work, we need to be able to catch that last type of use
without interfering with the others. This change introduces
User::isEveryoneAllowed() to be used for that type of check, which both
makes sure the right granted to '*' isn't revoked from any group and
calls a hook to allow extensions to indicate that they might remove the
right.

Change-Id: Idfee1b4d0613aaf52e143164acd6022459415c49
2013-07-12 11:18:15 -04:00
MatmaRex
e369c0105e Remove the EditSectionLink hook
Deprecated since 1.14. Not used by any extensions in gerrit.

Change-Id: I5f4b381496d1e005add9bbcd9e86d4390491e0d0
2013-06-27 18:10:13 +02:00
Chad Horohoe
74c0e04c1a Allow SearchUpdate hook to abort core update call
Going to use this in CirrusSearch since the default text
handling is insane for Solr.

While we're at it, further move content handling to SearchEngine
so children can override behavior here.

Change-Id: I09d11b81c224d53609c57d75d54021e697b56629
2013-06-21 14:00:45 -04:00
Brad Jorsch
c94454687f Return errors from WatchAction
Currently, WatchAction::doWatch and WatchAction::doUnwatch return true
always. Let's have them return a status object instead.

This also cleans up the handling of Status objects in some of the API
modules.

Change-Id: I9dd9f0fd499c37f29fa12bcdb6142238a1f11e4d
2013-06-20 15:51:05 -04:00
Chad Horohoe
0ca1132ea9 Remove Selenium tests from core
This never really worked properly, doesn't conform to coding
conventions, and isn't actually used by anyone for testing.

Our selenium stuff these days are in the qa/browsertests repo

Change-Id: I8f1efaa118fe41821fb3f4a6099d75a33681f17b
2013-06-14 16:20:09 -04:00
bsitu
f330f727df Add new hook AbortTalkPageEmailNotification
This hook will allow extension to disable the regular talk page email notification,
Echo is doing this with a hackish solution of setting global variable
wgEnotifUserTalk to false on the fly, this approach is problematic and will
be replaced with this hook

Change-Id: Ie043d9a1a771d64e4b05b7ddeca75c7542a6c575
2013-06-10 15:37:18 -07:00
Ori.livneh
6ec90a1acd Revert "Introducing ContentGetParserOutput hook."
This change removed getHtml(), but not the call to it from fillParserOutput.
It has a few other issues that I'll flag in-line after deploying the revert.

This reverts commit fda090a7e7

Bug: 49398
Change-Id: Idcef8d4cedc7c03f72bc1743e0f89cc5ed4ad7a7
2013-06-10 19:13:00 +00:00
daniel
fda090a7e7 Introducing ContentGetParserOutput hook.
This hooks allows extensions to override the normal model-specific rendering
of page content. A typical use would be to provide syntax highlighting for
pages that contain scripts. In that sense, ContentGetParserOutput is a
generalization of the old ShowRawCssJs hook.

Change-Id: Ibfb2cbefea44eeee9f2a027f47e7721bf177ba0f
2013-06-04 15:57:04 +00:00
jenkins-bot
0073be25d9 Merge "Add TitleQuickPermissions hook to Title::checkQuickPermissions" 2013-05-29 21:18:37 +00:00
bsitu
94e2d9318a Add new parameter $patrolFooterShown to hook ArticleViewFooter
Some extensions like PageTriage will be able to use this new
parameter to determine whether to show its own curation toolbar.

Change-Id: I07e85aa37edc994c5a2bf9d011976b91ff01ab14
2013-05-29 23:10:22 +02:00
jenkins-bot
c58873fb42 Merge "Rename $usableSkins to $allowedSkins" 2013-05-25 11:22:57 +00:00
Waldir Pimenta
a3c7a8b8f4 Rename $usableSkins to $allowedSkins
This change is entirely in local scope.
The function is still called getUsableSkins()
so this change won't break anything.
But the variable name and the updated documentation comment
make it clearer what the purpose of this function is,
for anyone reading the code or reading the autogenerated docs.

This change also includes minor changes to documentation
in skin-related files (typos and small edits for clarity).

Change-Id: I4220408f4d3b64cf87be4ad1af4b72d3a4524922
2013-05-25 12:10:34 +01:00
Kevin Israel
f9e2349202 Remove 'SkinTemplateTabs' from docs/hooks.txt
According to online documentation: "This feature was removed completely
in version 1.18.0."

Change-Id: I410dce8b04ff788cd6573b3b11fd56ce41a96395
2013-05-24 23:50:26 -04:00
Tyler Anthony Romeo
7120504bb9 Add TitleQuickPermissions hook to Title::checkQuickPermissions
Currently Title permissions hooks get called after
Title::checkQuickPermissions, preventing users from
overriding quick permission checks. Added a hook to
allow this. Needed for bug 45898.

Change-Id: Id672270741282778815b06eff8b234ca4d819744
2013-05-24 19:37:01 +00:00
Timo Tijhof
beb1c4a0ec phpcs: More require/include is not a function
Follows-up I1343872de7, Ia533aedf63 and I2df2f80b81.

Also updated usage in text in documentation and the
installer LocalSettingsGenerator.

Most of them were handled by this regex:
- find: (require|include|require_once|include_once)\s*\(\s*(.+?)\s*\)\s*;$
- replace: $1 $2;

Change-Id: I6b38aad9a5149c9c43ce18bd8edbab14b8ce43fa
2013-05-21 23:26:28 +02:00
jenkins-bot
7106407580 Merge "TitleSquidURLs hook for changing the URLs to purge" 2013-05-21 20:06:10 +00:00
daniel
e311f6f868 TitleSquidURLs hook for changing the URLs to purge
This allows extensions to purge derivative resources that need
updating when a wiki page is changed.

Change-Id: Ic28ce7f57f29376b041627288979981fcb218a44
2013-05-21 20:01:55 +00:00
Timo Tijhof
b7bec085ce Drop redundant attributes in hardcoded html
Follows-up 97caae596d which makes HTML5 the default
and removes support for XHTML 1.0 and HTML < 5.

* <script type>
* <style type>
* <html xmlns>
* Quick-closing slash in non-XML HTML5 documents

Change-Id: I71855fa8d4095a5a448ebdc3dc36506ddab6f70c
2013-05-21 01:05:12 +02:00
Timo Tijhof
50e7985d4d phpcs: Fix WhiteSpace.LanguageConstructSpacing warnings
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
2013-05-09 05:56:26 +02:00