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


PHP Storage::rename方法代码示例

本文整理汇总了PHP中OC\Files\Storage\Storage::rename方法的典型用法代码示例。如果您正苦于以下问题:PHP Storage::rename方法的具体用法?PHP Storage::rename怎么用?PHP Storage::rename使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在OC\Files\Storage\Storage的用法示例。


在下文中一共展示了Storage::rename方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: testMoveDisabled

 public function testMoveDisabled()
 {
     $this->storage->file_put_contents('foo.txt', 'qwerty');
     $this->updater->update('foo.txt');
     $this->assertTrue($this->cache->inCache('foo.txt'));
     $this->assertFalse($this->cache->inCache('bar.txt'));
     $cached = $this->cache->get('foo.txt');
     $this->storage->rename('foo.txt', 'bar.txt');
     $this->assertTrue($this->cache->inCache('foo.txt'));
     $this->assertFalse($this->cache->inCache('bar.txt'));
     $this->updater->disable();
     $this->updater->rename('foo.txt', 'bar.txt');
     $this->assertTrue($this->cache->inCache('foo.txt'));
     $this->assertFalse($this->cache->inCache('bar.txt'));
 }
开发者ID:adolfo2103,项目名称:hcloudfilem,代码行数:15,代码来源:updater.php

示例3: testMove

 public function testMove()
 {
     $this->storage->file_put_contents('foo.txt', 'qwerty');
     $this->updater->update('foo.txt');
     $this->assertTrue($this->cache->inCache('foo.txt'));
     $this->assertFalse($this->cache->inCache('bar.txt'));
     $cached = $this->cache->get('foo.txt');
     $this->storage->rename('foo.txt', 'bar.txt');
     $this->assertTrue($this->cache->inCache('foo.txt'));
     $this->assertFalse($this->cache->inCache('bar.txt'));
     $this->updater->rename('foo.txt', 'bar.txt');
     $this->assertFalse($this->cache->inCache('foo.txt'));
     $this->assertTrue($this->cache->inCache('bar.txt'));
     $cachedTarget = $this->cache->get('bar.txt');
     $this->assertEquals($cached['etag'], $cachedTarget['etag']);
     $this->assertEquals($cached['mtime'], $cachedTarget['mtime']);
     $this->assertEquals($cached['size'], $cachedTarget['size']);
     $this->assertEquals($cached['fileid'], $cachedTarget['fileid']);
 }
开发者ID:Combustible,项目名称:core,代码行数:19,代码来源:updater.php

示例4: rename

 /**
  * see http://php.net/manual/en/function.rename.php
  *
  * @param string $path1
  * @param string $path2
  * @return bool
  */
 public function rename($path1, $path2)
 {
     return $this->storage->rename($path1, $path2);
 }
开发者ID:GitHubUser4234,项目名称:core,代码行数:11,代码来源:Wrapper.php


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