コード例 #1
0
ファイル: Disk.php プロジェクト: bluefission/DevElation
 public function activate()
 {
     $path = $this->config('location') ? $this->config('location') : sys_get_temp_dir();
     $name = $this->config('name') ? (string) $this->config('name') : '';
     if (!$this->config('name')) {
         $file = tempnam($path, 'store_');
     } else {
         $file = $path . DIRECTORY_SEPARATOR . $name;
     }
     $filesystem = new FileSystem(array('mode' => 'c+', 'filter' => 'file'));
     if ($filesystem->open($file)) {
         $this->_source = $filesystem;
     }
     if (!$this->_source) {
         $this->status(self::STATUS_FAILED_INIT);
     } else {
         $this->status(self::STATUS_SUCCESSFUL_INIT);
     }
 }
コード例 #2
0
ファイル: Log.php プロジェクト: bluefission/DevElation
 public function delete()
 {
     $destination = $this->config('file');
     $type = $destination ? $this->config('storage') : self::SYSTEM;
     if ($type == self::FILE && class_exists('FileSystem')) {
         $file_config = array('mode' => 'a');
         $messenger = new FileSystem($file_config);
         $messenger->file($destination);
         $messenger->delete();
         $status = $messenger->status();
         return true;
     }
     $this->status("Cannot delete log files with current settings.");
     return false;
 }