コード例 #1
0
ファイル: Logger.php プロジェクト: agentmedia/phine-core
 /**
  * Deletes log items older then the given amount of days
  * @param int $days The days
  */
 private function DeleteOldLogItems()
 {
     $days = SettingsProxy::Singleton()->Settings()->GetLogLifetime();
     $deleteBefore = Date::Now();
     $deleteBefore->AddDays(-$days);
     $tblLogItem = LogItem::Schema()->Table();
     $sql = Access::SqlBuilder();
     $where = $sql->LT($tblLogItem->Field('Changed'), $sql->Value($deleteBefore));
     LogItem::Schema()->Delete($where);
 }
コード例 #2
0
 /**
  * The last log item that is directly related to the template
  * @param Content $content The content
  * @return LogItem Returns the log item
  */
 static function LastTemplateLog($moduleType, $template)
 {
     $tblLogTemplate = \Phine\Database\Core\LogTemplate::Schema()->Table();
     $tblLogItem = LogItem::Schema()->Table();
     $sql = Access::SqlBuilder();
     $orderBy = $sql->OrderList($sql->OrderDesc($tblLogItem->Field('Changed')));
     $joinCond = $sql->Equals($tblLogTemplate->Field('LogItem'), $tblLogItem->Field('ID'));
     $where = $sql->Equals($tblLogTemplate->Field('Template'), $sql->Value($template))->And_($sql->Equals($tblLogTemplate->Field('ModuleType'), $moduleType));
     return LogItem::Schema()->First($where, $orderBy, null, $sql->Join($tblLogTemplate), JoinType::Inner(), $joinCond);
 }