Esempio n. 1
0
 public function __destruct()
 {
     try {
         FileUtils::removeDirectory($this->path, true);
     } catch (BaseException $e) {
         // boo! deal with garbage yourself.
     }
 }
 public function drop()
 {
     // removed, but not created yet
     if (!is_writable($this->path)) {
         return true;
     }
     $toRemove = realpath($this->path) . '.' . microtime(true) . getmypid() . '.' . '.removing';
     try {
         rename($this->path, $toRemove);
     } catch (BaseException $e) {
         // already removed during race
         return true;
     }
     FileUtils::removeDirectory($toRemove, true);
     return true;
 }
Esempio n. 3
0
 /**
  * @return RubberFileSystem
  **/
 public function clean()
 {
     // just to return 'true'
     FileUtils::removeDirectory($this->directory, true);
     return parent::clean();
 }
Esempio n. 4
0
 public function __construct($directory = '/temp-garbage/', $prefix = 'TmpFile')
 {
     $this->path = FileUtils::makeTempFile($directory, $prefix);
 }