summaryrefslogtreecommitdiff
path: root/lib/action.php
diff options
context:
space:
mode:
authorZach Copley <zach@controlyourself.ca>2009-02-11 23:07:49 -0800
committerZach Copley <zach@controlyourself.ca>2009-02-11 23:07:49 -0800
commit986068d6e7119e17509f228857d55873b34da28f (patch)
tree54cad05a538869185774ecc3bb8caf0772392e71 /lib/action.php
parent7155cf813de1502e796c0eac1e680289f3552c29 (diff)
parent616bdd43a921b2554d21b80af28ddb0fb6cb3c16 (diff)
Merge branch '0.7.x' into queuehandlers
Diffstat (limited to 'lib/action.php')
-rw-r--r--lib/action.php31
1 files changed, 31 insertions, 0 deletions
diff --git a/lib/action.php b/lib/action.php
index bd38bf79c..926fe93fb 100644
--- a/lib/action.php
+++ b/lib/action.php
@@ -82,6 +82,11 @@ class Action extends HTMLOutputter // lawsuit
*/
function prepare($argarray)
{
+
+ // For PEAR_Errors comming from DB_DataObject
+ PEAR::setErrorHandling(PEAR_ERROR_CALLBACK,
+ array($this, "handleError"));
+
$this->args =& common_copy_args($argarray);
return true;
}
@@ -845,6 +850,32 @@ class Action extends HTMLOutputter // lawsuit
}
/**
+ * Handle old fashioned PEAR_Error msgs coming from DB_DataObject
+ *
+ * Logs the DB_DataObject error. Override to do something else.
+ *
+ * @param PEAR_Error
+ *
+ * @return nothing
+ */
+
+ function handleError($error) {
+
+ common_log(LOG_ERR, "PEAR error: " . $error->getMessage());
+ $msg = sprintf(_('The database for %s isn\'t responding correctly, '.
+ 'so the site won\'t work properly. '.
+ 'The site admins probably know about the problem, '.
+ 'but you can contact them at %s to make sure. '.
+ 'Otherwise, wait a few minutes and try again.'),
+ common_config('site', 'name'),
+ common_config('site', 'email'));
+
+ $dac = new DBErrorAction($msg, 500);
+ $dac->showPage();
+ exit(-1);
+ }
+
+ /**
* Returns the current URL
*
* @return string current URL