當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。