本文整理汇总了PHP中OC\Files\Storage\Storage::touch方法的典型用法代码示例。如果您正苦于以下问题:PHP Storage::touch方法的具体用法?PHP Storage::touch怎么用?PHP Storage::touch使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OC\Files\Storage\Storage
的用法示例。
在下文中一共展示了Storage::touch方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testUpdateStorageMTime
public function testUpdateStorageMTime()
{
$this->storage->mkdir('sub');
$this->storage->mkdir('sub2');
$this->storage->file_put_contents('sub/foo.txt', 'qwerty');
$this->updater->update('sub');
$this->updater->update('sub/foo.txt');
$this->updater->update('sub2');
$cachedSourceParent = $this->cache->get('sub');
$cachedSource = $this->cache->get('sub/foo.txt');
$this->storage->rename('sub/foo.txt', 'sub2/bar.txt');
// simulate storage having a different mtime
$testmtime = 1433323578;
// source storage mtime change
$this->storage->touch('sub', $testmtime);
// target storage mtime change
$this->storage->touch('sub2', $testmtime);
// some storages (like Dropbox) change storage mtime on rename
$this->storage->touch('sub2/bar.txt', $testmtime);
$this->updater->renameFromStorage($this->storage, 'sub/foo.txt', 'sub2/bar.txt');
$cachedTargetParent = $this->cache->get('sub2');
$cachedTarget = $this->cache->get('sub2/bar.txt');
$this->assertEquals($cachedSource['mtime'], $cachedTarget['mtime'], 'file mtime preserved');
$this->assertNotEquals($cachedTarget['storage_mtime'], $cachedTarget['mtime'], 'mtime is not storage_mtime for moved file');
$this->assertEquals($testmtime, $cachedTarget['storage_mtime'], 'target file storage_mtime propagated');
$this->assertNotEquals($testmtime, $cachedTarget['mtime'], 'target file mtime changed, not from storage');
$this->assertEquals($testmtime, $cachedTargetParent['storage_mtime'], 'target parent storage_mtime propagated');
$this->assertNotEquals($testmtime, $cachedTargetParent['mtime'], 'target folder mtime changed, not from storage');
}
示例2: touch
/**
* see http://php.net/manual/en/function.touch.php
* If the backend does not support the operation, false should be returned
*
* @param string $path
* @param int $mtime
* @return bool
*/
public function touch($path, $mtime = null)
{
return $this->storage->touch($path, $mtime);
}