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


PHP Storage::store方法代碼示例

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


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

示例1: testDownloadVersions

 function testDownloadVersions()
 {
     // login as admin
     self::loginHelper(self::TEST_ENCRYPTION_SHARE_USER1);
     $rootView = new \OC\Files\View();
     // save file twice to create a new version
     \OC\Files\Filesystem::file_put_contents($this->filename, "revision1");
     \OCA\Files_Versions\Storage::store($this->filename);
     \OC\Files\Filesystem::file_put_contents($this->filename, "revision2");
     // check if the owner can retrieve the correct version
     $versions = \OCA\Files_Versions\Storage::getVersions(self::TEST_ENCRYPTION_SHARE_USER1, $this->filename);
     $this->assertSame(1, count($versions));
     $version = reset($versions);
     $versionUser1 = $rootView->file_get_contents('/' . self::TEST_ENCRYPTION_SHARE_USER1 . '/files_versions/' . $this->filename . '.v' . $version['version']);
     $this->assertSame('revision1', $versionUser1);
     // share the file
     $fileInfo = \OC\Files\Filesystem::getFileInfo($this->filename);
     $this->assertInstanceOf('\\OC\\Files\\FileInfo', $fileInfo);
     $this->assertTrue(\OCP\Share::shareItem('file', $fileInfo['fileid'], \OCP\Share::SHARE_TYPE_USER, self::TEST_ENCRYPTION_SHARE_USER2, \OCP\Constants::PERMISSION_ALL));
     // try to download the version as user2
     self::loginHelper(self::TEST_ENCRYPTION_SHARE_USER2);
     $versionUser2 = $rootView->file_get_contents('/' . self::TEST_ENCRYPTION_SHARE_USER1 . '/files_versions/' . $this->filename . '.v' . $version['version']);
     $this->assertSame('revision1', $versionUser2);
     //cleanup
     self::loginHelper(self::TEST_ENCRYPTION_SHARE_USER1);
     \OCP\Share::unshare('file', $fileInfo['fileid'], \OCP\Share::SHARE_TYPE_USER, self::TEST_ENCRYPTION_SHARE_USER2);
     \OC\Files\Filesystem::unlink($this->filename);
 }
開發者ID:yheric455042,項目名稱:owncloud82,代碼行數:28,代碼來源:share.php


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