Пример #1
0
 /**
  * Notifying shop owner about connection problems
  *
  * @param ADOConnection $oDb database connection instance
  */
 protected function _notifyConnectionErrors($oDb)
 {
     // notifying shop owner about connection problems
     if ($sAdminEmail = self::_getConfigParam('_sAdminEmail')) {
         $sFailedShop = isset($_REQUEST['shp']) ? addslashes($_REQUEST['shp']) : 'Base shop';
         $sDate = date('l dS of F Y h:i:s A');
         $sScript = $_SERVER['SCRIPT_NAME'] . '?' . $_SERVER['QUERY_STRING'];
         $sReferer = $_SERVER['HTTP_REFERER'];
         //sending a message to admin
         $sWarningSubject = 'Offline warning!';
         $sWarningBody = "\n                Database error in OXID eShop:\n                Date: {$sDate}\n                Shop: {$sFailedShop}\n\n                mysql error: " . $oDb->errorMsg() . "\n                mysql error no: " . $oDb->errorNo() . "\n\n                Script: {$sScript}\n                Referer: {$sReferer}";
         $this->_sendMail($sAdminEmail, $sWarningSubject, $sWarningBody);
     }
     //only exception to default construction method
     $oEx = new oxConnectionException();
     $oEx->setMessage('EXCEPTION_CONNECTION_NODB');
     $oEx->setConnectionError(self::_getConfigParam('_dbUser') . 's' . getShopBasePath() . $oDb->errorMsg());
     throw $oEx;
 }