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


PHP View::deleteAll方法代码示例

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


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

示例1: tearDown

 protected function tearDown()
 {
     // disable trashbin to be able to properly clean up
     \OC::$server->getAppManager()->disableApp('files_trashbin');
     $this->rootView->deleteAll('/' . self::TEST_TRASHBIN_USER1 . '/files');
     $this->rootView->deleteAll('/' . self::TEST_TRASHBIN_USER2 . '/files');
     $this->rootView->deleteAll($this->trashRoot1);
     $this->rootView->deleteAll($this->trashRoot2);
     // clear trash table
     $connection = \OC::$server->getDatabaseConnection();
     $connection->executeUpdate('DELETE FROM `*PREFIX*files_trash`');
     parent::tearDown();
 }
开发者ID:Kevin-ZK,项目名称:vaneDisk,代码行数:13,代码来源:trashbin.php

示例2: testIsExcludedPath

 /**
  * @dataProvider isExcludedPathProvider
  */
 function testIsExcludedPath($path, $expected)
 {
     $this->view->mkdir(dirname($path));
     $this->view->file_put_contents($path, "test");
     $result = \Test_Helper::invokePrivate(new \OCA\Files_Encryption\Proxy(), 'isExcludedPath', array($path));
     $this->assertSame($expected, $result);
     $this->view->deleteAll(dirname($path));
 }
开发者ID:samj1912,项目名称:repo,代码行数:11,代码来源:proxy.php

示例3: testIsExcludedPath

 /**
  * @dataProvider isExcludedPathProvider
  */
 function testIsExcludedPath($path, $expected)
 {
     $this->view->mkdir(dirname($path));
     $this->view->file_put_contents($path, "test");
     $testClass = new DummyProxy();
     $result = $testClass->isExcludedPathTesting($path, $this->userId);
     $this->assertSame($expected, $result);
     $this->view->deleteAll(dirname($path));
 }
开发者ID:Romua1d,项目名称:core,代码行数:12,代码来源:proxy.php

示例4: testKeySetPreperation

 function testKeySetPreperation()
 {
     $basePath = '/' . self::TEST_USER . '/files';
     $path = '/folder1/subfolder/subsubfolder/file.txt';
     $this->assertFalse($this->view->is_dir($basePath . '/testKeySetPreperation'));
     TestProtectedKeymanagerMethods::testKeySetPreperation($this->view, $basePath . $path);
     // check if directory structure was created
     $this->assertTrue($this->view->is_dir($basePath . $path));
     // cleanup
     $this->view->deleteAll($basePath . '/folder1');
 }
开发者ID:samj1912,项目名称:repo,代码行数:11,代码来源:keymanager.php

示例5: testDescryptAllWithBrokenFiles

 function testDescryptAllWithBrokenFiles()
 {
     $file1 = "/decryptAll1" . $this->getUniqueID() . ".txt";
     $file2 = "/decryptAll2" . $this->getUniqueID() . ".txt";
     $util = new \OCA\Files_Encryption\Util($this->view, $this->userId);
     $this->view->file_put_contents($this->userId . '/files/' . $file1, $this->dataShort);
     $this->view->file_put_contents($this->userId . '/files/' . $file2, $this->dataShort);
     $fileInfoEncrypted1 = $this->view->getFileInfo($this->userId . '/files/' . $file1);
     $fileInfoEncrypted2 = $this->view->getFileInfo($this->userId . '/files/' . $file2);
     $this->assertTrue($fileInfoEncrypted1 instanceof \OC\Files\FileInfo);
     $this->assertTrue($fileInfoEncrypted2 instanceof \OC\Files\FileInfo);
     $this->assertEquals($fileInfoEncrypted1['encrypted'], 1);
     $this->assertEquals($fileInfoEncrypted2['encrypted'], 1);
     // rename keyfile for file1 so that the decryption for file1 fails
     // Expected behaviour: decryptAll() returns false, file2 gets decrypted anyway
     $this->view->rename($this->userId . '/files_encryption/keys/' . $file1 . '/fileKey', $this->userId . '/files_encryption/keys/' . $file1 . '/fileKey.moved');
     // need to reset key cache that we don't use the cached key
     $this->resetKeyCache();
     // decrypt all encrypted files
     $result = $util->decryptAll();
     $this->assertFalse($result);
     $fileInfoUnencrypted1 = $this->view->getFileInfo($this->userId . '/files/' . $file1);
     $fileInfoUnencrypted2 = $this->view->getFileInfo($this->userId . '/files/' . $file2);
     $this->assertTrue($fileInfoUnencrypted1 instanceof \OC\Files\FileInfo);
     $this->assertTrue($fileInfoUnencrypted2 instanceof \OC\Files\FileInfo);
     // file1 should be still encrypted; file2 should be decrypted
     $this->assertEquals(1, $fileInfoUnencrypted1['encrypted']);
     $this->assertEquals(0, $fileInfoUnencrypted2['encrypted']);
     // keyfiles and share keys should still exist
     $this->assertTrue($this->view->is_dir($this->userId . '/files_encryption/keys/'));
     $this->assertTrue($this->view->file_exists($this->userId . '/files_encryption/keys/' . $file1 . '/fileKey.moved'));
     $this->assertTrue($this->view->file_exists($this->userId . '/files_encryption/keys/' . $file1 . '/' . $this->userId . '.shareKey'));
     // rename the keyfile for file1 back
     $this->view->rename($this->userId . '/files_encryption/keys/' . $file1 . '/fileKey.moved', $this->userId . '/files_encryption/keys/' . $file1 . '/fileKey');
     // try again to decrypt all encrypted files
     $result = $util->decryptAll();
     $this->assertTrue($result);
     $fileInfoUnencrypted1 = $this->view->getFileInfo($this->userId . '/files/' . $file1);
     $fileInfoUnencrypted2 = $this->view->getFileInfo($this->userId . '/files/' . $file2);
     $this->assertTrue($fileInfoUnencrypted1 instanceof \OC\Files\FileInfo);
     $this->assertTrue($fileInfoUnencrypted2 instanceof \OC\Files\FileInfo);
     // now both files should be decrypted
     $this->assertEquals(0, $fileInfoUnencrypted1['encrypted']);
     $this->assertEquals(0, $fileInfoUnencrypted2['encrypted']);
     // keyfiles and share keys should be deleted
     $this->assertFalse($this->view->is_dir($this->userId . '/files_encryption/keys/'));
     //cleanup
     $backupPath = $this->getBackupPath('decryptAll');
     $this->view->unlink($this->userId . '/files/' . $file1);
     $this->view->unlink($this->userId . '/files/' . $file2);
     $this->view->deleteAll($backupPath);
 }
开发者ID:yheric455042,项目名称:owncloud82,代码行数:52,代码来源:util.php

示例6: setUp

 protected function setUp()
 {
     parent::setUp();
     // set user id
     \OC_User::setUserId(self::TEST_ENCRYPTION_TRASHBIN_USER1);
     $this->userId = self::TEST_ENCRYPTION_TRASHBIN_USER1;
     $this->pass = self::TEST_ENCRYPTION_TRASHBIN_USER1;
     // init filesystem view
     $this->view = new \OC\Files\View('/');
     // init short data
     $this->dataShort = 'hats';
     $this->folder1 = '/folder1';
     $this->subfolder = '/subfolder1';
     $this->subsubfolder = '/subsubfolder1';
     // remember files_trashbin state
     $this->stateFilesTrashbin = OC_App::isEnabled('files_trashbin');
     $this->view->deleteAll('/' . self::TEST_ENCRYPTION_TRASHBIN_USER1 . '/files_trashbin');
     $this->view->deleteAll('/' . self::TEST_ENCRYPTION_TRASHBIN_USER2 . '/files_trashbin');
     // we want to tests with app files_trashbin enabled
     \OC_App::enable('files_trashbin');
 }
开发者ID:droiter,项目名称:openwrt-on-android,代码行数:21,代码来源:trashbin.php

示例7: testGetVersions

 /**
  * test if we find all versions and if the versions array contain
  * the correct 'path' and 'name'
  */
 public function testGetVersions()
 {
     $t1 = time();
     // second version is two weeks older, this way we make sure that no
     // version will be expired
     $t2 = $t1 - 60 * 60 * 24 * 14;
     // create some versions
     $v1 = self::USERS_VERSIONS_ROOT . '/subfolder/test.txt.v' . $t1;
     $v2 = self::USERS_VERSIONS_ROOT . '/subfolder/test.txt.v' . $t2;
     $this->rootView->mkdir(self::USERS_VERSIONS_ROOT . '/subfolder/');
     $this->rootView->file_put_contents($v1, 'version1');
     $this->rootView->file_put_contents($v2, 'version2');
     // execute copy hook of versions app
     $versions = \OCA\Files_Versions\Storage::getVersions(self::TEST_VERSIONS_USER, '/subfolder/test.txt');
     $this->assertCount(2, $versions);
     foreach ($versions as $version) {
         $this->assertSame('/subfolder/test.txt', $version['path']);
         $this->assertSame('test.txt', $version['name']);
     }
     //cleanup
     $this->rootView->deleteAll(self::USERS_VERSIONS_ROOT . '/subfolder');
 }
开发者ID:nem0xff,项目名称:core,代码行数:26,代码来源:versions.php

示例8: testMigrateToNewFolderStructure

 public function testMigrateToNewFolderStructure()
 {
     // go back to the state before migration
     $this->view->rename('/files_encryption/public_keys', '/public-keys');
     $this->view->rename('/public-keys/' . self::TEST_ENCRYPTION_MIGRATION_USER1 . '.publicKey', '/public-keys/' . self::TEST_ENCRYPTION_MIGRATION_USER1 . '.public.key');
     $this->view->rename('/public-keys/' . self::TEST_ENCRYPTION_MIGRATION_USER2 . '.publicKey', '/public-keys/' . self::TEST_ENCRYPTION_MIGRATION_USER2 . '.public.key');
     $this->view->rename('/public-keys/' . self::TEST_ENCRYPTION_MIGRATION_USER3 . '.publicKey', '/public-keys/' . self::TEST_ENCRYPTION_MIGRATION_USER3 . '.public.key');
     $this->view->deleteAll(self::TEST_ENCRYPTION_MIGRATION_USER1 . '/files_encryption/keys');
     $this->view->deleteAll(self::TEST_ENCRYPTION_MIGRATION_USER2 . '/files_encryption/keys');
     $this->view->deleteAll(self::TEST_ENCRYPTION_MIGRATION_USER3 . '/files_encryption/keys');
     $this->view->rename(self::TEST_ENCRYPTION_MIGRATION_USER1 . '/files_encryption/' . self::TEST_ENCRYPTION_MIGRATION_USER1 . '.privateKey', self::TEST_ENCRYPTION_MIGRATION_USER1 . '/files_encryption/' . self::TEST_ENCRYPTION_MIGRATION_USER1 . '.private.key');
     $this->view->rename(self::TEST_ENCRYPTION_MIGRATION_USER2 . '/files_encryption/' . self::TEST_ENCRYPTION_MIGRATION_USER1 . '.privateKey', self::TEST_ENCRYPTION_MIGRATION_USER2 . '/files_encryption/' . self::TEST_ENCRYPTION_MIGRATION_USER1 . '.private.key');
     $this->view->rename(self::TEST_ENCRYPTION_MIGRATION_USER3 . '/files_encryption/' . self::TEST_ENCRYPTION_MIGRATION_USER1 . '.privateKey', self::TEST_ENCRYPTION_MIGRATION_USER3 . '/files_encryption/' . self::TEST_ENCRYPTION_MIGRATION_USER1 . '.private.key');
     $this->createDummyShareKeys(self::TEST_ENCRYPTION_MIGRATION_USER1);
     $this->createDummyShareKeys(self::TEST_ENCRYPTION_MIGRATION_USER2);
     $this->createDummyShareKeys(self::TEST_ENCRYPTION_MIGRATION_USER3);
     $this->createDummyFileKeys(self::TEST_ENCRYPTION_MIGRATION_USER1);
     $this->createDummyFileKeys(self::TEST_ENCRYPTION_MIGRATION_USER2);
     $this->createDummyFileKeys(self::TEST_ENCRYPTION_MIGRATION_USER3);
     $this->createDummyFilesInTrash(self::TEST_ENCRYPTION_MIGRATION_USER2);
     // no user for system wide mount points
     $this->createDummyFileKeys('');
     $this->createDummyShareKeys('');
     $this->createDummySystemWideKeys();
     $m = new \OCA\Files_Encryption\Migration();
     $m->reorganizeFolderStructure();
     // TODO Verify that all files at the right place
     $this->assertTrue($this->view->file_exists('/files_encryption/public_keys/' . self::TEST_ENCRYPTION_MIGRATION_USER1 . '.publicKey'));
     $this->assertTrue($this->view->file_exists('/files_encryption/public_keys/' . self::TEST_ENCRYPTION_MIGRATION_USER2 . '.publicKey'));
     $this->assertTrue($this->view->file_exists('/files_encryption/public_keys/' . self::TEST_ENCRYPTION_MIGRATION_USER3 . '.publicKey'));
     $this->verifyNewKeyPath(self::TEST_ENCRYPTION_MIGRATION_USER1);
     $this->verifyNewKeyPath(self::TEST_ENCRYPTION_MIGRATION_USER2);
     $this->verifyNewKeyPath(self::TEST_ENCRYPTION_MIGRATION_USER3);
     // system wide keys
     $this->verifyNewKeyPath('');
     // trash
     $this->verifyFilesInTrash(self::TEST_ENCRYPTION_MIGRATION_USER2);
 }
开发者ID:yheric455042,项目名称:owncloud82,代码行数:38,代码来源:migration.php

示例9: deleteBackup

 /**
  * delete backup
  *
  * @param string $backup complete name of the backup
  * @return boolean
  */
 public function deleteBackup($backup)
 {
     $backupDir = $this->encryptionDir . '/backup.' . $backup . '/';
     return $this->view->deleteAll($backupDir);
 }
开发者ID:kebenxiaoming,项目名称:owncloudRedis,代码行数:11,代码来源:util.php

示例10: tearDown

 public function tearDown()
 {
     $this->rootView->deleteAll($this->trashRoot1);
     $this->rootView->deleteAll($this->trashRoot2);
 }
开发者ID:Romua1d,项目名称:core,代码行数:5,代码来源:trashbin.php

示例11: deleteAll

 /**
  * delete all files from the trash
  */
 public static function deleteAll()
 {
     $user = \OCP\User::getUser();
     $view = new \OC\Files\View('/' . $user);
     $view->deleteAll('files_trashbin');
     $query = \OC_DB::prepare('DELETE FROM `*PREFIX*files_trash` WHERE `user`=?');
     $query->execute(array($user));
     $view->mkdir('files_trashbin');
     $view->mkdir('files_trashbin/files');
     return true;
 }
开发者ID:julakali,项目名称:core,代码行数:14,代码来源:trashbin.php

示例12: deleteOldKeys

 /**
  * delete old keys
  *
  * @param string $user
  */
 private function deleteOldKeys($user)
 {
     $this->view->deleteAll($user . '/files_encryption/keyfiles');
     $this->view->deleteAll($user . '/files_encryption/share-keys');
 }
开发者ID:brunomilet,项目名称:owncloud-core,代码行数:10,代码来源:migration.php

示例13: tearDown

 protected function tearDown()
 {
     $this->rootView->deleteAll($this->trashRoot1);
     $this->rootView->deleteAll($this->trashRoot2);
     parent::tearDown();
 }
开发者ID:heldernl,项目名称:owncloud8-extended,代码行数:6,代码来源:trashbin.php

示例14: deleteAllFileKeys

 /**
  * @inheritdoc
  */
 public function deleteAllFileKeys($path)
 {
     $keyDir = $this->getFileKeyDir('', $path);
     return !$this->view->file_exists($keyDir) || $this->view->deleteAll($keyDir);
 }
开发者ID:samj1912,项目名称:repo,代码行数:8,代码来源:storage.php

示例15: deleteEncryptionKeys

 /**
  * @param \OC\Files\View $view
  * @param $file
  * @param $filename
  * @param $timestamp
  * @return int
  */
 private static function deleteEncryptionKeys(\OC\Files\View $view, $file, $filename, $timestamp)
 {
     $size = 0;
     if (\OCP\App::isEnabled('files_encryption')) {
         $user = \OCP\User::getUser();
         $keyfiles = \OC\Files\Filesystem::normalizePath('files_trashbin/keys/' . $filename);
         if ($timestamp) {
             $keyfiles .= '.d' . $timestamp;
         }
         if ($view->is_dir($keyfiles)) {
             $size += self::calculateSize(new \OC\Files\View('/' . $user . '/' . $keyfiles));
             $view->deleteAll($keyfiles);
         }
     }
     return $size;
 }
开发者ID:riso,项目名称:owncloud-core,代码行数:23,代码来源:trashbin.php


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