]> source.dussan.org Git - nextcloud-server.git/commitdiff
Only calculate md5 of local file once
authorBart Visscher <bartv@thisnet.nl>
Wed, 19 Sep 2012 19:26:24 +0000 (21:26 +0200)
committerBart Visscher <bartv@thisnet.nl>
Tue, 5 Feb 2013 16:56:51 +0000 (17:56 +0100)
apps/files_versions/lib/versions.php

index 1db0a8fef89dd1a36df2a1dfc12760f2a400bf93..ca7eb9e73546c7ecbb1ad9e4df339e41c9459bd5 100644 (file)
@@ -195,6 +195,7 @@ class Storage {
 
                        $files_view = new \OC_FilesystemView('/'.$uid.'/files');
                        $local_file = $files_view->getLocalFile($filename);
+                       $local_file_md5 = \md5_file( $local_file );
 
                        foreach( $matches as $ma ) {
                                $parts = explode( '.v', $ma );
@@ -206,7 +207,7 @@ class Storage {
                                $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 ) == \md5_file( $local_file ) ? $versions[$key]['fileMatch'] = 1 : $versions[$key]['fileMatch'] = 0 );
+                               ( \md5_file( $ma ) == $local_file_md5 ? $versions[$key]['fileMatch'] = 1 : $versions[$key]['fileMatch'] = 0 );
 
                        }