www/nightly.adium.im 14:a5e3ec5aefc8: Sort files by date.

commits at adium.im commits at adium.im
Wed Nov 9 20:23:23 UTC 2011


details:	http://hg.adium.im/www/nightly.adium.im/rev/a5e3ec5aefc8
revision:	14:a5e3ec5aefc8
branch:		(none)
author:		Adrian Godoroja <robotive at me.com>
date:		Wed Nov 09 22:22:24 2011 +0200

Sort files by date.

diffs (31 lines):

diff -r 029a43e606d3 -r a5e3ec5aefc8 index.php
--- a/index.php	Thu Aug 18 10:44:49 2011 +0300
+++ b/index.php	Wed Nov 09 22:22:24 2011 +0200
@@ -25,6 +25,18 @@
     return array($repo, $branch);
 }
 
+function fsortmtime(&$files) {
+    $sortedFiles = array();
+  
+    foreach ($files as $file) {
+        $sortedFiles[filemtime($file)] = $file;
+    }
+
+    krsort($sortedFiles);
+    
+    return array_values($sortedFiles);
+}
+
 $repo_branch = sane_path($_GET['repo_branch'], 0);
 if (!$repo_branch) {
   $repo = sane_path($_GET['repo'], 'adium');
@@ -79,7 +91,7 @@
 			<th>MD5</th>
             <th>Uploaded</th>
         </tr>
-<?  $filelist = array_reverse(scandir($repo_branch));
+<?  $filelist = fsortmtime(scandir($repo_branch));
 
 	$alternating = 0;
 




More information about the commits mailing list