]> source.dussan.org Git - nextcloud-server.git/commitdiff
Removed unused versions md5 code
authorVincent Petry <pvince81@owncloud.com>
Mon, 17 Feb 2014 11:03:16 +0000 (12:03 +0100)
committerVincent Petry <pvince81@owncloud.com>
Mon, 17 Feb 2014 11:03:16 +0000 (12:03 +0100)
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
apps/files_versions/templates/history.php

index 9efbe88c9c5fda64191027bd6302373dd37586ba..a03ccb823f78c5b923f1eae61efa93748d9304a0 100644 (file)
@@ -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 );
index 3a6d5f0c9e7baaae22bf7d94be22553ff10546fe..2e28beb79e2fdee3119b2fd093d17e7a8182b3af 100644 (file)
@@ -24,9 +24,6 @@ if( isset( $_['message'] ) ) {
                p(OCP\Util::formatDate( doubleval($v['version'])));
                print_unescaped(' <a href="'.OCP\Util::linkTo('files_versions', 'history.php',
                        array('path' => $_['path'], 'revert' => $v['version'])) .'" class="button">Revert</a><br /><br />');
-               if ( $v['cur'] ) {
-                       print_unescaped('  (<b>Current</b>)');
-               }
                print_unescaped('<br /><br />');
        }