From f7e91518a63805c85d9b617eb8e66d1c762e0161 Mon Sep 17 00:00:00 2001 From: Vincent Petry Date: Mon, 17 Feb 2014 12:03:16 +0100 Subject: [PATCH] Removed unused versions md5 code It looks like md5 was used previously to identify the most recent file in the versions list, which seem to be old code, as now the versions list doesn't contain the current file any more. This fix removes the md5 code which caused performance issues with big files. --- apps/files_versions/lib/versions.php | 19 ------------------- apps/files_versions/templates/history.php | 3 --- 2 files changed, 22 deletions(-) diff --git a/apps/files_versions/lib/versions.php b/apps/files_versions/lib/versions.php index 9efbe88c9c5..a03ccb823f7 100644 --- a/apps/files_versions/lib/versions.php +++ b/apps/files_versions/lib/versions.php @@ -256,35 +256,16 @@ class Storage { sort( $matches ); $files_view = new \OC\Files\View('/'.$uid.'/files'); - $local_file = $files_view->getLocalFile($filename); - $local_file_md5 = \md5_file( $local_file ); foreach( $matches as $ma ) { $parts = explode( '.v', $ma ); $version = ( end( $parts ) ); $key = $version.'#'.$filename; - $versions[$key]['cur'] = 0; $versions[$key]['version'] = $version; $versions[$key]['path'] = $filename; $versions[$key]['size'] = $versions_fileview->filesize($filename.'.v'.$version); - - // if file with modified date exists, flag it in array as currently enabled version - ( \md5_file( $ma ) == $local_file_md5 ? $versions[$key]['fileMatch'] = 1 : $versions[$key]['fileMatch'] = 0 ); - - } - - $versions = array_reverse( $versions ); - - foreach( $versions as $key => $value ) { - // flag the first matched file in array (which will have latest modification date) as current version - if ( $value['fileMatch'] ) { - $value['cur'] = 1; - break; - } } - $versions = array_reverse( $versions ); - // only show the newest commits if( $count != 0 and ( count( $versions )>$count ) ) { $versions = array_slice( $versions, count( $versions ) - $count ); diff --git a/apps/files_versions/templates/history.php b/apps/files_versions/templates/history.php index 3a6d5f0c9e7..2e28beb79e2 100644 --- a/apps/files_versions/templates/history.php +++ b/apps/files_versions/templates/history.php @@ -24,9 +24,6 @@ if( isset( $_['message'] ) ) { p(OCP\Util::formatDate( doubleval($v['version']))); print_unescaped(' Revert

'); - if ( $v['cur'] ) { - print_unescaped(' (Current)'); - } print_unescaped('

'); } -- 2.39.5