]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - lib/framework.php
Merge from 1.0.x
[quix0rs-gnu-social.git] / lib / framework.php
index 05a8b7abda7728d8195da5167cbd34dfe4c2c4c0..8f5cdf31c648a7a1b0da12128493d9f91b165689 100644 (file)
@@ -151,6 +151,23 @@ function PEAR_ErrorToPEAR_Exception($err)
     if ($err->getCode() == DB_DATAOBJECT_ERROR_NODATA) {
         return;
     }
+
+    $msg      = $err->getMessage();
+    $userInfo = $err->getUserInfo();
+
+    // Log this; push the message up as an exception
+
+    common_log(LOG_ERR, "PEAR Error: $msg ($userInfo)");
+
+    // HACK: queue handlers get kicked by the long-query killer, and 
+    // keep the same broken connection. We die here to get a new
+    // process started.
+
+    if (php_sapi_name() == 'cli' && preg_match('/nativecode=2006/', $userInfo)) {
+        common_log(LOG_ERR, "Lost DB connection; dying.");
+        exit(100);
+    }
+
     if ($err->getCode()) {
         throw new PEAR_Exception($err->getMessage(), $err->getCode());
     }