本文整理匯總了PHP中OCA\Files_Versions\Storage::renameOrCopy方法的典型用法代碼示例。如果您正苦於以下問題:PHP Storage::renameOrCopy方法的具體用法?PHP Storage::renameOrCopy怎麽用?PHP Storage::renameOrCopy使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類OCA\Files_Versions\Storage
的用法示例。
在下文中一共展示了Storage::renameOrCopy方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: testCopy
function testCopy()
{
\OC\Files\Filesystem::file_put_contents("test.txt", "test file");
$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 . '/test.txt.v' . $t1;
$v2 = self::USERS_VERSIONS_ROOT . '/test.txt.v' . $t2;
$v1Copied = self::USERS_VERSIONS_ROOT . '/test2.txt.v' . $t1;
$v2Copied = self::USERS_VERSIONS_ROOT . '/test2.txt.v' . $t2;
$this->rootView->file_put_contents($v1, 'version1');
$this->rootView->file_put_contents($v2, 'version2');
// execute copy hook of versions app
\OCA\Files_Versions\Storage::renameOrCopy("test.txt", "test2.txt", 'copy');
$this->assertTrue($this->rootView->file_exists($v1));
$this->assertTrue($this->rootView->file_exists($v2));
$this->assertTrue($this->rootView->file_exists($v1Copied));
$this->assertTrue($this->rootView->file_exists($v2Copied));
//cleanup
\OC\Files\Filesystem::unlink('test.txt');
\OC\Files\Filesystem::unlink('test2.txt');
}