Skip to content
Snippets Groups Projects
Commit 9c83b307 authored by Björn Schießle's avatar Björn Schießle
Browse files

keep mtime

parent 2ddd40ed
No related branches found
No related tags found
No related merge requests found
...@@ -119,8 +119,9 @@ class Trashbin { ...@@ -119,8 +119,9 @@ class Trashbin {
// we need a extension in case a file/dir with the same name already exists // we need a extension in case a file/dir with the same name already exists
$ext = self::getUniqueExtension($location, $filename, $view); $ext = self::getUniqueExtension($location, $filename, $view);
$mtime = $view->filemtime($source);
if( $view->rename($source, $target.$ext) ) { if( $view->rename($source, $target.$ext) ) {
$view->touch($target.$ext, $mtime);
// if versioning app is enabled, copy versions from the trash bin back to the original location // if versioning app is enabled, copy versions from the trash bin back to the original location
if ( \OCP\App::isEnabled('files_versions') ) { if ( \OCP\App::isEnabled('files_versions') ) {
if ( $result[0]['type'] == 'dir' ) { if ( $result[0]['type'] == 'dir' ) {
...@@ -189,21 +190,23 @@ class Trashbin { ...@@ -189,21 +190,23 @@ class Trashbin {
* @param $source source path, relative to the users files directory * @param $source source path, relative to the users files directory
* @param $destination destination path relative to the users root directoy * @param $destination destination path relative to the users root directoy
* @param $view file view for the users root directory * @param $view file view for the users root directory
* @param $location location of the source files, either "fscache" or "local"
*/ */
private static function copy_recursive( $source, $destination, $view, $location='fscache' ) { private static function copy_recursive( $source, $destination, $view ) {
if ( $view->is_dir( 'files'.$source ) ) { if ( $view->is_dir( 'files'.$source ) ) {
$view->mkdir( $destination ); $view->mkdir( $destination );
$view->touch($destination, $view->filemtime('files'.$source));
foreach ( \OC_Files::getDirectoryContent($source) as $i ) { foreach ( \OC_Files::getDirectoryContent($source) as $i ) {
$pathDir = $source.'/'.$i['name']; $pathDir = $source.'/'.$i['name'];
if ( $view->is_dir('files'.$pathDir) ) { if ( $view->is_dir('files'.$pathDir) ) {
self::copy_recursive($pathDir, $destination.'/'.$i['name'], $view); self::copy_recursive($pathDir, $destination.'/'.$i['name'], $view);
} else { } else {
$view->copy( 'files'.$pathDir, $destination . '/' . $i['name'] ); $view->copy( 'files'.$pathDir, $destination . '/' . $i['name'] );
$view->touch($destination . '/' . $i['name'], $view->filemtime('files'.$pathDir));
} }
} }
} else { } else {
$view->copy( 'files'.$source, $destination ); $view->copy( 'files'.$source, $destination );
$view->touch($destination, $view->filemtime('files'.$source));
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment