예제 #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);
     }
 }
예제 #2
0
 public function finish()
 {
     foreach ($this->partList as $key => $partName) {
         $f = new File(Path::combine($this->getDirectoryName(), $partName));
         $f->rename(str_replace($this->getPrefix(), '', $f->getPath()));
         $this->partList[$key] = $f->getName();
     }
     if ($this->isCurrentPartNotEmpty()) {
         $this->addFooter();
         $this->rename(str_replace($this->getPrefix(), '', $this->getPath()));
     }
 }
예제 #3
0
 protected function getFileUrl(File $f)
 {
     static $arIndexNames;
     if (!is_array($arIndexNames)) {
         $arIndexNames = GetDirIndexArray();
     }
     if (substr($this->path, 0, strlen($this->documentRoot)) === $this->documentRoot) {
         $path = '/' . substr($f->getPath(), strlen($this->documentRoot));
     }
     $path = Path::convertLogicalToUri($path);
     $path = in_array($f->getName(), $arIndexNames) ? str_replace('/' . $f->getName(), '/', $path) : $path;
     return '/' . ltrim($path, '/');
 }