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


PHP Storage::touch方法代码示例

本文整理汇总了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');
 }
开发者ID:evanjt,项目名称:core,代码行数:29,代码来源:updater.php

示例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);
 }
开发者ID:GitHubUser4234,项目名称:core,代码行数:12,代码来源:Wrapper.php


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