Commit graph

33 commits

Author SHA1 Message Date
Kevin Israel
6949668b3d DBConnectionError: Expand {{SITENAME}} in pagetitle with Message::text()
Follows-up 485ff9ead9 by making the same change in DBConnectionError,
which overrides MWException::msg() to not use database messages.

Bug: 58447
Change-Id: Iafa9dd741f1f099a4a6cfb8cf655b7d5f504011a
2014-05-26 13:40:34 -04:00
Aaron Schulz
8c6fca60f2 Made DB errors go to the exception log again
* Some DB errors are caught while others bubble up to users.
  It is useful to log the latter separately and it also provides
  more context. The exception logs have a backtrace where as the
  regular DB logs do not.

Change-Id: I7ef7693d96e0258119f714e678099e4813ca0c94
2014-04-28 10:53:16 -07:00
umherirrender
f5f1e38b9a Fixed some @params documentation (includes/[db|installer])
Swapped some "$var type" to "type $var" or added missing types
before the $var. Changed some other types to match the more common
spelling. Makes beginning of some text in captial.
Also added some missing @param.

Change-Id: I3595e9aac69ac42fbb74b0783fae0ad9bcc831aa
2014-04-19 13:55:27 +02:00
Kevin Israel
d6a9f3a2f2 Hide message for DBUnexpectedError exceptions
DBUnexpectedErrors are now treated like most other exceptions; we now
hide the error messages (which could contain sensitive information
such as IP addresses) unless $wgShowExceptionDetails is true.

In that case, the messages (and redacted backtraces) would be shown
even if $wgShowDBErrorBacktrace is false, though hiding them would
add complexity to the exception handler for little benefit.

Bug: 26811
Change-Id: I063c241975ce5b12a04abc21821ac67c716b3d5e
2014-03-04 19:59:57 -05:00
Siebrand Mazeland
e22a70a103 Update documentation for database related classes
Change-Id: I364e192e2624f89a91dcb19e371ce3412142a95f
2014-01-06 19:45:40 +01:00
Chad Horohoe
03acc37723 Stop using the unholy trinity in DatabaseError
RequestContext::getMain() shifts the blame, but at least
it's one less place in core.

Change-Id: I36ffad0ff2703c3326690eef2c07ef66aa532210
2014-01-02 23:15:34 +01:00
Siebrand Mazeland
b547395796 Break long lines and formatting updates for includes/db/
Fix all line length related CodeSniffer warnings.

Change-Id: Id0fd8f4c7276185f51489659ee3cd06962fbc16d
2013-11-21 16:43:40 +00:00
Siebrand Mazeland
1e10dcd3aa Update formatting on database-related classes
Change-Id: I91f83e28ae25f80ba9e36c612f1ad050ffa1573c
2013-11-21 16:39:38 +00:00
Timo Tijhof
4468a46af2 exception: Use MWExceptionHandler::logException in more places
Most code replaced wasn't exactly like what logException does
but most probably should be.

A few implementation differences with the code it replaced in
various places:

* MWException if-guards
  Was there only to prevent a crash because getLogMessage is an
  MWException method. Now that logException is generic, it seems
  sensible to start logging those as well (follows-up a97f3550a0).

* Exception::getTraceAsString
  Now using MWExceptionHandler::formatRedactedTrace instead.
  It wasn't using it because that method didn't exist yet.

Notes:

* DatabaseError::getLogMessage
  Removed as this override was no longer doing anything (we're using
  MWExceptionHandler::getLogMessage instead of $e->getLogMessage).
  Introduced isLoggable() to take over the responsibility of indicating
  when an exception should not be logged (follows-up bcb9f9e1c0).

* DeferredUpdates and Wiki.php
  Both specificy MWException. Though ApiMain intends to catch all
  and only logged MWException because it couldn't otherwise, these
  actually only catch MWException (as opposed to catching all and
  having an if-statement inside). Left those as-is to have them
  continue propagate other exceptions.

* JobQueueFederated and JobQueueGroup
  All specify to catch JobQueueError only.
  Not sure whether it should catch other exceptions. It now can,
  but I'll leave it as is in case it intends to have those be
  handled elsewhere (or fatal).

Change-Id: I4578a0fe7d95a080f1a3b292ce7ae73a4d5fcaca
2013-10-30 15:46:35 -07:00
Timo Tijhof
2bcffe8be4 Exception: Clean up html document for error pages
Interface:
* Restore sitename as part of error page document title
  (follows-up 4ca9805). Moved to general Exception class as it
  is useful in general, this effectively changes the title from
  "This wiki has a problem" to "Internal error - Wikipedia".
* Added basic <style> to have it use a sans-serif font and a bit
  padding to offset it from the edge of the window.
* Output stacktrace in <pre> as-is (with linebreaks) instead of
  in a <p> with <br/>.

Clean up:
* Removed spurious "<!-- SiteSearch Google -->" comment.
* Change sitesearch radio button to not need the id/for
  attributes but simply nest them. Visual rendering and browser
  behaviour is identical.
* Renamed $text to $html since that is what it is (follows-up
  4ca9805 which reused that variable for html, it used to contain
  text).
* Remove odd linebreak from "dberr-problems" message, it was
  being output as-is in the html (html escaped, of course) and
  line breaks have no meaning inside an <h1> tag. Using a simple
  space instead. Visual rendering is identical.

Coding style:
* Using <!DOCTYPE html> instead of <!doctype html> for consistency
  with other documents we output.
* Switched a few inline #-style comments to use // instead.
* Switched a few strings from double quotes to single quotes in
  areas close to the changed code.

Change-Id: I33232d871200cbd23501c9a6c5f8a178931e135e
2013-10-30 21:52:49 +00:00
Kevin Israel
4ca98057ca Hide server IP addresses from DB error pages
Error details are now omitted if both $wgShowHostnames and
$wgShowSQLErrors are false. WMF wikis have the former set to true;
users of those wikis can still include the details in bug reports.

Fixing this for DBConnectionError was more or less straightforward.
However, in the case of DBQueryError, this involved splitting the
error message into multiple smaller messages (killing a raw HTML
message in the process).

Note that this is an incomplete fix: information disclosure is,
for now, still possible from DBUnexpectedError exceptions (are
these even supposed to go into the exception log?) or exceptions
that occur from within the exception handler. Yet this is still
an improvement.

Bug: 26811
Change-Id: I1756b296d5e8d1d22511a3c3b58b5bb0dd025fec
2013-09-03 16:55:52 -04:00
umherirrender
15abcf71ca Added/Removed spaces around string concatenation
And added/removed spaces around some other tokens,
like +, -, *, /, <, >, =, !

Fixed windows newline style

Change-Id: I0b9c8c408f3f6bfc0d685a074d7ec468fb848fc8
2013-04-13 13:36:24 +02:00
Platonides
2763191221 (Bug 42461) Remove call to "new Database()"
* Refactored LoadBalancer::reportConnectionError()
 * Removed PHP4-style reference from DatabaseError constructors
 * Allowed to not pass a database to the DBError family of exceptions.

Change-Id: If9570b45ea7285de2b8b2391e704bc01f76be48a
2013-03-18 13:49:44 +11:00
Tyler Anthony Romeo
4dcc7961df Fixed @param tags to conform with Doxygen format.
Doxygen expects parameter types to come before the
parameter name in @param tags. Used a quick regex
to switch everything around where possible. This
only fixes cases where a primitve variable (or a
primitive followed by other types) is the variable
type. Other cases will need to be fixed manually.

Change-Id: Ic59fd20856eb0489d70f3469a56ebce0efb3db13
2013-03-11 13:15:01 -04:00
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
f97a3a4027 fix some spacing
Change-Id: I670a7baf3ba1e70d18346bb00938d518ba2063bd
2013-02-04 19:59:14 +00:00
umherirrender
2e8da558ba fix some spacing
Change-Id: Id7eda67a43f9040117edd79fdbeb678f1c3a6da2
2013-01-26 22:11:09 +01:00
Alex Monk
2fabea7eea Use wfMessage instead of deprecated wfMsg*
Or $this->msg in special pages.

Change-Id: I774a89d646615053c8424050e42ad95601f92543
2012-08-18 14:11:05 +02:00
Timo Tijhof
3b073fa356 (bug 37138) Fix broken Google sitesearch in DatabaseError
Change-Id: I31dc64f83ce8767dcdd84597844b0819840f60e1
2012-06-05 19:47:17 +02:00
Alexandre Emsenhuber
78a56a67ba Added missing GPLv2 headers in includes/db.
Change-Id: Ib8fe301c6db77603e411113cea5a39c25c664961
2012-04-26 10:47:10 +02:00
Antoine Musso
94bec8ef57 rv r87948 "fix backtrace on SQL error"
Looks unneeded nowaday. Backtrace is correctly appended to HTML output
or CLI output when $wgShowDBErrorBacktrace is true.

Not sure what it was supposed to fix.
2012-01-30 17:36:43 +00:00
Sam Reed
5bfce03820 More documentation of parameters following up r104591 2011-12-05 16:50:58 +00:00
Sam Reed
39356de1a4 Moar documentations 2011-11-29 21:04:20 +00:00
Sam Reed
bc469ac405 Followup r102910
Make the link to the MW page https only
2011-11-14 10:34:23 +00:00
Sam Reed
f00be48ae3 Bug 32379 - DatabaseError.php is hardcoding http
Also tidy up a couple of returns (per others in method, and/or parents)
2011-11-13 21:42:57 +00:00
Aaron Schulz
5214c4f073 * Let HTMLFileCache constructor take in a Title *or* a the prefixed dbkey itself.
* Tweaked filecache fallback in fileCachedPage() to try the raw title param. If the DB is down, we can get most views of titles with colons in them to work this way. Previously, it could fail on an interwiki lookup.
2011-11-02 20:01:22 +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
Sam Reed
4d8c6dee24 Moar documentations 2011-09-16 17:58:50 +00:00
Alexandre Emsenhuber
19c5d5e595 * Removed usage of error suppression operator in includes/db
* Changed an usage of $_REQUEST to $wgRequest
2011-07-04 15:00:30 +00:00
Alexandre Emsenhuber
f722920ee0 Fix for r86722: pass the message 'dberrortext' unescaped to the output since it contains. I really don't like to pass unescaped messages to the output *sigh* 2011-06-23 18:42:51 +00:00
Sam Reed
51a0d53758 More documentation stuffs 2011-05-25 18:58:02 +00:00
Sam Reed
6fac268c19 Documentation 2011-05-25 18:41:31 +00:00
Sam Reed
6bb0325f52 Move DB(.*?)Error classes into own file
Updated AutoLoader to match
2011-05-25 17:03:15 +00:00