Commit graph

59 commits

Author SHA1 Message Date
Happy-melon
068f89d108 Follow-up r85918:
* Clean up the ugly adding-then-removing-then-readding HTML <head> and <body> tags in DBConnectionError, deprecates MWException::htmlBodyOnly()
* Also deprecates MWException::htmlHeader(), removes code duplication since MWException::reportHTML() can safely call wfDie() and get an output format appropriate for the entry point
* Copy a couple of HTML headers (Cache-control, Pragma and Content-type) to the wfDie() implementation.
2011-05-07 14:01:49 +00:00
Happy-melon
84f048c68a (bug 28834) Restore nl2br() wrappers removed in r85918. 2011-05-07 13:24:47 +00:00
Sam Reed
15df9a9d5c Kill off the long deprecated $wgInputEncoding and $wgOutputEncoding globals 2011-05-06 22:09:47 +00:00
Alexandre Emsenhuber
5b1ecf951f * Use wfMsgNoTrans() instead of wfMsgReal()
* Simplify getPageTitle()
* Remove a useless call to getPageTitle(), <img> tag does not have content
2011-04-24 16:53:46 +00:00
Happy-melon
f144bcfb6b Add ThrottledError to throw when the user hits a rate limit. 2011-04-18 22:29:23 +00:00
Happy-melon
72feb39457 Unbundle OutputPage::showErrorPage() in Exception.php to allow ErrorPageError objects to be passed a Message object for a more complicated display. 2011-04-13 22:30:13 +00:00
Happy-melon
47e3f922da Implement user-is-blocked and wiki-is-read-only as exceptions. 2011-04-13 14:30:55 +00:00
Happy-melon
2e1e9bf0e6 allow methods to generate a "user does not have required permissions" error by throwing an exception rather than calling $wgOut->permissionRequired(). Currently somewhat circular as the exception goes back to OutputPage::showErrorPage(), but hopefully that global dependency can be reduced in future. 2011-04-12 22:59:17 +00:00
Happy-melon
938a8eb347 Improvements to handling of 'catastrophic' errors, like unsupported PHP versions, no MySQL functions, no LocalSettings, etc.
* Fix parsing of the three major entry points (index.php, api.php, load.php) back to PHP 4.4.9.  We don't care what happens if you actually try to run these files on old versions, but the entry files need to parse correctly.
* consign /includes/templates/PHP4.php and /includes/templates/NoLocalSettings.php to the fiery pit of hell where they belong.
* Prevent loading of any other files for PHP < 5.  WebStart.php was rendered unparseable in PHP 4 by the introduction of try/catch blocks in r85327.
* Die outright with a pretty error message on PHP < 5.2.3 as well as PHP 4.  All versions of PHP below that throw parse errors of various sorts.
* Reimplement wfDie() to provide an entry-point-dependent die-with-readable-error-message function (for instance, we want a pretty human-readable page in index.php, something wrapped in CSS/JS /*...*/ comment block in load.php, etc).  
* Standardise the appearance of the catastrophic errors thrown at the top of the stack with the ones lower down (exception-within-exception, etc).  There isn't really a way to do this without duplication, AFAICT.
2011-04-12 20:38:16 +00:00
Niklas Laxström
c16556dd84 Partial revert of r79903, unstubbing needs localisation cache which might need database 2011-01-09 18:31:52 +00:00
Niklas Laxström
8b32822137 Follow-up r79880: check if $wgLang can be used.
Changed the checks in Database.php to use is_object because of stub objects
2011-01-09 17:08:40 +00:00
Niklas Laxström
111a166e01 * (bug 26638) Database error pages display correctly in RTL languages 2011-01-09 10:36:13 +00:00
Alexandre Emsenhuber
f3aa97bd5f Fix for r33432: isArticle() is to check if the content displayed is the one of the article, isArticleRelated() is more appropriate here 2011-01-08 19:21:37 +00:00
Platonides
6e81d60086 Fix potential html injection when the database server isn't available (bug 26164).
Wikis which set $wgServer in their LocalSettings or are in a virtual
host would never be vulnerable.
For sites which show the wiki in the default host, it will depend on how
forgiving is their webserver and php stack for that garbled input, although 
some kind of foolable proxy —moreover wrongly caching errors (or the default 
output buffering is disabled and something incorrectly sent a previous text)—
would also need to be present in order to make that useful for a 
potential attacker.
2010-11-29 16:34:28 +00:00
Sam Reed
39c005ca79 bug 25517 Assignment in conditions should be avoided/ http://www.mediawiki.org/wiki/Manual:Coding_conventions#Assignment_expressions 2010-11-01 00:07:17 +00:00
Alexandre Emsenhuber
7e995c96f7 Added wfDeprecated() to wfAbruptExit() and wfErrorExit() and removed a comment that mentioned it 2010-10-03 08:42:38 +00:00
Siebrand Mazeland
64fdb18e74 More whitespace updates for files touched in r72342:
* stylize.php run
* code formatting updates
* updated a few comments
* added braces where not used
2010-09-04 13:48:16 +00:00
Mark A. Hershberger
5dbbca7331 w/s changes 2010-09-04 01:06:34 +00:00
Alexandre Emsenhuber
5be509b0c1 * Standardised file description headers
* Added some descriptions
* Added @file where needed
2010-08-08 14:23:14 +00:00
Alexandre Emsenhuber
5f62d63483 Added a note to set $wgShowExceptionDetails = true; in LocalSettings.php to get details when encoutring an second exception in the exception handler 2010-08-07 18:32:39 +00:00
Sam Reed
04f68827d0 Removal of unused globals
Removal of one setting of a variable to '', then not using further
2010-07-24 19:11:52 +00:00
Alexandre Emsenhuber
ebe3cb7362 Fixed some doxygen warnings 2010-03-05 21:39:21 +00:00
Tim Starling
1f79ae389d * Re-added $wgMessageCache->addMessages(), there are still some extensions (in and out of subversion) that rely on it. Call wfDeprecated().
* Made wfDeprecated() issue a notice only once for each function name instead of every time the function is called.
* Added exceptions for malformed keys input to $wgMessageCache->get(), per CR comments on r52503
* Fixed notice from MWException::useMessageCache()
2009-07-03 06:19:39 +00:00
Andrew Garrett
160936a8dd Revert unintended core changes in r52627 2009-07-01 17:48:30 +00:00
Andrew Garrett
ca329c7acb Bring up reply and new thread forms with AJAX where available. Still submits with a regular POST, because I've just spent a day on AJAX and that would be at least another day or two. 2009-07-01 17:46:35 +00:00
Tim Starling
23cfebd3d2 * Introduced a new system for localisation caching. The system is based around fast fetches of individual messages, minimising memory overhead and startup time in the typical case. It handles both core messages (formerly in Language.php) and extension messages (formerly in MessageCache.php). Profiling indicates a significant win for average throughput.
* The serialized message cache, which would have been redundant, has been removed. Similar performance characteristics can be achieved with $wgLocalisationCacheConf['manualRecache'] = true;
* Added a maintenance script rebuildLocalisationCache.php for offline rebuilding of the localisation cache.
* Extension i18n files can now contain any of the variables which can be set in Messages*.php. It is possible, and recommended, to use this feature instead of the hooks for special page aliases and magic words. 
* $wgExtensionAliasesFiles, LanguageGetMagic and LanguageGetSpecialPageAliases are retained for backwards compatibility. $wgMessageCache->addMessages() and related functions have been removed. wfLoadExtensionMessages() is a no-op and can continue to be called for b/c. 
* Introduced $wgCacheDirectory as a default location for the various local caches that have accumulated. Suggested $IP/cache as a good place for it in the default LocalSettings.php and created this directory with a deny-all .htaccess.
* Patched Exception.php to avoid using the message cache when an exception is thrown from within LocalisationCache, since this tends to fail horribly.
* Removed Language::getLocalisationArray(), Language::loadLocalisation(), Language::load()
* Fixed FileDependency::__sleep()
* In Cdb.php, fixed newlines in debug messages

In MessageCache::get(): 
* Replaced calls to $wgContLang capitalisation functions with plain PHP functions, reducing the typical case from 99us to 93us. Message cache keys are already documented as being restricted to ASCII.
* Implemented a more efficient way to filter out bogus language codes, reducing the "foo/en" case from 430us to 101us
* Optimised wfRunHooks() in the typical do-nothing case, from ~30us to ~3us. This reduced MessageCache::get() typical case time from 93us to 38us.
* Removed hook MessageNotInMwNs to save an extra 3us per cache hit. Reimplemented the only user (LocalisationUpdate) using the new hook LocalisationCacheRecache.
2009-06-28 07:11:43 +00:00
Alexandre Emsenhuber
7248906455 * (bug 18289) Database connection error page now returns correct HTML
Changed MWException::htmlHeader() and MWException::htmlFooter() to return the HTML rather than echo()'ing directly
2009-04-02 20:38:25 +00:00
Aaron Schulz
fcd22b9a84 More visual and xhtml fixes for file cache failback 2009-03-14 03:16:05 +00:00
Aaron Schulz
6cd1a1b1d9 * Avoid double output on filecache failover
* XHTML fixes to error html
* Added isDisabled() to OutputPage
* Make sure filecache marks output done
2009-03-13 20:15:16 +00:00
Chad Horohoe
f699e1d5e0 Fix spacing properly this time. 2009-02-17 21:14:34 +00:00
Chad Horohoe
114dea20cb (bug 17506) Respect $wgShowExceptionDetails when handling exceptions within exceptions. Based on patch by David Tabachnikov and Romi Romano5. 2009-02-16 04:33:22 +00:00
Tim Starling
4124558d7b For backport to 1.14.
* Made the upgrader work with SQLite
* Implemented missing schema info functionality in DatabaseSqlite
* Merged the SQLite and MySQL schemas into the one file with the help of some replaceVars() hacks.
* Moved all primary key definitions to the field definition, moved all indexes to CREATE INDEX statements, for best SQLite compatibility.
* Made all autoincrement fields primary keys, as required by SQLite.
* Removed meaningless buzzword from the category table comment
* tables.sql: s/'0'/0/
* In SQLite the index names have DB scope. Renamed archive.usertext_timestamp, user_newtalk.user_id, user_newtalk.user_ip
* SQLite does not support UPDATE with LIMIT by default. Removed all instances I could find.
* Made query errors work in the installer.
* Fixed DatabaseSqlite::lastErrno(), made SQLITE_SCHEMA errors automatically reissue the query as suggested on sqlite-users. Otherwise upgrade breaks.
* Removed miscellaneous status information from getServerVersion(), that's not the place to put it
2009-01-15 06:56:58 +00:00
Brion Vibber
5fe9c4363e * Safer handling of non-MediaWiki exceptions -- now obeys our settings for formatting and path exposure.
Applying Tim's fixes...
2008-11-17 18:51:21 +00:00
Tim Starling
9f84a2fe83 Log exceptions encountered in api.php. Check for null $wgRequest. 2008-09-21 09:38:55 +00:00
Daniel Kinzler
43548021de bug #15602: use echo for error messages if STDERR is undefined 2008-09-15 09:53:52 +00:00
Tim Starling
350b498b9f * Revert back to my parser pseudo-branch again. Note: if you feel like reverting this, reverting Parser.php alone to r40010 will work just fine.
* Merged replaceFreeExternalLinks() with doMagicLinks(). Makes a lot of sense, very similar operations, doesn't break any parser tests. Stops free links from interacting with other parser stages, the same way ISBN links don't. 
* The pass order change fixes Brion's complaint in r39980. Early link expansion, triggered by having more than 1000 links in the page, was outputting URLs which were destroyed by RFEL. Added parser test.
* Fixed an unrelated bug in LinkHolderArray::replace(): if a link to a redirect appears in two separate RLH calls, the second and subsequent calls do not add the mw-redirect class. Caused by an unmigrated LinkCache fetch.
* Added a parser test for a pass interaction bug that the pass order change fixes.
* The fuzzer told me to tell you that free external links in non-caption image parameters, which are and have always been invisible, are now not registered either.
* Miscellaneous supporting updates to the test infrastructure.
2008-08-26 14:37:15 +00:00
Aryeh Gregor
650be91fb8 Refactor a bit preparatory to fixing bug 8068: rewrite the robot policy stuff in OutputPage to allow index and follow policy to be set separately. Also now validates input to setRobotPolicy(). And renamed setRobotpolicy to setRobotPolicy, too. If anyone was accessing $mRobotpolicy directly they're out of luck, though. 2008-07-23 19:05:43 +00:00
Tim Starling
d6f0a95465 * Split off DB load monitoring logic into a LoadMonitor class hierarchy, to allow for plugins in this area.
* Use an associative array to initialise LoadBalancer objects
* By default, use Preprocessor_DOM if available, otherwise use Preprocessor_Hash. Preprocessor_Hash has worse performance.
* Fix parserTests.php for replicated databases. Use CREATE TABLE instead of CREATE TEMPORARY TABLE if there is more than one server configured.
* Log exceptions even in command-line mode.
2008-07-07 03:31:00 +00:00
Alexandre Emsenhuber
087a9f70c5 WARNING: HUGE COMMIT
Doxygen documentation update:
* Changed alls @addtogroup to @ingroup. @addtogroup adds the comment to the group description, but doesn't add the file, class, function, ... to the group like @ingroup does. See for example http://svn.wikimedia.org/doc/group__SpecialPage.html where it's impossible to see related files, classes, ... that should belong to that group.
* Added @file to file description, it seems that it should be explicitely decalred for file descriptions, otherwise doxygen will think that the comment document the first class, variabled, function, ... that is in that file.
* Removed some empty comments
* Removed some ?>

Added following groups:
* ExternalStorage
* JobQueue
* MaintenanceLanguage

One more thing: there are still a lot of warnings when generating the doc.
2008-05-20 17:13:28 +00:00
Tim Starling
f829fe210f Maybe you missed the difference between getHTML and getText... One returns HTML, and one returns text. 2008-05-06 02:50:07 +00:00
Alexandre Emsenhuber
6784414bbd Allow $wgArticle to be null on special pages 2008-04-16 16:17:44 +00:00
Siebrand Mazeland
79d5225c0e * remove end of line whitespace
* remove empty lines at end of file
* remove "?>" where still present
2008-04-14 07:45:50 +00:00
Alexandre Emsenhuber
e59670fa15 * Document Exception.php
* Pass $wgArticle by reference in MediaWiki::initialize() so that it can be set before executing an action and can be used when throwing an exception.
2008-03-21 16:56:44 +00:00
Victor Vasiliev
08aec83eb9 * Add exception hooks to output pretty messages
* Also, there's an example of such extension
2008-01-08 18:34:06 +00:00
Aryeh Gregor
72736d11d4 Make it a little clearer in the code that we aren't using STDERR outside command-line mode, by inlining a one-line function that was only called once in the code base. 2007-12-07 04:21:35 +00:00
Brion Vibber
60c13d2853 * (bug 12184) Exceptions now sent to stderr instead of stdout for command-line
scripts, making for cleaner reporting during batch jobs. PHP errors will also
  be redirected in most cases on PHP 5.2.4 and later, switching 'display_errors'
  to 'stderr' at runtime.
2007-12-06 21:07:49 +00:00
Aryeh Gregor
f7325842bc Clarify instructions given when an exception is thrown and is off, to state that the change needs to go at the bottom. 2007-09-30 00:19:43 +00:00
Aryeh Gregor
a15c419b3d Remove ?>'s from files. They're pointless, and just asking for people to mess with the files and add trailing whitespace. (Yes, I looked over every one and reverted those that were bogus. Slash-enter a million times in less worked well enough, although it was a bit mind-numbing.) 2007-06-29 01:19:14 +00:00
Antoine Musso
16558d1dbc Added some comments to our classes. 2007-04-21 12:42:27 +00:00
Nick Jenkins
f9619da3f0 Yet more doc tweaks:
* Add @addtogroup tags to various classes, to try and group conceptually-related classes together.
* Add brief descriptions to various Special pages, thanks to Phil Boswell.
* Moving some docs to be right above the classes they represent, so that they are picked up.
2007-04-20 08:55:14 +00:00