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


PHP Manager::clear方法代码示例

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


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

示例1: clearMounts

 /**
  * clear all mounts and storage backends
  */
 public static function clearMounts()
 {
     if (self::$mounts) {
         self::$usersSetup = array();
         self::$mounts->clear();
     }
 }
开发者ID:stweil,项目名称:owncloud-core,代码行数:10,代码来源:Filesystem.php

示例2: testAddShare

 public function testAddShare()
 {
     $shareData1 = ['remote' => 'http://localhost', 'token' => 'token1', 'password' => '', 'name' => '/SharedFolder', 'owner' => 'foobar', 'accepted' => false, 'user' => $this->uid];
     $shareData2 = $shareData1;
     $shareData2['token'] = 'token2';
     $shareData3 = $shareData1;
     $shareData3['token'] = 'token3';
     // Add a share for "user"
     $this->assertSame(null, call_user_func_array([$this->manager, 'addShare'], $shareData1));
     $openShares = $this->manager->getOpenShares();
     $this->assertCount(1, $openShares);
     $this->assertExternalShareEntry($shareData1, $openShares[0], 1, '{{TemporaryMountPointName#' . $shareData1['name'] . '}}');
     \Test_Helper::invokePrivate($this->manager, 'setupMounts');
     $this->assertNotMount('SharedFolder');
     $this->assertNotMount('{{TemporaryMountPointName#' . $shareData1['name'] . '}}');
     // Add a second share for "user" with the same name
     $this->assertSame(null, call_user_func_array([$this->manager, 'addShare'], $shareData2));
     $openShares = $this->manager->getOpenShares();
     $this->assertCount(2, $openShares);
     $this->assertExternalShareEntry($shareData1, $openShares[0], 1, '{{TemporaryMountPointName#' . $shareData1['name'] . '}}');
     // New share falls back to "-1" appendix, because the name is already taken
     $this->assertExternalShareEntry($shareData2, $openShares[1], 2, '{{TemporaryMountPointName#' . $shareData2['name'] . '}}-1');
     \Test_Helper::invokePrivate($this->manager, 'setupMounts');
     $this->assertNotMount('SharedFolder');
     $this->assertNotMount('{{TemporaryMountPointName#' . $shareData1['name'] . '}}');
     $this->assertNotMount('{{TemporaryMountPointName#' . $shareData1['name'] . '}}-1');
     // Accept the first share
     $this->manager->acceptShare($openShares[0]['id']);
     // Check remaining shares - Accepted
     $acceptedShares = \Test_Helper::invokePrivate($this->manager, 'getShares', [true]);
     $this->assertCount(1, $acceptedShares);
     $shareData1['accepted'] = true;
     $this->assertExternalShareEntry($shareData1, $acceptedShares[0], 1, $shareData1['name']);
     // Check remaining shares - Open
     $openShares = $this->manager->getOpenShares();
     $this->assertCount(1, $openShares);
     $this->assertExternalShareEntry($shareData2, $openShares[0], 2, '{{TemporaryMountPointName#' . $shareData2['name'] . '}}-1');
     \Test_Helper::invokePrivate($this->manager, 'setupMounts');
     $this->assertMount($shareData1['name']);
     $this->assertNotMount('{{TemporaryMountPointName#' . $shareData1['name'] . '}}');
     $this->assertNotMount('{{TemporaryMountPointName#' . $shareData1['name'] . '}}-1');
     // Add another share for "user" with the same name
     $this->assertSame(null, call_user_func_array([$this->manager, 'addShare'], $shareData3));
     $openShares = $this->manager->getOpenShares();
     $this->assertCount(2, $openShares);
     $this->assertExternalShareEntry($shareData2, $openShares[0], 2, '{{TemporaryMountPointName#' . $shareData2['name'] . '}}-1');
     // New share falls back to the original name (no "-\d", because the name is not taken)
     $this->assertExternalShareEntry($shareData3, $openShares[1], 3, '{{TemporaryMountPointName#' . $shareData3['name'] . '}}');
     \Test_Helper::invokePrivate($this->manager, 'setupMounts');
     $this->assertMount($shareData1['name']);
     $this->assertNotMount('{{TemporaryMountPointName#' . $shareData1['name'] . '}}');
     $this->assertNotMount('{{TemporaryMountPointName#' . $shareData1['name'] . '}}-1');
     // Decline the third share
     $this->manager->declineShare($openShares[1]['id']);
     \Test_Helper::invokePrivate($this->manager, 'setupMounts');
     $this->assertMount($shareData1['name']);
     $this->assertNotMount('{{TemporaryMountPointName#' . $shareData1['name'] . '}}');
     $this->assertNotMount('{{TemporaryMountPointName#' . $shareData1['name'] . '}}-1');
     // Check remaining shares - Accepted
     $acceptedShares = \Test_Helper::invokePrivate($this->manager, 'getShares', [true]);
     $this->assertCount(1, $acceptedShares);
     $shareData1['accepted'] = true;
     $this->assertExternalShareEntry($shareData1, $acceptedShares[0], 1, $shareData1['name']);
     // Check remaining shares - Open
     $openShares = $this->manager->getOpenShares();
     $this->assertCount(1, $openShares);
     $this->assertExternalShareEntry($shareData2, $openShares[0], 2, '{{TemporaryMountPointName#' . $shareData2['name'] . '}}-1');
     \Test_Helper::invokePrivate($this->manager, 'setupMounts');
     $this->assertMount($shareData1['name']);
     $this->assertNotMount('{{TemporaryMountPointName#' . $shareData1['name'] . '}}');
     $this->assertNotMount('{{TemporaryMountPointName#' . $shareData1['name'] . '}}-1');
     $this->manager->removeUserShares($this->uid);
     $this->assertEmpty(\Test_Helper::invokePrivate($this->manager, 'getShares', [null]), 'Asserting all shares for the user have been deleted');
     $this->mountManager->clear();
     \Test_Helper::invokePrivate($this->manager, 'setupMounts');
     $this->assertNotMount($shareData1['name']);
     $this->assertNotMount('{{TemporaryMountPointName#' . $shareData1['name'] . '}}');
     $this->assertNotMount('{{TemporaryMountPointName#' . $shareData1['name'] . '}}-1');
 }
开发者ID:adolfo2103,项目名称:hcloudfilem,代码行数:79,代码来源:managertest.php

示例3: clearMounts

 /**
  * clear all mounts and storage backends
  */
 public static function clearMounts()
 {
     if (self::$mounts) {
         self::$mounts->clear();
     }
 }
开发者ID:droiter,项目名称:openwrt-on-android,代码行数:9,代码来源:filesystem.php


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