]> source.dussan.org Git - nextcloud-server.git/commitdiff
Merge branch 'master' into filecache_mtime
authorMichael Gapczynski <mtgap@owncloud.com>
Fri, 8 Mar 2013 20:28:45 +0000 (15:28 -0500)
committerMichael Gapczynski <mtgap@owncloud.com>
Fri, 8 Mar 2013 20:28:45 +0000 (15:28 -0500)
Conflicts:
lib/files/view.php
lib/util.php
tests/lib/files/cache/cache.php

1  2 
lib/files/cache/cache.php
lib/files/view.php
lib/util.php
tests/lib/files/cache/cache.php

Simple merge
index 3348244715eb4537d80dc35e38a7d81d9b2562b8,19f33ad64a2f3102700146aa2ac3e5866aa10061..3cea8b082dc996095a47667f074b9e7cc111a556
@@@ -245,11 -245,14 +245,15 @@@ class View 
                if (!is_null($mtime) and !is_numeric($mtime)) {
                        $mtime = strtotime($mtime);
                }
-               $result = $this->basicOperation('touch', $path, array('write'), $mtime);
 -              
+               $hooks = array('touch');
 -              
+               if (!$this->file_exists($path)) {
+                       $hooks[] = 'write';
+               }
 -              
 -              return $this->basicOperation('touch', $path, $hooks, $mtime);
++              $result = $this->basicOperation('touch', $path, $hooks, $mtime);
 +              if (!$result) { //if native touch fails, we emulate it by changing the mtime in the cache
 +                      $this->putFileInfo($path, array('mtime' => $mtime));
 +              }
 +              return true;
        }
  
        public function file_get_contents($path) {
diff --cc lib/util.php
index e739f76034c371798253f6f62b8db31e5577caac,47c02074a8ca268492a90d6b80a97eeaf3e05a0f..6ed3b8b942f5a5e7d42f1f558158e4c5edc00064
@@@ -73,9 -73,9 +73,9 @@@ class OC_Util 
         * @return array
         */
        public static function getVersion() {
-               // hint: We only can count up. So the internal version number
-               // of ownCloud 4.5 will be 4.90.0. This is not visible to the user
-               return array(4, 92, 11);
+               // hint: We only can count up. Reset minor/patchlevel when
+               // updating major/minor version number.
 -              return array(4, 97, 10);
++              return array(4, 97, 11);
        }
  
        /**
index 794664c8893d21df28e5c64d36a01c297b658cb5,250842805e5d32072fc253a5c6fc892baf008594..edcd1c487d0b9e28e6751537b1168430ba5dcef7
@@@ -204,23 -210,15 +210,32 @@@ class Cache extends \PHPUnit_Framework_
                $this->assertEquals(array($storageId, 'foo'), \OC\Files\Cache\Cache::getById($id));
        }
  
 +      function testStorageMTime() {
 +              $data = array('size' => 1000, 'mtime' => 20, 'mimetype' => 'foo/file');
 +              $this->cache->put('foo', $data);
 +              $cachedData = $this->cache->get('foo');
 +              $this->assertEquals($data['mtime'], $cachedData['storage_mtime']);//if no storage_mtime is saved, mtime should be used
 +
 +              $this->cache->put('foo', array('storage_mtime' => 30));//when setting storage_mtime, mtime is also set
 +              $cachedData = $this->cache->get('foo');
 +              $this->assertEquals(30, $cachedData['storage_mtime']);
 +              $this->assertEquals(30, $cachedData['mtime']);
 +
 +              $this->cache->put('foo', array('mtime' => 25));//setting mtime does not change storage_mtime
 +              $cachedData = $this->cache->get('foo');
 +              $this->assertEquals(30, $cachedData['storage_mtime']);
 +              $this->assertEquals(25, $cachedData['mtime']);
 +      }
 +
+       function testLongId() {
+               $storage = new LongId(array());
+               $cache = $storage->getCache();
+               $storageId = $storage->getId();
+               $data = array('size' => 1000, 'mtime' => 20, 'mimetype' => 'foo/file');
+               $id = $cache->put('foo', $data);
+               $this->assertEquals(array(md5($storageId), 'foo'), \OC\Files\Cache\Cache::getById($id));
+       }
        public function tearDown() {
                $this->cache->clear();
        }
                $this->storage = new \OC\Files\Storage\Temporary(array());
                $this->cache = new \OC\Files\Cache\Cache($this->storage);
        }
--}
++}