Commit graph

342 commits

Author SHA1 Message Date
umherirrender
d63121016d fix some spacing
Added/removed spaces around logical/arithmetic operator
Reduced multiple empty lines to one empty line
Removed wrong tabs before comments at end of line
Removed too many spaces in assigments

Change-Id: I2bba4e72f9b5f88c53324d7b70e6042f1aad8f6b
2013-03-07 17:53:21 +01:00
umherirrender
6fbbbd17ca fix some spacing
Change-Id: Ie7bb35871cc99237f3a655f7db22ca1f0646df5e
2013-01-27 14:21:50 +01:00
Aaron Schulz
6eef765b85 [JobQueue] Optimized JobQueueGroup::pop().
* This also simplifies MediaWiki::doJobs().

Change-Id: I58ee2313453c64d4e8d91f3a65181aaa9c2e847f
2013-01-14 16:40:27 -08:00
Brian Wolff
9e5802ef66 Reuse the WikiPage object to save a db query
Early in the request we call Action::getActionName to get the action
name for HTMLFileCache to see if the current action is cached.
This causes data to be loaded from the WikiPage object
stored in the main request context. However, later when
we're initializing the Article object, we overwrite that
WikiPage object with the one used by the Article object.
Later on the WikiPage object has to be re-loaded, and
hence the exact same db request is run twice in one request,
which seems wasteful.

Instead, initialize the Article object using the WikiPage
object from the context, in order to save the already
loaded data.

Change-Id: I292f0d70feb505fae5fa955fd735d85ad3b22fea
2013-01-04 13:05:09 +00:00
Niklas Laxström
bda755617e Rewritten $wgAdaptiveMessageCache
This was developed for translatewiki.net, which has but
millions of messages in MediaWiki namespace. To avoid
exploding the message cache, not all of them can be
loaded. Instead of logging what messages have been
requested, now it uses the fact that if the
message has not been customised in the
site language, there is most likely
no reason to load it in any other
language either.

Change-Id: I6dd81b3858acfd2b73332e46668d46015e99c748
2012-10-26 12:48:52 -07:00
Tim Starling
6cb1fe1fe4 Fixed the caching of redirects in Squid
Was accidentally broken in Ie38ae198, where the request URL was compared
against the final target title, not the title of the redirect. Also
tested squid purges of redirects, since that code presumably hasn't been
tested for a while, and committed my very advanced testing framework.

Change-Id: Ib2ffe8e109bcc4859e22df5470bddfdb09e67afa
2012-10-17 11:00:07 +11:00
ASchulz
b567f3602e [JobQueue] Job queue refactoring and generalizing.
* Added support for different queue types and methods for storing queues.
* Treat each job type as being on its own queue, at least logically.
* Added $wgJobTypeConf to configure queue types for each job type.
* Improved the job DB table so that duplicate job checks actually work
  and are faster. Also improved the method for popping rows of the table.
* Disabled duplicate job removal for everything except refreshLinks.
  The DELETE statements just add DB overhead and are not useful for cheap
  jobs, especially ones with start/end params (which are unlikely to have
  exact duplicates).

Change-Id: I49824c7fa855fea4ddcac5c9901ece8c2c0101d0
2012-10-16 09:39:58 +11:00
Siebrand Mazeland
d4b046a893 Update docs for return and exception info
* Removed some inline tabs in the process.
* IDE fixed some incorrect leading spaces, too.

Change-Id: Ic9303eff6db4424ac3f1fa2816839692b43e6190
2012-10-09 09:41:58 +00:00
csteipp
5801da5f86 (bug 29898) Set cookie to force HTTPS from HTTP
Sets a cookie on user login (removed on logout) if wpStickHTTPS
was checked, which causes the browser to get a redirect if they
visit the HTTP version of the site.

Change-Id: I60f44a1062a93d15198edae6674bb3310a148b2d
2012-09-21 15:47:59 -07:00
Demon
99d52eee21 Merge "No need to call parseTitle() directly in MediaWiki::__construct()." 2012-07-30 01:48:42 +00:00
Alexandre Emsenhuber
0e0fcf55a2 Reorder methods in the MediaWiki class for better consistency.
Change-Id: I651606b3d675212891c5075b3114c451810a3ec5
2012-07-24 18:13:03 +02:00
Alexandre Emsenhuber
aafe047a70 Execute jobs on all index.php requests.
The problem is that currently deferred updates are not executed
after action=ajax requests or file cache hits. This means that,
e.g. ViewCountUpdates are not executed after file cache hits.
The code to execute jobs (both deferred updates and job queue)
is now in MediaWiki::restInPeace() so that it's also executed
after what is mentioned above, and the remaining code of
MediaWiki::finalCleanup() is moved directly MediaWiki::main()
since that function is only used in one place and it make no
sense to keep a method for such little code.

Change-Id: I6f511a74c59a2e3653c10bfcff9b0d15118e699f
2012-07-21 08:14:43 +02:00
Alexandre Emsenhuber
f121e64c18 No need to call parseTitle() directly in MediaWiki::__construct().
We have MediaWiki::getTitle() which will call parseTitle() if needed.
That method will be called in MediaWiki::main() when the Title object
is really needed. This allows to not have to call parseTitle() when
the DB replication lag is higher than the maxlag parameter or on
action=ajax requests.

Change-Id: Iebca2b3029e95879ea7739367b09c8c37502e71c
2012-07-19 10:04:50 +02:00
Liangent
a2f9b7e35d Fix comments added in change 10088
I found my comments in change 10088 is inadequate because we don't
have any known squid URLs in Title::getSquidURLs() and we may never
want to have... There's no hook there so extensions are unable to
add any squid URLs for them (maybe we want one someday? but new
extensions shouldn't be using the UnknownAction hook).

Change-Id: I44ba376f92776ec6bb32f91beb06f11ebd086fb4
2012-06-19 10:37:07 +02:00
awjrichards
c29fd59775 Big oops - merged to wrong branch.
Revert "Revert to arbitrarily old point before initial remote branch creation to help clean up"

This reverts commit ee0d3d330f
2012-06-05 22:58:54 +00:00
awjrichards
ee0d3d330f Revert to arbitrarily old point before initial remote branch creation to help clean up
Change-Id: I41a3d1e55d3ea9dffa42451237fe065f9334361d
2012-06-02 08:43:04 -07:00
Liangent
6eac0a40cf setSquidMaxage() globally if we can purge it, instead of in actions.
Change-Id: I404c994616eab0902a9e3650c97028e9bcfb22db
2012-06-04 14:46:36 +08:00
Brian Wolff
d5b26e049a Give a warning when people use $wgArticle. Add's a class that can be used to give warnings for other globals too.
See discussion on r111168.

Of course no one will see warning because trunk has $wgDeprecationReleaseLimit set to 1.17 by default
(<rant>have I mentioned how I don't like that variable. People enable warnings to be *warned* about
things. Making it so people won't get warned about things until a couple months after we've decided people
should stop using function/interface/etc defeats the purpose of having warnings</rant>)

p.s. Wasn't sure if this waranted something in the release notes, I don't think it does (It's just adding a warning)
but wasn't sure.
2012-02-13 00:19:06 +00:00
Alexandre Emsenhuber
d9abf3d8b9 Revert r111168 (removed of $wgArticle) since it seems that this is too early for some people; also removed the comment stating the removal was due in 1.20 (might want to be merged in 1.19). 2012-02-12 14:38:42 +00:00
Alexandre Emsenhuber
b31d540ba9 GOOD BYE $wgArticle!
It was stated that it would be removed in 1.20 and we are in 1.20.
2012-02-10 17:00:21 +00:00
Thomas Gries
87ed9b37f2 Please review carefully, I cannot see negative side effects from this patch. It gives extensions which use the (depreacted) UnknownAction hook a chance to see the original action= value. This fixes bug 34203 and bug 34161 UnknownAction hook problem: the hook must pass the unknown action to the callee and not the value "nosuchaction" 2012-02-05 11:00:07 +00:00
Alexandre Emsenhuber
afab06cc73 wfTime() -> microtime( true ), no need to use the former which is just a wrapper to the latter 2012-02-03 08:32:34 +00:00
Jeroen De Dauw
82a03f792a fix doc and var names 2012-01-29 15:24:06 +00:00
Platonides
f5c897bf66 Unused global 2012-01-26 17:16:41 +00:00
Antoine Musso
a15b11d3a5 bug 33646 Badtitle error page now emits a 400 HTTP status.
Sending a 200 OK status on bad title, prevents mobile browsers to
actually now the page is an error page.

Tested using:
 curl -I http://localhost/wiki/\]\]
 curl -I http://localhost/wiki/Special:BadTitle
2012-01-25 10:51:37 +00:00
Krinkle
db97a3a3f9 [Action] Fix action=ajax
* Move Ajax stuff to before regular title/page action handling. Ajax actions circumvent most stuff and return early from the regular execution.
* Needed because getAction / Action-classes can't handle action=ajax properly, which isn't until MediaWiki::performAction
* Also undo's debug 'true' in the if-statement from r109688
2012-01-21 20:13:57 +00:00
Krinkle
e10448fe06 [Wiki.php] Minor clean up
* Comment syntax consistency
* Re-use saved getTitle()
* Doing in separate commit for review ease
2012-01-21 20:10:35 +00:00
Krinkle
5f6fa16138 Reinstate r109223 per CR + fixes
* Action/Context stuff is pretty deeply nested everywhere.
* Should be okay now, at last.
* Reverts reverting r109243
* Same as r109223, except adding this:

+		if ( !$context->canUseWikiPage() ) {
+			return 'view';
+		}
2012-01-21 06:57:34 +00:00
Aaron Schulz
4831df5182 Reverted r109223 per CR 2012-01-17 23:07:15 +00:00
Krinkle
d28d00071a [Actions] Move action logic out of MediaWiki::getAction/MediaWiki::performAction into Action::getActionName.
* Follows-up r109195
* Reverts/Redoes r108342, r108343, r108345

* Contributes to solution of bug 27930 - Ability to get current action (The Right Way)
2012-01-17 21:49:27 +00:00
Krinkle
d03087df35 [Actions] Move the remaining actions out of MediaWiki::performAction into single action classes (finally).
- [Actions] -
* I am aware that eventually these classes should be more than just a few lines re-directing control to WikiPage, but I'm keeping these commits as uncontroversial as possible due to feature freeze. Refactor could be done later.
* Contributes to solution of bug 27930 - Ablity to get current action (The Right Way)
* Final goal: Get the current action without needing access to Wiki.php internals (i.e. with Action::factory in one hand and an instance of IContextSource in the other)
* Required for proper fix of r108342/108343 (currently marked FIXME)
2012-01-17 19:56:08 +00:00
Aaron Schulz
5a6559d8b1 Reverted r108743 per CR comment. This should at least be discussed first. 2012-01-12 19:41:18 +00:00
Sam Reed
a5c200a25b Kill "* @return void" 2012-01-12 19:12:24 +00:00
Sam Reed
b4a276e72e Documentation
Wrap some long lines
2012-01-12 19:03:32 +00:00
Niklas Laxström
7a8d6d8e71 Apparently we can commit code that doesn't compile but I am not allowed to have commit summary as "){} -> ) {}" 2012-01-11 19:47:21 +00:00
Sam Reed
bf4be6b5d4 Add @since to getPerformedAction, added in r108342
Caused site errors as not in 1.18 when trying to merge r108345 as a followup to r94131
2012-01-11 15:51:07 +00:00
Krinkle
6c474f0c07 Fix typo from r108342. 2012-01-08 02:49:33 +00:00
Krinkle
79948c3077 Implement MediaWiki::getPerformedAction()
* Fixes:
-- Bug 27930 - Ablity to get current action (The Right Way)
2012-01-08 01:31:56 +00:00
Alexandre Emsenhuber
418b3503b1 * Added WikiPage to RequestContext and related so that it can be shared to avoid creating a new object each time and thus avoiding database queries to load the state of the object
* Added Article::getPage() as accessor to the WikiPage object so that it can be set in the context from MediaWiki::initializeArticle()
* Use it WikiPage::main() to call doViewUpdates()

I'm doing to this now so that I can revert r105790 and use the WikiPage object before the 1.19 release
2012-01-06 20:00:04 +00:00
Alexandre Emsenhuber
9993fac519 Updated comment since $wgArticle is going to be removed in 1.20. 2012-01-02 11:59:56 +00:00
Alexandre Emsenhuber
9717e5cb18 * Inlinise the only usage of $user in MediaWiki::main()
* Change the name of the variable containing the WikiPage object for more consistency
2011-12-19 16:05:47 +00:00
Alexandre Emsenhuber
921bced830 Revert r106545 and pass a null variable by ref (also updated the documentation) so that the hook is called at the correct moment and after everything is executed.
This is *exactly* the same behaviour as before r88898 since $article was an out parameter to fill $wgArticle correctly.
2011-12-18 14:48:23 +00:00
Mark A. Hershberger
bbc2b0fdb1 followup r88898 -- move BeforeInitialize hook to where it can be
called in a way that matches the documented parameters

As it was, when an extension tried to use BeforeInitialize with the
documented parameters this resulted in an exception:

    Detected bug in an extension! Hook HookFunctionName has invalid
    call signature; Parameter 2 to HookFunctionName() expected to be a
    reference, value given
2011-12-18 01:46:25 +00:00
Mark A. Hershberger
420a172641 w/s 2011-12-18 01:32:11 +00:00
Chad Horohoe
5f723f8552 Get rid of a few more $wgTitles 2011-12-15 16:52:51 +00:00
Jeroen De Dauw
0b105ebf1d added missing deprecation notices 2011-12-13 19:51:03 +00:00
Sam Reed
7141742914 * (bug 32276) Skins were generating output using the internal page title which would allow anonymous users to determine wheter a page exists, potentially leaking private data. In fact, the curid and oldid request parameters would
allow page titles to be enumerated even when they are not guessable.
* (bug 32616) action=ajax requests were dispatched to the relevant internal functions without any read permission checks being done. This could lead to data leakage on private wikis.
2011-11-28 23:18:55 +00:00
Platonides
9b283db803 Follow-up r102521
Remove $wgUseExternalEditor globals.
2011-11-09 23:35:30 +00:00
Alexandre Emsenhuber
588539858c Some updates to EditPage and ExternalEdit:
* Made ExternalEdit use a context
* Updated DifferenceEngine to use ExternalEdit to send the diff stuff to reduce code duplication
* Introduced ExternalEdit::useExternalEngine() to check whether to use the external edit or diff (except for the action, section and oldid which are still checked in Wiki.php) to remove code duplication; external diff can now also be controlled with externaledit or internaledit URL parameters
* Use $wgContLang to get the name of the "Special" namespace instead of user's language
* Modified the line breaks in the comment on the top of the control file so that the URL is on its own line
* Updated extension to call EditPage::edit() instead of EditPage::submit(), the latter will just call the former
* Updated extension to let core handle itself the ExternalEdit mode instead of doing this themself
2011-11-09 15:31:55 +00:00
Alexandre Emsenhuber
381309f474 * Merged Title::userCanRead() check in Title::getUserPermissionsErrors()
* (bug 26020) Setting $wgEmailConfirmToEdit to true no longer removes diffs from recent changes feeds
* Added second parameter to Title::userCan() and Title::quickUserCan() to allow callers to pass the User object to use for checks; this changes Title::userCan()'s second parameter from "do expensive queries" flag to User, but all callers should have been updated in r102183
* Updated callers that might throw a PermissionsError to use getUserPermissionsErrors() instead and pass the error array to the exception
* Refactored duplicate code in missingPermissionError()
* Moved Title::isNamespaceProtected() a bit upper and Title::userCanRead() near Title::userCan() to have related functions in the same location
* Some minor refactoring in permission-related functions in Title
2011-11-06 19:59:46 +00:00