本文整理匯總了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);
}
}
示例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;
}
示例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);
}
示例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);
}
示例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;
}
示例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();
}
示例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();
}
示例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);
}
示例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;
}
示例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());
}
示例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();
}
示例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;
}
示例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);
}
示例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);
}
示例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;
}