Esempio n. 1
0
 /**
  * {@inheritdoc}
  */
 public function remove($files)
 {
     $files = iterator_to_array($this->toIterator($files));
     $files = array_reverse($files);
     $n = 0;
     foreach ($files as $file) {
         $fileInfo = new SplFileInfo($file, $this->fs);
         if (!$fileInfo->isWritable() && !$fileInfo->isLink()) {
             continue;
         }
         $pattern = '/^' . preg_quote(rtrim($file, '/'), '/') . '/';
         $result = $this->fs->remove(array('filename' => new \MongoRegex($pattern)));
         // $n += $result['n'];
         if ($result['n'] < 1) {
             throw new IOException(sprintf('Failed to remove file or directory %s', $file));
         }
     }
     // if ($n < 1) {
     //     throw new IOException(sprintf('Failed to remove directory %s', $file));
     // }
 }