svn: /web/php-bugs/trunk/include/ functions.php prepend.php
| From: | Philip Olson | Date: | Wed, 10 Mar 2010 02:50:15 +0000 |
| Subject: | svn: /web/php-bugs/trunk/include/ functions.php prepend.php | ||
| Groups: | php.webmaster | ||
| Request: | Send a blank email to php-webmaster+get-7546@lists.php.net to get a copy of this message | ||
philip Wed, 10 Mar 2010 02:50:15 +0000
Revision: http://svn.php.net/viewvc?view=revision&revision=296011
Log:
Handle PEAR errors, in a moderately graceful manner
Changed paths:
U web/php-bugs/trunk/include/functions.php
U web/php-bugs/trunk/include/prepend.php
Modified: web/php-bugs/trunk/include/functions.php
===================================================================
--- web/php-bugs/trunk/include/functions.php 2010-03-09 21:49:33 UTC (rev 296010)
+++ web/php-bugs/trunk/include/functions.php 2010-03-10 02:50:15 UTC (rev 296011)
@@ -1630,3 +1630,17 @@
$text
);
}
+
+function handle_pear_errors ($error_obj)
+{
+ response_header("Oops! We are sorry that you are unable to report an undocumented feature
today.");
+
+ $error = "<p>Greetings! We are experiencing an error, and in the spirit of Open Source
would like you to fix it. ";
+ $error .= "Or more likely, just wait and someone else will find and solve
this.</p>\n";
+ $error .= "<p>It's our guess that the database is down. Argh!!!</p>\n";
+
+ // FIXME: If logged in, show other stuff....
+
+ response_footer($error);
+ exit;
+}
Modified: web/php-bugs/trunk/include/prepend.php
===================================================================
--- web/php-bugs/trunk/include/prepend.php 2010-03-09 21:49:33 UTC (rev 296010)
+++ web/php-bugs/trunk/include/prepend.php 2010-03-10 02:50:15 UTC (rev 296011)
@@ -37,9 +37,16 @@
define('BUG_PATCHTRACKER_TMPDIR', $site_data['patch_tmp']);
define('DATABASE_DSN',
"{$site_data['db_extension']}://{$site_data['db_user']}:{$site_data['db_pass']}@{$site_data['db_host']}/{$site_data['db']}");
+/**
+ * Obtain the functions and variables used throughout the bug system
+ */
+require_once "{$ROOT_DIR}/include/functions.php";
+
// Database connection (required always?)
include_once 'MDB2.php';
+PEAR::setErrorHandling(PEAR_ERROR_CALLBACK, 'handle_pear_errors');
+
if (empty($dbh))
{
$dbh = MDB2::factory(DATABASE_DSN);
@@ -50,7 +57,3 @@
$tmp = filectime($_SERVER['SCRIPT_FILENAME']);
$LAST_UPDATED = date('D M d H:i:s Y', $tmp - date('Z', $tmp)) . '
UTC';
-/**
- * Obtain the functions and variables used throughout the bug system
- */
-require_once "{$ROOT_DIR}/include/functions.php";