示例#1
0
 public static function getInstance()
 {
     if (self::$instance === null) {
         self::$instance = new self();
     }
     return self::$instance;
 }
 /**
  * @return Gpf_SqlBuilder_SelectBuilder
  */
 private function createLogsSelect($groupId) {
     $select = new Gpf_SqlBuilder_SelectBuilder();
     $select->select->add(Gpf_Db_Table_Logs::MESSAGE);
     $select->from->add(Gpf_Db_Table_Logs::getName());
     $select->where->add(Gpf_Db_Table_Logs::GROUP_ID, '=', $groupId);
     $select->orderBy->add(Gpf_Db_Table_Logs::ID);
     return $select;
 }
 private function deleteEvents()
 {
     $delete = new Gpf_SqlBuilder_DeleteBuilder();
     $delete->from->add(Gpf_Db_Table_Logs::getName());
     $delete->where->add(Gpf_Db_Table_Logs::CREATED, '<', $this->getLastDate(Gpf_Settings::get(Gpf_Settings_Gpf::AUTO_DELETE_EVENTS))->toDateTime());
     $delete->limit->set('', Gpf_Log_DeleteTaskBase::DELETE_LIMIT);
     return $delete->delete();
 }
示例#4
0
 /**
  *
  * @service log delete
  * @param none
  * @return Gpf_Rpc_Action
  */
 public function deleteDebugEvents(Gpf_Rpc_Params $params)
 {
     $action = new Gpf_Rpc_Action($params);
     $action->setInfoMessage($this->_("Debug event(s) are deleted"));
     $action->setErrorMessage($this->_("No debug event(s) to delete"));
     $delete = new Gpf_SqlBuilder_DeleteBuilder();
     $delete->from->add(Gpf_Db_Table_Logs::getName());
     $delete->where->add(Gpf_Db_Table_Logs::LEVEL, "=", self::LOG_DEBUG);
     try {
         $delete->execute();
         $action->addOk();
     } catch (Gpf_DbEngine_NoRowException $e) {
         $action->addError();
     }
     return $action;
 }
示例#5
0
 public static function isLoggerInsert($sqlString)
 {
     return strpos($sqlString, 'INSERT INTO ' . Gpf_Db_Table_Logs::getName()) !== false;
 }
示例#6
0
 protected function buildFrom()
 {
     $this->_selectBuilder->from->add(Gpf_Db_Table_Logs::getName());
 }
示例#7
0
 function init()
 {
     $this->setTable(Gpf_Db_Table_Logs::getInstance());
     parent::init();
 }