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