本文整理汇总了PHP中OC\Files\Filesystem::clearMounts方法的典型用法代码示例。如果您正苦于以下问题:PHP Filesystem::clearMounts方法的具体用法?PHP Filesystem::clearMounts怎么用?PHP Filesystem::clearMounts使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OC\Files\Filesystem
的用法示例。
在下文中一共展示了Filesystem::clearMounts方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testOC
public function testOC()
{
\OC\Files\Filesystem::clearMounts();
$storage = new \OC\Files\Storage\Temporary(array());
$storage->file_put_contents('foo.txt', 'asd');
\OC\Files\Filesystem::mount($storage, array(), '/');
$this->assertTrue(file_exists('oc:///foo.txt'));
$this->assertEquals('asd', file_get_contents('oc:///foo.txt'));
$this->assertEquals(array('.', '..', 'foo.txt'), scandir('oc:///'));
file_put_contents('oc:///bar.txt', 'qwerty');
$this->assertEquals('qwerty', $storage->file_get_contents('bar.txt'));
$this->assertEquals(array('.', '..', 'bar.txt', 'foo.txt'), scandir('oc:///'));
$this->assertEquals('qwerty', file_get_contents('oc:///bar.txt'));
$fh = fopen('oc:///bar.txt', 'rb');
$this->assertSame(0, ftell($fh));
$content = fread($fh, 4);
$this->assertSame(4, ftell($fh));
$this->assertSame('qwer', $content);
$content = fread($fh, 1);
$this->assertSame(5, ftell($fh));
$this->assertSame(0, fseek($fh, 0));
$this->assertSame(0, ftell($fh));
unlink('oc:///foo.txt');
$this->assertEquals(array('.', '..', 'bar.txt'), scandir('oc:///'));
}
示例2: tearDown
public function tearDown()
{
foreach ($this->storages as $storage) {
$storage->getCache()->clear();
}
\OC\Files\Filesystem::clearMounts();
}
示例3: setUp
public function setUp()
{
//clear all proxies and hooks so we can do clean testing
\OC_FileProxy::clearProxies();
\OC_Hook::clear('OC_Filesystem');
//disabled atm
//enable only the encryption hook if needed
//if(OC_App::isEnabled('files_encryption')) {
// OC_FileProxy::register(new OC_FileProxy_Encryption());
//}
//set up temporary storage
\OC\Files\Filesystem::clearMounts();
$storage = new \OC\Files\Storage\Temporary(array());
\OC\Files\Filesystem::mount($storage, array(), '/');
$datadir = str_replace('local::', '', $storage->getId());
$this->datadir = \OC_Config::getValue('cachedirectory', \OC::$SERVERROOT . '/data/cache');
\OC_Config::setValue('cachedirectory', $datadir);
\OC_User::clearBackends();
\OC_User::useBackend(new \OC_User_Dummy());
//login
\OC_User::createUser('test', 'test');
$this->user = \OC_User::getUser();
\OC_User::setUserId('test');
//set up the users dir
$rootView = new \OC\Files\View('');
$rootView->mkdir('/test');
$this->instance = new \OC\Cache\File();
}
示例4: setUp
protected function setUp() {
parent::setUp();
$this->storage = new \OC\Files\Storage\Temporary(array());
$textData = "dummy file data\n";
$imgData = file_get_contents(\OC::$SERVERROOT . '/core/img/logo.png');
$this->storage->mkdir('folder');
$this->storage->file_put_contents('foo.txt', $textData);
$this->storage->file_put_contents('foo.png', $imgData);
$this->storage->file_put_contents('folder/bar.txt', $textData);
$this->storage->file_put_contents('folder/bar2.txt', $textData);
$this->scanner = $this->storage->getScanner();
$this->scanner->scan('');
$this->cache = $this->storage->getCache();
if (!self::$user) {
self::$user = $this->getUniqueID();
}
\OC_User::createUser(self::$user, 'password');
$this->loginAsUser(self::$user);
Filesystem::init(self::$user, '/' . self::$user . '/files');
Filesystem::clearMounts();
Filesystem::mount($this->storage, array(), '/' . self::$user . '/files');
\OC_Hook::clear('OC_Filesystem');
}
示例5: setUp
public function setUp()
{
// remember files_encryption state
$this->stateFilesEncryption = \OC_App::isEnabled('files_encryption');
// we want to tests with the encryption app disabled
\OC_App::disable('files_encryption');
$this->storage = new \OC\Files\Storage\Temporary(array());
$textData = "dummy file data\n";
$imgData = file_get_contents(\OC::$SERVERROOT . '/core/img/logo.png');
$this->storage->mkdir('folder');
$this->storage->file_put_contents('foo.txt', $textData);
$this->storage->file_put_contents('foo.png', $imgData);
$this->storage->file_put_contents('folder/bar.txt', $textData);
$this->storage->file_put_contents('folder/bar2.txt', $textData);
$this->scanner = $this->storage->getScanner();
$this->scanner->scan('');
$this->cache = $this->storage->getCache();
\OC\Files\Filesystem::tearDown();
if (!self::$user) {
self::$user = uniqid();
}
\OC_User::createUser(self::$user, 'password');
\OC_User::setUserId(self::$user);
\OC\Files\Filesystem::init(self::$user, '/' . self::$user . '/files');
Filesystem::clearMounts();
Filesystem::mount($this->storage, array(), '/' . self::$user . '/files');
\OC_Hook::clear('OC_Filesystem');
}
示例6: tearDown
protected function tearDown()
{
\OC_User::setUserId($this->user);
\OC_Config::setValue('cachedirectory', $this->datadir);
// Restore the original mount point
\OC\Files\Filesystem::clearMounts();
\OC\Files\Filesystem::mount($this->storage, array(), '/');
parent::tearDown();
}
示例7: setUp
public function setUp()
{
$this->storage = new Temporary(array());
Filesystem::clearMounts();
Filesystem::mount($this->storage, array(), '/');
$this->view = new View('');
$this->updater = new \OC\Files\Cache\Updater($this->view);
$this->cache = $this->storage->getCache();
}
示例8: tearDown
protected function tearDown()
{
foreach ($this->storages as $storage) {
$storage->getCache()->clear();
}
\OC\Files\Filesystem::clearMounts();
\OC\Files\Filesystem::mount($this->originalStorage, array(), '/');
parent::tearDown();
}
示例9: setUp
public function setUp()
{
$this->user = 'user_' . uniqid();
\OC_User::createUser($this->user, $this->user);
\OC\Files\Filesystem::tearDown();
\OC_User::setUserId($this->user);
\OC\Files\Filesystem::init($this->user, '/' . $this->user . '/files');
\OC\Files\Filesystem::clearMounts();
$this->storageMock = null;
}
示例10: tearDown
protected function tearDown()
{
foreach ($this->tmpDirs as $dir) {
\OC_Helper::rmdirr($dir);
}
\OC\Files\Filesystem::clearMounts();
\OC\Files\Filesystem::mount($this->originalStorage, array(), '/');
\OC_User::setUserId('');
parent::tearDown();
}
示例11: setUp
public function setUp()
{
\OC_User::clearBackends();
\OC_User::useBackend(new \OC_User_Dummy());
//login
\OC_User::createUser('test', 'test');
$this->user = \OC_User::getUser();
\OC_User::setUserId('test');
\OC\Files\Filesystem::clearMounts();
$this->tempStorage = null;
}
示例12: setUp
protected function setUp()
{
parent::setUp();
$this->user = $this->getUniqueID('user_');
\OC::$server->getUserManager()->createUser($this->user, $this->user);
$this->storage = \OC\Files\Filesystem::getStorage('/');
\OC\Files\Filesystem::tearDown();
\OC_User::setUserId($this->user);
\OC\Files\Filesystem::init($this->user, '/' . $this->user . '/files');
\OC\Files\Filesystem::clearMounts();
$this->storageMock = null;
}
示例13: setUp
public function setUp()
{
parent::setUp();
\OC_User::clearBackends();
\OC_User::useBackend(new \OC_User_Dummy());
\OC\Files\Filesystem::clearMounts();
//login
\OC_User::createUser('test', 'test');
\OC::$server->getSession()->set('user_id', 'test');
$this->storage = new \OC\Files\Storage\Temporary(array());
\OC\Files\Filesystem::init('test', '');
\OC\Files\Filesystem::clearMounts();
\OC\Files\Filesystem::mount($this->storage, array(), '/');
\OC\Files\Filesystem::file_put_contents('file1', self::CONTENT);
$this->config->method('getAvChunkSize')->willReturn('1024');
}
示例14: testOC
public function testOC()
{
\OC\Files\Filesystem::clearMounts();
$storage = new \OC\Files\Storage\Temporary(array());
$storage->file_put_contents('foo.txt', 'asd');
\OC\Files\Filesystem::mount($storage, array(), '/');
$this->assertTrue(file_exists('oc:///foo.txt'));
$this->assertEquals('asd', file_get_contents('oc:///foo.txt'));
$this->assertEquals(array('.', '..', 'foo.txt'), scandir('oc:///'));
file_put_contents('oc:///bar.txt', 'qwerty');
$this->assertEquals('qwerty', $storage->file_get_contents('bar.txt'));
$this->assertEquals(array('.', '..', 'bar.txt', 'foo.txt'), scandir('oc:///'));
$this->assertEquals('qwerty', file_get_contents('oc:///bar.txt'));
unlink('oc:///foo.txt');
$this->assertEquals(array('.', '..', 'bar.txt'), scandir('oc:///'));
}
示例15: setUp
public function setUp()
{
\OC_User::clearBackends();
\OC_User::useBackend(new \OC_User_Dummy());
//login
\OC_User::createUser('test', 'test');
$this->user = \OC_User::getUser();
\OC_User::setUserId('test');
\OC\Files\Filesystem::clearMounts();
$textData = "sample file\n";
$this->storage = new \OC\Files\Storage\Temporary(array());
$this->storage->file_put_contents(self::TEST_CLEAN_FILENAME, $textData);
$this->storage->file_put_contents(self::TEST_INFECTED_FILENAME, $textData);
\OC\Files\Filesystem::mount($this->storage, array(), '/');
$this->config['av_mode'] = \OCP\Config::getAppValue('files_antivirus', 'av_mode', null);
$this->config['av_path'] = \OCP\Config::getAppValue('files_antivirus', 'av_path', null);
\OCP\Config::setAppValue('files_antivirus', 'av_mode', 'executable');
\OCP\Config::setAppValue('files_antivirus', 'av_path', __DIR__ . '/avir.sh');
}