diff options
author | Klaas Freitag <freitag@owncloud.com> | 2012-02-10 11:30:38 +0100 |
---|---|---|
committer | Klaas Freitag <freitag@owncloud.com> | 2012-02-10 11:30:38 +0100 |
commit | 85853f9ec29be9a2ba92737de204da1469f72dd8 (patch) | |
tree | 754f80507e5c27cf102e6b18ced9e8a473eb069e /lib/connector | |
parent | 9379c3e1284d2d9250af4e5d406a7f6803309fad (diff) | |
download | nextcloud-server-85853f9ec29be9a2ba92737de204da1469f72dd8.tar.gz nextcloud-server-85853f9ec29be9a2ba92737de204da1469f72dd8.zip |
- Added the ability to change a files mtime via webdavs propset.
- Added some minor debug help to fscache
Diffstat (limited to 'lib/connector')
-rw-r--r-- | lib/connector/sabre/node.php | 30 |
1 files changed, 23 insertions, 7 deletions
diff --git a/lib/connector/sabre/node.php b/lib/connector/sabre/node.php index ace572a1ee3..b8b675c1203 100644 --- a/lib/connector/sabre/node.php +++ b/lib/connector/sabre/node.php @@ -92,6 +92,19 @@ abstract class OC_Connector_Sabre_Node implements Sabre_DAV_INode, Sabre_DAV_IPr } + /** + * sets the last modification time of the file (mtime) to the value given + * in the second parameter or to now if the second param is empty. + * Even if the modification time is set to a custom value the access time is set to now. + */ + public function setLastModifiedTime($mtime) { + OC_Filesystem::setFileMtime($this->path, $mtime); + } + + public function endsWith( $str, $sub ) { + return ( substr( $str, strlen( $str ) - strlen( $sub ) ) === $sub ); + } + /** * Updates properties on this node, * @@ -110,13 +123,16 @@ abstract class OC_Connector_Sabre_Node implements Sabre_DAV_INode, Sabre_DAV_IPr } } else { - if(!array_key_exists( $propertyName, $existing )){ - $query = OC_DB::prepare( 'INSERT INTO *PREFIX*properties (userid,propertypath,propertyname,propertyvalue) VALUES(?,?,?,?)' ); - $query->execute( array( OC_User::getUser(), $this->path, $propertyName,$propertyValue )); - } - else{ - $query = OC_DB::prepare( 'UPDATE *PREFIX*properties SET propertyvalue = ? WHERE userid = ? AND propertypath = ? AND propertyname = ?' ); - $query->execute( array( $propertyValue,OC_User::getUser(), $this->path, $propertyName )); + if( $this->endsWith( $propertyName, "modificationTime")) { + $this->setLastModifiedTime($propertyValue); + } else { + if(!array_key_exists( $propertyName, $existing )){ + $query = OC_DB::prepare( 'INSERT INTO *PREFIX*properties (userid,propertypath,propertyname,propertyvalue) VALUES(?,?,?,?)' ); + $query->execute( array( OC_User::getUser(), $this->path, $propertyName,$propertyValue )); + } else { + $query = OC_DB::prepare( 'UPDATE *PREFIX*properties SET propertyvalue = ? WHERE userid = ? AND propertypath = ? AND propertyname = ?' ); + $query->execute( array( $propertyValue,OC_User::getUser(), $this->path, $propertyName )); + } } } |