Commit graph

926 commits

Author SHA1 Message Date
jenkins-bot
68e8c6ca53 Merge "Add PreferencesFormPreSave hook" 2014-02-03 03:00:44 +00:00
jenkins-bot
f726bbf6e7 Merge "Add oldRev parameter to DiffRevisionTools hook" 2014-01-29 01:44:01 +00:00
Jackmcbarn
25b83169c8 Add oldRev parameter to DiffRevisionTools hook
Add a third parameter to the DiffRevisionTools hook, containing the old
revision.

Bug: 57721
Change-Id: I6ee956c5b9901033f618d7e4d09f8f416f3d72cb
2014-01-28 20:43:55 -05:00
jenkins-bot
70ae276db1 Merge "(bug 47070) check content model namespace on import." 2014-01-28 20:56:02 +00:00
Kunal Mehta
266e9d91d1 Add PreferencesFormPreSave hook
Allows extensions to modify what preferences will be saved

Change-Id: Ibd8331c39afdde39b688d78f3faade2883f0c997
2014-01-23 23:53:16 +00:00
Brian Wolff
1051f68e7d Add $context to the ArticleFromTitle hook
Most of the time people wouldn't need this - this hook is mostly
used to inject a custom Article subclass for a specific
namespace to do fancy things, but lets give users the most
flexibility.

Asked for by leaves on irc.

Change-Id: I3386ff4abe0e5b3eb783604ae222b7703428db44
2014-01-23 22:51:11 +00:00
jenkins-bot
5bca585cc9 Merge "Add Status outparam for AbortNewAccount hook to fix API error handling" 2014-01-23 20:27:00 +00:00
Brion Vibber
c8e3c424f9 Add Status outparam for AbortNewAccount hook to fix API error handling
With this fix and relevant fix for ConfirmEdit in, an API account creation
attempt that fails the captcha check will return a much cleaner error such as:

{
  'error': {
    'code': 'captcha-createaccount-fail',
    'info': 'Incorrect or missing CAPTCHA.'
  }
}

Abort hooks that use the old interface and send a text message will now
be reported with the generic 'createaccount-hook-abort' message code, with the
string passed back intact.

Previously, the returned result would list the contents of the message
_as_ the error code, making it hard for a client to determine the error.

'AbortNewAccount' hook clients can add a '&$status=null' function paramater
on their signature, and along with the back-compat message parameter
you can set something like:

  $msg = wfMessage( 'captcha-createaccount-fail' )->text(); // back-compat
  $status = Status::newFatal( 'captcha-createaccount-fail' ); // new

This is done for ConfirmEdit in If9cc08e

Bug: 60008
Change-Id: I6ae34c00d1051d34363b6d654424be17dcb1ea30
2014-01-23 10:02:50 -08:00
Kunal Mehta
ebdfe504d9 Allow extensions to set a custom error message in the BlockIp hook
Change-Id: I2e3773e22c78370e6ca1de49e7b0976b68d8d76b
2014-01-19 15:23:39 -08:00
Brion Vibber
2fc330138e Add hooks in API action=createaccount for Captcha
New hooks:
* AddNewAccountApiForm
* AddNewAccountApiResult

These hooks are used in ConfirmEdit here: Id628def

Sample API client: https://github.com/brion/api-createaccount

Bug: 46072

Change-Id: If5b7dab80ac85dbfa0f7a54a445356783df5e914
2014-01-17 12:41:22 -08:00
Bartosz Dziewoński
2e29ebf8a3 SpecialWatchlist: Use FormOptions for parameter handling
The SpecialWatchlistQuery hook now gets a FormOptions object as the last
parameter instead of an array (which is not bad as bad as it sounds, since
the class implements ArrayAccess).

Change-Id: Iec4aab870b6e9aa98d2b118010e78e25b1dbe437
2014-01-11 01:01:53 +00:00
jenkins-bot
320c48058e Merge "Add hook to allow extensions to modify the LonelyPages query" 2014-01-08 22:14:30 +00:00
kaldari
6e139e0e46 Add hook to allow extensions to modify the LonelyPages query
First step to solving bug 3483.

Bug: 3483
Change-Id: Ie8c5765ddc6b6028836024c426a0369e6966b25e
2014-01-08 13:57:43 -08:00
physikerwelt
ce2b03fb0b Add reference to the current user to the PageRenderingHash hook
To generate a user-dependent cache key it makes sense to pass
a reference to the user object, since $wgUser is deprecated.

Change-Id: I32a1df52912292230852c31d69968eeb312a4a97
2014-01-06 15:04:54 +00:00
Aaron Schulz
7bd3a8c576 Added $purgeBlobs flag to LocalisationCacheRecache hook
* This helps replace the WMF live hack to skip calling clear()

Change-Id: I37bd6cf87e72b6d32e4c6c261abe2a0ef43d067e
2013-12-30 21:45:59 +00:00
Kunal Mehta
55869c8871 Make SpecialContributionsBeforeMainOutput hook more useful
The current id number is useless for IP addresses, so it now
passes a proper User object.

For context, the SpecialPage instance is also provided.

Change-Id: Ie196611d504b3969bcdfb5c589716af2f3c54e14
2013-12-20 23:50:57 -08:00
daniel
4cc9407fe9 (bug 47070) check content model namespace on import.
When importing, we need to check that the kind of content we are about to
import is actually allowed in the specified location on the local wiki.


This change does two things:

* Introduce the ContentModelCanBeUsedOn hook which provides control over
which kind of content can be used where.

* Introduce a check against ContentHandler::canBeUsedOn in the importer,
along with an appropriate error message.

Change-Id: Ia2ff0b0474f4727c9ebbba3c0a2a111495055f61
2013-12-17 16:58:57 +00:00
Kunal Mehta
4441875b19 Add SpecialBlockModifyFormFields hook
For extensions to add more fields to Special:Block

Change-Id: I00fbc7af1e50e1f76208a3692f152058d2d1879e
2013-12-15 16:12:10 -08:00
Brad Jorsch
76c61632f7 Add ApiBeforeMain hook
$wgExtensionFunctions is called before the RequestContext is really
available (i.e. getTitle() is null, accessing the User object may fail
because other extensions' UserLoadFromSession hooks don't expect to be
called that early, etc). The index.php code path has BeforeInitialize to
take action after RequestContext is available but before much else
happens, but the API doesn't (yet) have anything similar.

Bug: 58380
Change-Id: I0a167faaa4166da381194c53373d82e038848924
2013-12-12 10:01:33 -05:00
Kunal Mehta
cbc4e5c6b2 PersonalUrls hook provides a SkinTemplate, not a Skin
Follow-up to I1116fd64ea0beac148ee75ea4ec050741fc2c3b7

Change-Id: I84b00316f3e6564fb2b3c47a1e7c0c7a9af0c8ac
2013-12-08 21:59:16 -08:00
jenkins-bot
9050ec22df Merge "Remove m prefixes from private variables" 2013-11-25 19:44:04 +00:00
Chad Horohoe
4b2e1c65e1 Remove m prefixes from private variables
Also tweak a few incorrect comments while we're here

Change-Id: I0ef58fe68c60179c53ca6abca069b7b478bf6946
2013-11-25 10:16:26 -08:00
Chad Horohoe
746f807ed2 Remove a few stray $wgTitle comments
Change-Id: Idcb9232e641b5f54845408a2a1c1b9fc28f0040b
2013-11-22 11:59:57 -08:00
Bartosz Dziewoński
bb672df7c0 SkinTemplate: Add $this as a parameter to PersonalUrls hook
Change-Id: I1116fd64ea0beac148ee75ea4ec050741fc2c3b7
2013-11-16 13:36:24 +01:00
This, that and the other
3631901139 Clean up some old readme files and remove references to SVN
docs/README: Updated links, got rid of 2008 date at top of file
docs/maintenance.txt: Updated link
extensions/README: Some cleanup, added link to new git.wikimedia.org
includes/DefaultSettings.php: SVN -> Git for udpprofile
includes/profiler/ProfilerSimpleUDP.php: ditto
languages/MessagesRo.php: removed link to mime.types on SVN from the
  mimesearch-summary message. This file seems to have been deleted from the
  modern-day Git repository
maintenance/postgres/mediawiki_mysql2postgres.pl: removed SVN magic words

That takes care of most of the remaining references to SVN etc.

Bug: 38714
Change-Id: I261921df4b4c0545658d6d38c5f3c1f9dfa63ad1
2013-11-16 10:38:50 +00:00
MarkAHershberger
c24f8be729 Revert "Remove unsupported and mostly non-functional Mssql support"
This reverts commit 5e1efc3144.

This sort of thing needs to be discussed.  Please do not self-approve changes like this.

Change-Id: I9eb9ea315d90584b7fe95db43a6759884f9506b5
2013-11-16 02:06:01 +00:00
Chad Horohoe
5e1efc3144 Remove unsupported and mostly non-functional Mssql support
Change-Id: Id0a688865a5b7b6bb363f7b118fad4f455d2b3b6
2013-11-15 10:59:37 -08:00
Matthias Mullie
1e40bfe6d0 Give extensions a chance to hide their (unrelated) log entries
Change-Id: Id8b0f29d6e2ac9d7cab8f3d1efcb202062a6ad0b
2013-11-15 17:59:53 +01:00
Kunal Mehta
8b4ee2bb3b Fix false positive in findHooks.php
Use " instead of ', so the script doesn't think it's a hook

Change-Id: Idb28a368eee6bcfe70d1d3aa0a89329769d3fa26
2013-11-13 12:12:57 +00:00
Kunal Mehta
df8317feb0 Standardize spacing
Change-Id: I1f8d83497fb1e50220993bfc267f05d93250d57c
2013-11-12 21:41:04 -08:00
Kunal Mehta
9d5ce74eb8 Add GetLogTypesOnUser hook
Allows extensions to modify the list at SpecialLog::$typeOnUser
This is useful for extensions like Thanks where the target is a
userpage.

Change-Id: I77e1e59d7e3666802d0eeb0c48a0ec211dba0a2a
2013-11-12 18:27:26 -08:00
jenkins-bot
10e909590a Merge "Revert "DifferenceEngine cleanup"" 2013-11-11 16:47:39 +00:00
Siebrand
60fa0e1c3b Revert "DifferenceEngine cleanup"
This reverts commit 1f423cc609.

Change-Id: I2254eb37376063a081ad89481654b735fb0360b1
2013-11-11 16:35:19 +00:00
jenkins-bot
a4628722db Merge "New hook 'LocalisationChecksBlacklist' to allow to extend the localisation checks blacklist" 2013-11-11 14:37:19 +00:00
Alexandre Emsenhuber
33bec07ae9 New hook 'LocalisationChecksBlacklist' to allow to extend the localisation checks blacklist
The point is to allow to use the blacklist of translatewiki.net,
so the format of $checkBlacklist got changed to be compatible with it.

Change-Id: I5eb328c4bdbb0b21962b89acbe12f46ebb4d9d70
2013-11-10 11:07:58 +01:00
Parent5446
3cc242ade3 Revert "Add a hook to validate account creation fields."
Change adds a hook that serves exactly the same purpose as
AbortNewAccount. Also change was merged prematurely and is
missing message documentation as well as having some minor
code flow issues.

This reverts commit cc1006b77c.

Change-Id: I8656aa1a99c84778fd85ec7da9d6ce23bd6cf9b9
2013-11-10 04:34:22 +00:00
Andrew Bogott
cc1006b77c Add a hook to validate account creation fields.
This is a step on the way to fixing bug 56847.

Change-Id: Id330a8ac041ddea086f192a90ddc962077453333
2013-11-09 20:24:38 +00:00
Max Semenik
1f423cc609 DifferenceEngine cleanup
* Remove mPrefixes from variables
* Turn a define into class const

Change-Id: I80874627df9dffae596f8f7cb3ca28f19ba1f167
2013-11-09 04:21:32 +04:00
Brad Jorsch
ac2b9d7bae Allow ParserLimitReportFormat to change $value
It's likely that an extension might want to reformat the value (e.g. by
passing it through Language::formatSize()), but otherwise use the
default behavior for the key. Make $value a reference parameter so they
don't have to reimplement all the logic for laying out the row.

Change-Id: I7799616a602d90e1b8d3f0ece35811ca387bade7
2013-11-08 05:06:02 +00:00
jenkins-bot
05740a9619 Merge "Fixing documentation for memcached." 2013-11-05 21:58:11 +00:00
kaldari
b82f714cc3 Fixing documentation for memcached.
I believe that MediaWiki's memcached client does support PECL now.
Also fixing a typo.

Change-Id: Ibcf9c25d077b19de733cc79b5664437479f23a3b
2013-11-05 13:53:07 -08:00
Chad Horohoe
2f28d7dd70 Kill $wgArticle
This has been deprecated since 1.18, throwing warnings for over a
year and a half now, and nothing uses it anywhere in core or deployed
extensions.

No extensions in SVN seem to have this anymore (we must've cleaned
up well), and the only affected extensions in Git are:

- BlueSpiceExtensions
- DynamicPageList (commented, so shouldn't be a worry)
- SemanticPageMaker
- TwitterCards

If you're the author of one of these extensions or are feeling like
cleaning up ancient code, please get them fixed.

Change-Id: I8f3a54c14be4b38a8b917e32ba3a832e0a7ca116
2013-11-01 14:17:26 -07:00
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