예제 #1
0
 /**
  * Deletes the file
  * with predefined path (current request uri)
  *
  * @return void
  */
 public function delete()
 {
     if ($this->cacheFile && $this->cacheFile->isExists()) {
         $cacheDirectory = $this->cacheFile->getDirectory();
         $fileSize = $this->cacheFile->getFileSize();
         if (defined("FX_COMPOSITE_DEBUG")) {
             $backupName = $this->cacheFile->getPath() . ".delete." . microtime(true);
             if ($this->checkQuota()) {
                 AddMessage2Log($backupName, "composite");
                 $backupFile = new Main\IO\File($backupName);
                 $backupFile->putContents($this->cacheFile->getContents());
                 $this->writeStatistic(0, 0, 0, 0, $fileSize);
             } else {
                 AddMessage2Log($backupName . "(quota exceeded)", "composite");
             }
         }
         $this->cacheFile->delete();
         //Try to cleanup directory
         $children = $cacheDirectory->getChildren();
         if (empty($children)) {
             $cacheDirectory->delete();
         }
         //Update total files size
         $this->writeStatistic(0, 0, 0, 0, -$fileSize);
     }
 }