コード例 #1
0
 protected function tearDown()
 {
     $this->repo->cleanupBatch($this->createdFiles);
     // delete files
     foreach ($this->createdFiles as $tmp) {
         // delete dirs
         $tmp = $this->repo->resolveVirtualUrl($tmp);
         while ($tmp = FileBackend::parentStoragePath($tmp)) {
             $this->repo->getBackend()->clean(array('dir' => $tmp));
         }
     }
     parent::tearDown();
 }
コード例 #2
0
 /**
  * @dataProvider provider_testParentStoragePath
  */
 public function testParentStoragePath($path, $res)
 {
     $this->assertEquals($res, FileBackend::parentStoragePath($path), "FileBackend::parentStoragePath on path '{$path}'");
 }
コード例 #3
0
ファイル: NewParserTest.php プロジェクト: huatuoorg/mediawiki
 /**
  * Delete the specified files, if they exist.
  * @param array $files Full paths to files to delete.
  */
 private static function deleteFiles($files)
 {
     $backend = RepoGroup::singleton()->getLocalRepo()->getBackend();
     foreach ($files as $file) {
         $backend->delete(array('src' => $file), array('force' => 1));
     }
     foreach ($files as $file) {
         $tmp = FileBackend::parentStoragePath($file);
         while ($tmp) {
             if (!$backend->clean(array('dir' => $tmp))->isOK()) {
                 break;
             }
             $tmp = FileBackend::parentStoragePath($tmp);
         }
     }
 }
コード例 #4
0
 /**
  * Delete the specified files and their parent directories
  * @param array $files File backend URIs mwstore://...
  */
 private function deleteFiles($files)
 {
     // Delete the files
     $backend = RepoGroup::singleton()->getLocalRepo()->getBackend();
     foreach ($files as $file) {
         $backend->delete(['src' => $file], ['force' => 1]);
     }
     // Delete the parent directories
     foreach ($files as $file) {
         $tmp = FileBackend::parentStoragePath($file);
         while ($tmp) {
             if (!$backend->clean(['dir' => $tmp])->isOK()) {
                 break;
             }
             $tmp = FileBackend::parentStoragePath($tmp);
         }
     }
 }
コード例 #5
0
ファイル: FileBackendTest.php プロジェクト: Tjorriemorrie/app
 private function recursiveClean($dir)
 {
     do {
         if (!$this->backend->clean(array('dir' => $dir))->isOK()) {
             break;
         }
     } while ($dir = FileBackend::parentStoragePath($dir));
 }