summaryrefslogtreecommitdiff
path: root/lib/action.php
diff options
context:
space:
mode:
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