当前位置: 首页>>代码示例>>PHP>>正文


PHP FileBackend::doOperation方法代码示例

本文整理汇总了PHP中FileBackend::doOperation方法的典型用法代码示例。如果您正苦于以下问题:PHP FileBackend::doOperation方法的具体用法?PHP FileBackend::doOperation怎么用?PHP FileBackend::doOperation使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在FileBackend的用法示例。


在下文中一共展示了FileBackend::doOperation方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: freeTemp

 /**
  * Remove a temporary file or mark it for garbage collection
  *
  * @param $virtualUrl String: the virtual URL returned by FileRepo::storeTemp()
  * @return Boolean: true on success, false on failure
  */
 public function freeTemp($virtualUrl)
 {
     $temp = "mwrepo://{$this->name}/temp";
     if (substr($virtualUrl, 0, strlen($temp)) != $temp) {
         wfDebug(__METHOD__ . ": Invalid temp virtual URL\n");
         return false;
     }
     $path = $this->resolveVirtualUrl($virtualUrl);
     $op = array('op' => 'delete', 'src' => $path);
     $status = $this->backend->doOperation($op);
     return $status->isOK();
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:18,代码来源:FileRepo.php

示例2: doTestGetDirectoryList


//.........这里部分代码省略.........
     sort($expected);
     // Actual listing (no trailing slash)
     $list = array();
     $iter = $this->backend->getTopDirectoryList(array('dir' => "{$base}/unittest-cont1"));
     foreach ($iter as $file) {
         $list[] = $file;
     }
     sort($list);
     $this->assertEquals($expected, $list, "Correct top dir listing ({$backendName}).");
     // Expected listing
     $expected = array("subdir1", "subdir2", "subdir3", "subdir4");
     sort($expected);
     // Actual listing (no trailing slash)
     $list = array();
     $iter = $this->backend->getTopDirectoryList(array('dir' => "{$base}/unittest-cont1/e"));
     foreach ($iter as $file) {
         $list[] = $file;
     }
     sort($list);
     $this->assertEquals($expected, $list, "Correct top dir listing ({$backendName}).");
     // Actual listing (with trailing slash)
     $list = array();
     $iter = $this->backend->getTopDirectoryList(array('dir' => "{$base}/unittest-cont1/e/"));
     foreach ($iter as $file) {
         $list[] = $file;
     }
     sort($list);
     $this->assertEquals($expected, $list, "Correct top dir listing ({$backendName}).");
     // Expected listing
     $expected = array("subdir");
     sort($expected);
     // Actual listing (no trailing slash)
     $list = array();
     $iter = $this->backend->getTopDirectoryList(array('dir' => "{$base}/unittest-cont1/e/subdir2"));
     foreach ($iter as $file) {
         $list[] = $file;
     }
     sort($list);
     $this->assertEquals($expected, $list, "Correct top dir listing ({$backendName}).");
     // Actual listing (with trailing slash)
     $list = array();
     $iter = $this->backend->getTopDirectoryList(array('dir' => "{$base}/unittest-cont1/e/subdir2/"));
     foreach ($iter as $file) {
         $list[] = $file;
     }
     sort($list);
     $this->assertEquals($expected, $list, "Correct top dir listing ({$backendName}).");
     // Actual listing (using iterator second time)
     $list = array();
     foreach ($iter as $file) {
         $list[] = $file;
     }
     sort($list);
     $this->assertEquals($expected, $list, "Correct top dir listing ({$backendName}), second iteration.");
     // Expected listing (recursive)
     $expected = array("e", "e/subdir1", "e/subdir2", "e/subdir3", "e/subdir4", "e/subdir2/subdir", "e/subdir3/subdir", "e/subdir4/subdir", "e/subdir4/subdir/sub");
     sort($expected);
     // Actual listing (recursive)
     $list = array();
     $iter = $this->backend->getDirectoryList(array('dir' => "{$base}/unittest-cont1/"));
     foreach ($iter as $file) {
         $list[] = $file;
     }
     sort($list);
     $this->assertEquals($expected, $list, "Correct dir listing ({$backendName}).");
     // Expected listing (recursive)
     $expected = array("subdir", "subdir/sub");
     sort($expected);
     // Actual listing (recursive)
     $list = array();
     $iter = $this->backend->getDirectoryList(array('dir' => "{$base}/unittest-cont1/e/subdir4"));
     foreach ($iter as $file) {
         $list[] = $file;
     }
     sort($list);
     $this->assertEquals($expected, $list, "Correct dir listing ({$backendName}).");
     // Actual listing (recursive, second time)
     $list = array();
     foreach ($iter as $file) {
         $list[] = $file;
     }
     sort($list);
     $this->assertEquals($expected, $list, "Correct dir listing ({$backendName}).");
     $iter = $this->backend->getDirectoryList(array('dir' => "{$base}/unittest-cont1/e/subdir1"));
     $items = $this->listToArray($iter);
     $this->assertEquals(array(), $items, "Directory listing is empty.");
     foreach ($files as $file) {
         // clean up
         $this->backend->doOperation(array('op' => 'delete', 'src' => $file));
     }
     $iter = $this->backend->getDirectoryList(array('dir' => "{$base}/unittest-cont1/not/exists"));
     foreach ($iter as $file) {
         // no errors
     }
     $items = $this->listToArray($iter);
     $this->assertEquals(array(), $items, "Directory listing is empty.");
     $iter = $this->backend->getDirectoryList(array('dir' => "{$base}/unittest-cont1/e/not/exists"));
     $items = $this->listToArray($iter);
     $this->assertEquals(array(), $items, "Directory listing is empty.");
 }
开发者ID:biribogos,项目名称:wikihow-src,代码行数:101,代码来源:FileBackendTest.php


注:本文中的FileBackend::doOperation方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。