コード例 #1
0
 public static function singleton()
 {
     if (self::$instancia == null) {
         self::$instancia = new self();
     }
     return self::$instancia;
 }
コード例 #2
0
ファイル: Email.php プロジェクト: yonkon/diplom
 public function send()
 {
     parent::Send();
     if ($this->IsError()) {
         ErrorLogger::add('email', 'Email sending failed', $this->ErrorInfo);
         return false;
     }
     return true;
 }
コード例 #3
0
 /**
  * Delete node
  *
  * @param integer $leftKey
  * @param integer $rightKey
  * @param array $filter
  * @param boolean $useTransaction
  * @return boolean|string
  */
 public function deleteNode($leftKey, $rightKey, array $filter = [], $useTransaction = true)
 {
     try {
         if ($useTransaction) {
             $this->tableGateway->getAdapter()->getDriver()->getConnection()->beginTransaction();
         }
         $predicate = new Predicate();
         $this->tableGateway->delete([$predicate->greaterThanOrEqualTo($this->left, $leftKey), $predicate->lessThanOrEqualTo($this->right, $rightKey)] + $filter);
         $predicate = new Predicate();
         $this->tableGateway->update([$this->left => new Expression('IF(' . $this->left . ' > ?, ' . $this->left . ' - (? - ? + 1), ' . $this->left . ')', [$leftKey, $rightKey, $leftKey]), $this->right => new Expression($this->right . ' - (? - ? + 1)', [$rightKey, $leftKey])], [$predicate->greaterThan($this->right, $rightKey)] + $filter);
         if ($useTransaction) {
             $this->tableGateway->getAdapter()->getDriver()->getConnection()->commit();
         }
     } catch (Exception $e) {
         if ($useTransaction) {
             $this->tableGateway->getAdapter()->getDriver()->getConnection()->rollback();
         }
         ErrorLogger::log($e);
         return $e->getMessage();
     }
     return true;
 }
コード例 #4
0
ファイル: ErrorLogger.php プロジェクト: yonkon/diplom
 public static function exception_handler($exception)
 {
     if (isset($exception->xdebug_message)) {
         $error_string = '<pre>' . $exception->xdebug_message . '</pre>';
     } else {
         $error_string = "<b>Uncaught exception:</b> " . $exception->getMessage() . "<br/>Trace path:<br/>";
         foreach ($exception->getTrace() as $arr_error) {
             $file = '`Can`t detect file`';
             if (isset($arr_error['file'])) {
                 $file = $arr_error['file'];
             }
             $line = '`Can`t detect line`';
             if (isset($arr_error['line'])) {
                 $line = $arr_error['line'];
             }
             $class = '`Can`t detect class`';
             if (isset($arr_error['class'])) {
                 $class = $arr_error['class'];
             }
             $function = '`Can`t detect function`';
             if (isset($arr_error['function'])) {
                 $function = $arr_error['function'];
             }
             $error_string .= "<b>" . $file . "</b>, method <b>" . $function . "</b> of class <b>" . $class . "</b>, line <b>" . $line . "</b><br/>";
         }
     }
     echo $error_string;
     ErrorLogger::send_email('Error report', $error_string, '', 'ERS_ERROR_TYPE_ERROR');
     exit;
 }
コード例 #5
0
ファイル: class.System.php プロジェクト: psigcat/solutionsdb
 public function imprError($err)
 {
     try {
         if (!class_exists('ErrorLogger')) {
             throw new Exception("clase ErrorLogger no existe");
         } else {
             $this->_logger = ErrorLogger::singleton();
             if ($err == "") {
                 throw new Exception("Error está vacio");
             } else {
                 $this->_logger->imprError($err);
             }
         }
     } catch (Exception $e) {
         switch ($e->getMessage()) {
             case "clase ErrorLogger no existe":
                 //no hagas nada, no hay handler de errores
                 //	echo "no hay clase";
                 break;
             case "Error está vacio":
                 //no hagas nada, no hay handler error
                 $this->_logger->imprError("Error está vacio");
                 break;
         }
     }
 }
コード例 #6
0
 private function __construct()
 {
     ExceptionLogger::initialize();
     ErrorLogger::initialize();
 }