예제 #1
0
파일: File.php 프로젝트: clancats/core
 /**
  * Check if a session with the given key already exists
  *
  * @param string		$id		The session id key.
  * @param array 		$data
  * @return bool
  */
 public function write($id, $data)
 {
     if (!\CCFile::write($this->file_path($id), serialize($data))) {
         \CCError::exception(new Exception('Could not write session file.'));
     }
     return true;
 }
예제 #2
0
파일: Database.php 프로젝트: clancats/core
 /**
  * Check if a session with the given key already exists
  *
  * @param string		$id		The session id key.
  * @param array 		$data
  * @return bool
  */
 public function write($id, $data)
 {
     $columns = array();
     foreach ($this->index_fields as $field) {
         $columns[$field] = $data[$field];
         unset($data[$field]);
     }
     $columns['content'] = serialize($data);
     // When the session id didnt change we will do an update
     if ($id == $this->inital_session_id) {
         // because the we might already be in the shutdown process we
         // have to forward sql error directly to CCError
         try {
             \DB::update($this->table, $columns)->where('id', $id)->run($this->database);
         } catch (\Exception $e) {
             \CCError::exception($e);
         }
     } else {
         // add the id to the columns
         $columns['id'] = $id;
         // because the we might already be in the shutdown process we
         // have to forward sql error directly to CCError
         try {
             \DB::insert($this->table, $columns)->run($this->database);
         } catch (\Exception $e) {
             \CCError::exception($e);
         }
     }
 }
예제 #3
0
파일: wake.php 프로젝트: clancats/core
    // run error shutdown to catch possible errors
    if (class_exists("\\CCError")) {
        \CCError::shutdown();
    }
});
/*
 *---------------------------------------------------------------
 * exception handler
 *---------------------------------------------------------------
 * 
 * Register our handler for uncaught exceptions, so we can
 * handle them on our own.
 */
set_exception_handler(function (Exception $exception) {
    if (class_exists("\\CCError")) {
        \CCError::exception($exception);
    }
});
/*
 *---------------------------------------------------------------
 * exception handler
 *---------------------------------------------------------------
 *  
 * Register our error handler.
 */
set_error_handler(function ($level, $message, $file = null, $line = null) {
    if (class_exists("\\CCError")) {
        \CCError::error($level, $message, $file, $line);
    }
});
/*