當前位置: 首頁>>代碼示例>>PHP>>正文


PHP OC_Util::tearDownFS方法代碼示例

本文整理匯總了PHP中OC_Util::tearDownFS方法的典型用法代碼示例。如果您正苦於以下問題:PHP OC_Util::tearDownFS方法的具體用法?PHP OC_Util::tearDownFS怎麽用?PHP OC_Util::tearDownFS使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在OC_Util的用法示例。


在下文中一共展示了OC_Util::tearDownFS方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: execute

 protected function execute(InputInterface $input, OutputInterface $output)
 {
     if (!$input->getOption('debug')) {
         $this->scanner->listen('\\OCA\\Music\\Utility\\Scanner', 'update', function ($path) use($output) {
             $output->writeln("Scanning <info>{$path}</info>");
         });
     }
     $inputPath = $input->getOption('path');
     $path = false;
     if ($inputPath) {
         $path = '/' . trim($inputPath, '/');
         list(, $user, ) = explode('/', $path, 3);
         $users = array($user);
     } else {
         if ($input->getOption('all')) {
             $users = $this->userManager->search('');
         } else {
             $users = $input->getArgument('user_id');
         }
     }
     foreach ($users as $user) {
         if (is_object($user)) {
             $user = $user->getUID();
         }
         \OC_Util::tearDownFS();
         \OC_Util::setupFS($user);
         $output->writeln("Start scan for <info>{$user}</info>");
         $this->scanner->rescan($user, true, $path ? $path : $this->resolveUserFolder($user), $input->getOption('debug'), $output);
     }
 }
開發者ID:DevelopIdeas,項目名稱:music,代碼行數:30,代碼來源:scan.php

示例2: getByShareToken

 public static function getByShareToken($token)
 {
     $linkItem = \OCP\Share::getShareByToken($token);
     if (is_array($linkItem) && isset($linkItem['uid_owner'])) {
         // seems to be a valid share
         $rootLinkItem = \OCP\Share::resolveReShare($linkItem);
         $fileOwner = $rootLinkItem['uid_owner'];
     } else {
         throw new \Exception('This file was probably unshared');
     }
     if (!isset($rootLinkItem['path']) && isset($rootLinkItem['file_target'])) {
         $rootLinkItem['path'] = 'files/' . $rootLinkItem['file_target'];
     }
     $file = new File($rootLinkItem['file_source'], array($rootLinkItem));
     if (isset($rootLinkItem['uid_owner'])) {
         \OC_Util::tearDownFS();
         \OC_Util::setupFS($rootLinkItem['uid_owner']);
         $file->setOwner($rootLinkItem['uid_owner']);
         $file->setPath('/files' . \OC\Files\Filesystem::getPath($linkItem['file_source']));
     }
     if (isset($linkItem['share_with']) && !empty($linkItem['share_with'])) {
         $file->setPasswordProtected(true);
     }
     return $file;
 }
開發者ID:omusico,項目名稱:isle-web-framework,代碼行數:25,代碼來源:file.php

示例3: setUp

 public function setUp()
 {
     if (!getenv('RUN_OBJECTSTORE_TESTS')) {
         $this->markTestSkipped('objectstore tests are unreliable on travis');
     }
     \OC_App::disable('files_sharing');
     \OC_App::disable('files_versions');
     // reset backend
     \OC_User::clearBackends();
     \OC_User::useBackend('database');
     // create users
     $users = array('test');
     foreach ($users as $userName) {
         \OC_User::deleteUser($userName);
         \OC_User::createUser($userName, $userName);
     }
     // main test user
     $userName = 'test';
     \OC_Util::tearDownFS();
     \OC_User::setUserId('');
     \OC\Files\Filesystem::tearDown();
     \OC_User::setUserId('test');
     $testContainer = 'oc-test-container-' . substr(md5(rand()), 0, 7);
     $params = array('username' => 'facebook100000330192569', 'password' => 'Dbdj1sXnRSHxIGc4', 'container' => $testContainer, 'autocreate' => true, 'region' => 'RegionOne', 'url' => 'http://8.21.28.222:5000/v2.0', 'tenantName' => 'facebook100000330192569', 'serviceName' => 'swift', 'user' => \OC_User::getManager()->get($userName));
     $this->objectStorage = new ObjectStoreToTest($params);
     $params['objectstore'] = $this->objectStorage;
     $this->instance = new ObjectStoreStorage($params);
 }
開發者ID:Combustible,項目名稱:core,代碼行數:28,代碼來源:swift.php

示例4: setUp

 protected function setUp()
 {
     parent::setUp();
     if (!getenv('RUN_OBJECTSTORE_TESTS')) {
         $this->markTestSkipped('objectstore tests are unreliable in some environments');
     }
     // reset backend
     \OC_User::clearBackends();
     \OC_User::useBackend('database');
     // create users
     $users = array('test');
     foreach ($users as $userName) {
         \OC_User::deleteUser($userName);
         \OC_User::createUser($userName, $userName);
     }
     // main test user
     \OC_Util::tearDownFS();
     \OC_User::setUserId('');
     \OC\Files\Filesystem::tearDown();
     \OC_User::setUserId('test');
     $config = \OC::$server->getConfig()->getSystemValue('objectstore');
     $this->objectStorage = new ObjectStoreToTest($config['arguments']);
     $config['objectstore'] = $this->objectStorage;
     $this->instance = new ObjectStoreStorage($config);
 }
開發者ID:nem0xff,項目名稱:core,代碼行數:25,代碼來源:swift.php

示例5: setupFS

 /**
  * Act on behalf on trash item owner
  * @param string $user
  * @return boolean
  */
 private function setupFS($user)
 {
     if (!$this->userManager->userExists($user)) {
         return false;
     }
     \OC_Util::tearDownFS();
     \OC_Util::setupFS($user);
     return true;
 }
開發者ID:kenwi,項目名稱:core,代碼行數:14,代碼來源:expireversions.php

示例6: runScanner

 /**
  * @param IUser $user
  */
 protected function runScanner(IUser $user)
 {
     try {
         $scanner = new Scanner($user->getUID(), $this->dbConnection, $this->logger);
         $scanner->backgroundScan('');
     } catch (\Exception $e) {
         $this->logger->logException($e, ['app' => 'files']);
     }
     \OC_Util::tearDownFS();
 }
開發者ID:loulancn,項目名稱:core,代碼行數:13,代碼來源:scanfiles.php

示例7: setUp

 public function setUp()
 {
     parent::setUp();
     $this->userSession->setUser(null);
     \OC_Util::tearDownFS();
     $job = new IndexJob();
     $job->run(array('user' => 'test'));
     $this->userSession->setUser(null);
     \OC_Util::tearDownFS();
 }
開發者ID:ntvis,項目名稱:search_lucene,代碼行數:10,代碼來源:testoptimizejob.php

示例8: setUp

 function setUp()
 {
     $this->username = OC_Util::generateRandomBytes(20);
     OC_User::createUser($this->username, OC_Util::generateRandomBytes(20));
     \OC_Util::tearDownFS();
     \OC_User::setUserId('');
     \OC\Files\Filesystem::tearDown();
     \OC_Util::setupFS($this->username);
     $this->user = \OC::$server->getUserManager()->get($this->username);
     $this->certificateManager = new CertificateManager($this->user);
 }
開發者ID:Combustible,項目名稱:core,代碼行數:11,代碼來源:certificatemanager.php

示例9: generateUser

 /**
  * Generates a test user and sets up their file system
  * @return string the test users id
  */
 public function generateUser()
 {
     $username = uniqid();
     \OC_User::createUser($username, 'password');
     \OC_Util::tearDownFS();
     \OC_User::setUserId('');
     \OC\Files\Filesystem::tearDown();
     \OC_Util::setupFS($username);
     $this->users[] = $username;
     return $username;
 }
開發者ID:olucao,項目名稱:owncloud-core,代碼行數:15,代碼來源:migrate.php

示例10: setUp

 protected function setUp()
 {
     parent::setUp();
     $this->username = $this->getUniqueID('', 20);
     OC_User::createUser($this->username, $this->getUniqueID('', 20));
     \OC_Util::tearDownFS();
     \OC_User::setUserId('');
     \OC\Files\Filesystem::tearDown();
     \OC_Util::setupFS($this->username);
     $this->certificateManager = new CertificateManager($this->username, new \OC\Files\View());
 }
開發者ID:heldernl,項目名稱:owncloud8-extended,代碼行數:11,代碼來源:certificatemanager.php

示例11: handle

 public function handle()
 {
     $userManager = \OC::$server->getUserManager();
     if (!$userManager->userExists($this->user)) {
         // User has been deleted already
         return;
     }
     \OC_Util::setupFS($this->user);
     Storage::expire($this->fileName, $this->versionsSize, $this->neededSpace);
     \OC_Util::tearDownFS();
 }
開發者ID:enoch85,項目名稱:owncloud-testserver,代碼行數:11,代碼來源:expire.php

示例12: setupFS

 /**
  * Act on behalf on trash item owner
  * @param string $user
  * @return boolean
  */
 protected function setupFS($user)
 {
     \OC_Util::tearDownFS();
     \OC_Util::setupFS($user);
     // Check if this user has a versions directory
     $view = new \OC\Files\View('/' . $user);
     if (!$view->is_dir('/files_versions')) {
         return false;
     }
     return true;
 }
開發者ID:stweil,項目名稱:owncloud-core,代碼行數:16,代碼來源:expireversions.php

示例13: tearDown

 protected function tearDown()
 {
     \OC_Util::tearDownFS();
     \OC_User::setUserId('');
     Filesystem::tearDown();
     \OC_User::deleteUser($this->user);
     \OC_User::setIncognitoMode(false);
     \OC::$server->getSession()->set('public_link_authenticated', '');
     // Set old user
     \OC_User::setUserId($this->oldUser);
     \OC_Util::setupFS($this->oldUser);
 }
開發者ID:heldernl,項目名稱:owncloud8-extended,代碼行數:12,代碼來源:sharecontroller.php

示例14: setupForUser

 protected function setupForUser($name, $password)
 {
     \OC_Util::tearDownFS();
     \OC_Util::setupFS($name);
     $container = $this->encryptionApp->getContainer();
     /** @var KeyManager $keyManager */
     $keyManager = $container->query('KeyManager');
     /** @var Setup $userSetup */
     $userSetup = $container->query('UserSetup');
     $userSetup->setupUser($name, $password);
     $keyManager->init($name, $password);
 }
開發者ID:rchicoli,項目名稱:owncloud-core,代碼行數:12,代碼來源:EncryptionTrait.php

示例15: getMounts

 /**
  * get all storages for $dir
  *
  * @param string $dir
  * @return \OC\Files\Mount\MountPoint[]
  */
 protected function getMounts($dir)
 {
     //TODO: move to the node based fileapi once that's done
     \OC_Util::tearDownFS();
     \OC_Util::setupFS($this->user);
     $mountManager = Filesystem::getMountManager();
     $mounts = $mountManager->findIn($dir);
     $mounts[] = $mountManager->find($dir);
     $mounts = array_reverse($mounts);
     //start with the mount of $dir
     return $mounts;
 }
開發者ID:gvde,項目名稱:core,代碼行數:18,代碼來源:scanner.php


注:本文中的OC_Util::tearDownFS方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。