Commit graph

295 commits

Author SHA1 Message Date
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
Alexandre Emsenhuber
3801a3cd28 * Made OuputPage::showPermissionsErrorPage() show a different messages for 'read', 'edit', 'create' and 'upload' actions to saying "You need to log in to do this action" when 1) The user is not logged in 2) The only error is a permissions error (no block or something else) and 3) The error can simply be avoided by logging in
* This replaces OuputPage::loginToUse() functionnality, made it simply throw a PermissionsEror exception and updated all calls in core
* Same for the check in SpecialUpload::execute(), EditPage::userNotLoggedInPage() and EditPage::noCreatePermission()
* Throw the same exception in EditPage::attemptSave() whether the user is logged in or not and let OuputPage::showPermissionsErrorPage() decide which message to display
* Replaced call to deprecated OutputPage::blockedPage() in SpecialUpload
* Displayed messages are the same as now, except the title is always "loginreqtitle"
* 'nocreatetitle' and 'uploadnologin' messages are still used by extensions, so I kept them, but the message 'whitelistedittitle' is not used anymore and has been removed
2011-11-05 19:51:05 +00:00
Aaron Schulz
6c4360c951 Make use of Title::isSpecialPage() in various places 2011-11-02 20:55:08 +00:00
Aaron Schulz
8363693b77 Alias NS_MEDIA page views to NS_FILE. Fixes bug 32032. 2011-11-02 18:47:04 +00:00
Aaron Schulz
d85333fda8 FU r100645: don't pass unused param 2011-10-24 22:19:02 +00:00
Alexandre Emsenhuber
f3ee658a8a * Remove $abort parameter from MediaWiki::checkMaxLag(); unused and it's a private function.
* Restore wfGetLB()->getMaxLag() call since we are no more in index.php
2011-10-24 20:37:54 +00:00
Alexandre Emsenhuber
9e230f3076 * Changed action=history to use an Action subclass
* Use local context instead of global variables
* Removed obsolete aliases PageHistory and PageHistoryPager; no longer used
* Made Action::getContext() and related methods public for the call in HistoryPager's constructor and also for consistency with other classes
2011-10-23 09:21:02 +00:00
Alexandre Emsenhuber
e1280017e0 * Changed action=raw to use an Action subclass
* Left RawPage with back compat code for extensions that use it
* Removed calls to Skin for gen=(css|js). Calling action=raw&gen=(css|js) will now unconditionally return empty content
* Removed Skin::generateUserJs() and Skin::generateUserStylesheet() since they were only used in RawPage
2011-10-20 08:10:25 +00:00
Alexandre Emsenhuber
e3dad1f942 Also catch Special:Badtitle to display the "Bad title" error message since this is now how it is passed in the context object. When such error occured, the user was redirected to Special:Badtitle and got the "Special page does not exist" message. 2011-10-03 14:04:43 +00:00
Aaron Schulz
9e04615a8e FR r98459: forgot to commit this! 2011-09-29 21:34:34 +00:00
Aaron Schulz
6014f0db91 HTMLFileCache refactoring:
* Rewrote class and split into three classes: a base class, and html cache and a more generic cache to be used later.
* The new classes now use RequestContext.
* Renamed fetchPageText() -> fetchText().
* Split out new saveText() function from saveToFileCache().
* Various other cleanups and fixes.
Also fixed backwards setting of $wgDisableCounters in rebuildFileCache.php.
2011-09-29 08:18:20 +00:00
Aaron Schulz
3cd27ff003 Improved filecache short-circuit slightly (catching NS_MEDIA and such) 2011-09-27 06:45:58 +00:00
Brion Vibber
7da1d55a84 Add in a 'TestCanonicalRedirect' hook to be called when about to make a redirect to the canonical page form of a regular page view. Some extensions such as MobileProfile may need to modify this logic to prevent incorrect redirects, such as on alternate en.m.wikipedia.org domain, where we'd want to either skip it or rewrite to the alternate domain.
Support for resolving bug 31012.
2011-09-19 23:14:52 +00:00
Alexandre Emsenhuber
ec9b551ca9 * Added HttpError exception as replacement for wfHttpError(); changed alls core calls to it except AjaxDispatcher.php
* Changed FeedUtils' call to it to be similar than feeds are completely disabled
* Use local context instead of global variables in Special:Userlogout
2011-09-16 18:50:13 +00:00
Daniel Friesen
391736c081 Use IContextSource instead of RequestContext inside type hints and instanceof checks. All we need is something that implements IContextSource and it's possible we may want to implement types of RequestContext that don't directly extend RequestContext but are perfectly valid to be passed to classes. 2011-09-15 15:19:49 +00:00
Chad Horohoe
22b599e06c Refactor deferrable updates into classes & interfaces, also add helper method for the most common use case:
$wgDeferredUpdateList[] = new HTMLCacheUpdate( $title, "sometable" );

I kept b/c with $wgDeferredUpdateList for now, but seeing as only 3 exts in svn use it (FileSearch, FlaggedRevs and WikiScripts), I'd like to deprecate it pretty soon :)
2011-09-10 06:50:30 +00:00
Chad Horohoe
6f308eabc5 Minor tweak to r95521: remove outdated comment about $wgArticle 2011-09-02 13:32:35 +00:00
Happy-melon
d00052ebde Undo r85392 ('revert' is a strong word since a lot has changed in the intervening ten thousand revisions, but the effect is the same). 2011-08-25 21:03:52 +00:00
Roan Kattouw
f174bb0ad0 Reverse a bad decision in r93820, which added a comment to WebRequest::getFullRequestURL() saying it would return protocol-relative URLs if $wgServer is protocol-relative. This behavior makes no sense, though, and most callers expect fully qualified URLs. So make it return a fully qualified URL and update the one caller that expected the return value would be compatible with getFullURL() 2011-08-19 13:25:43 +00:00
Alexandre Emsenhuber
585e0d0565 Temporaray revert of r94031; forgot that this was depending of some other work on my working copy 2011-08-07 14:29:28 +00:00
Alexandre Emsenhuber
2d045fa152 * Moved action=history to use an Action subclass
* Removed obsolete aliases PageHistory and PageHistoryPager; unused
* Maintained backward compatibility with HistoryPage; extensions using it will still work
* Use local context instead of global variables
* Removed calls to OutputPage::setPageTitleActionText() and OutputPage::setSyndicated(), the first one does nothing and the second one is overriden by the setFeedAppendQuery() call just below
* Call Linker methods statically
* Fixed bug where feedEmpty() was not called on empty history since casting a ResultWrapper object to boolean always returns true even when there's no row
2011-08-06 19:41:49 +00:00
Aaron Schulz
2d93c5c8af Reverted r91942,r91943,r91949,r92156 per CR 2011-08-03 22:08:24 +00:00
Sam Reed
ead9055a62 Update code comments that point to 1.18 to point to 1.19 2011-07-18 23:01:08 +00:00
Chad Horohoe
5d9d464e21 Various cleanups to ExternalEdit. Documentation, code style, removed some unused variables, removed silly 'm' prefix, etc. 2011-07-14 20:19:59 +00:00
Chad Horohoe
5e95c48e28 Use the context's response for header() calls in checkMaxLag() 2011-07-14 17:48:41 +00:00
Aaron Schulz
d7f48f6aef Pointless w/s tweaks :) 2011-07-13 22:11:53 +00:00
Aaron Schulz
d981ac2001 * Changed MediaWiki:main to use WikiPage
* Cleaned up MediaWiki function visibilities
2011-07-13 18:30:47 +00:00
Aaron Schulz
b1193eec5f * Broke long Wiki.php lines
* Added getValueNames() function to WebRequest.php
2011-07-13 18:05:44 +00:00
Leo Koppelkamm
0d30caf5a3 Revert r91942, r91943 & reimplement. wgActions doesn't contain all possible actions! 2011-07-12 11:53:58 +00:00
Leo Koppelkamm
934dd80826 r91943. Add global. 2011-07-12 10:19:08 +00:00
Leo Koppelkamm
67fd9d64b7 r91942: Add nosuchaction also if action not in 2011-07-12 09:58:15 +00:00
Leo Koppelkamm
4a34fb14cd Followup r91871 per CR. Write back the actually executed action to . Ping r57415 2011-07-12 09:42:07 +00:00
Alexandre Emsenhuber
18346994ca Moved action=rollback to an Action subclass 2011-07-02 13:46:56 +00:00
Alexandre Emsenhuber
cf6dd13fac * Changed action=revert to use a subclass of Action
* Added WikiPage::getActionOverrides() to be able to execute different actions depending on the namespace (obviously needed for action=revert). This is only used when the value of $wgActions for the corresponding action is true; so extension can still override this.
* Added Action::getDescription() to ease the change of the page header and the <title> element
2011-07-01 20:07:21 +00:00
Aaron Schulz
930ccf282c * Split off WikiPage class from Article, WikiFilePage class from ImagePage, and WikiCategoryPage from CategoryPage.
* WikiPage functions/fields are "magically" part of Article when accessed for b/c. Magic is kind of ugly but there are too many callers to make breaking changes atm. Some functions are just wrappers for WikiPage ones (were magic won't work).
* Added newFromID() to each WikiPage subclass (works around pre-existing inheritance problem).
* Added Page class for convenient type hinting and changed hints from Article -> Page. This lets things use WikiPage objects without getting type errors.
* Updated FlaggedPage to extend WikiPage. Worked around getOldIdFromRequest().
* Added setTimestamp() to WikiPage and moved some timestamp setting code from ParserCache to Article.
* Removed ampersands from $dbw arguments.
* @TODO: dependency inject user objects for WikiPage

The idea is to migrate things to use WikiPage, as the run-of-the-mill "new Article()" call doesn't care about $oldid and $wgRequest. After that, Article, ImagePage, and CategoryPage can be rewritten as an Action class or something sane (a Viewer class of sorts).
2011-06-29 22:09:51 +00:00
Alexandre Emsenhuber
819f9adffe * Fixed documentation
* Added GPL header
2011-06-28 17:20:16 +00:00
Aaron Schulz
16eb5f6e41 * Follow-up r90749
** Tweaked addAutopromoteOnceGroups() calls for performance
** Some doc tweaks and fixes
* Added NS_SPECIAL short-circuit on $wgTitle for file cache and removed unnecessary "is null" check
* Pushed "$action != 'raw'" check into HTMLFileCache
* Removed useless return value from performRequest()
* Added type hint to performAction()
2011-06-25 17:59:42 +00:00
Aaron Schulz
a44e63967d Follow-up r90749:
* Removed clunky autopromoteOnceHook function and added $wgAutopromoteOnce. It currently supports edit or view based triggering. This makes configuration much simpler.
* Added short-circuit to addAutopromoteOnceGroups() by checking if $criteria is empty
* Spacing tweaks and typo fixes.
2011-06-25 04:58:48 +00:00
Sam Reed
73f5fc188e Followup r90261
Restore returning old value
2011-06-21 23:28:50 +00:00
Alexandre Emsenhuber
e275ea28a9 Moved action=info to an Action subclass; also changed display to use a table (a bit like Special:Statistics) with a column for the page and one for the talk page 2011-06-20 18:55:17 +00:00
Matěj Grabovský
fa5ca6db3d Fix outputting AJAX
When calling remote functions, MW was outputting the result followed by page HTML. This was caused by calling the cleanup function, which also output the HTML, even after an AJAX request. Fixed by moving the call after AJAX is all safely handled.
2011-06-18 21:13:46 +00:00
Platonides
962c4452af wfProfileIn/wfProfileOut to the whole main() 2011-06-18 15:14:59 +00:00
Platonides
c933deae2a Add deprecated $wgArticle again. Fixes r88588. 2011-06-18 14:55:22 +00:00
Platonides
c5d9be83f0 As discussed in r85918 CR. Move everything from wfIndexMain() at index.php to MediaWiki class.
This makes index.php compatible again with PHP4 (as in showing a nice error message 
instead of a parser error), which had been broken in r88959.
2011-06-18 14:50:26 +00:00
Bryan Tong Minh
7613c75b0a Per comments revert r88904 and remove session_write_close entirely. This will leave async uploads broken until somebody writes a way to interact with the session per comments on r87235. 2011-06-17 16:42:58 +00:00
Sam Reed
8bfd19b451 Swap else if for elseif
Trimming trailing whitespace also

Doing in 3 commits (3/3), so hopefully reviewable in CR...
2011-06-17 16:05:35 +00:00
Sam Reed
df0f719e52 Fixing up most of the magic get/set stuff 2011-06-17 10:29:39 +00:00
Sam Reed
8f2baf7b8e (29 lines skipped) [17-Jun-2011 10:03:59] PHP Notice: Use of RequestContext::__get() is deprecated; use $context->getFoo() instead is deprecated. [Called from MediaWiki::parseTitle in /www/w/includes/Wiki.php at line 36] in /www/w/includes/GlobalFunctions.php on line 3342
Swap $this->context->request to $this->context->getRequest()
2011-06-17 10:07:40 +00:00