slitaz-forge rev 280

dir-generator.php: output cache
author Pascal Bellard <pascal.bellard@slitaz.org>
date Sat Apr 14 15:30:37 2012 +0200 (2012-04-14)
parents 6dca1262684e
children 0c60de3b50be
files mirror/floppies/mkindex.sh mirror/root/dir-generator.php
line diff
     1.1 --- a/mirror/floppies/mkindex.sh	Fri Apr 13 21:59:08 2012 +0000
     1.2 +++ b/mirror/floppies/mkindex.sh	Sat Apr 14 15:30:37 2012 +0200
     1.3 @@ -26,8 +26,8 @@
     1.4  	<meta name="description" content="slitaz$LORAM boot floppies $VERSION" />
     1.5  	<meta name="robots" content="index, nofollow" />
     1.6  	<meta name="author" content="SliTaz Contributors" />
     1.7 -	<link rel="shortcut icon" href="/static/favicon.ico" />
     1.8 -	<link rel="stylesheet" type="text/css" href="/static/slitaz.css" />
     1.9 +	<link rel="shortcut icon" href="static/favicon.ico" />
    1.10 +	<link rel="stylesheet" type="text/css" href="static/slitaz.css" />
    1.11  	<link rel="stylesheet" type="text/css" href="menu.css" />
    1.12  	<style type="text/css">
    1.13  table {
    1.14 @@ -53,7 +53,7 @@
    1.15  	    <ul id="menu">
    1.16  	      <li>
    1.17  		<a href="http://www.slitaz.org/">
    1.18 -		<img src="/static/home.png" alt="[ home ]" /></a>
    1.19 +		<img src="static/home.png" alt="[ home ]" /></a>
    1.20  	      </li>
    1.21  	      <li>
    1.22  		<a href="floppy-grub4dos" title="Boot tools">Generic boot floppy</a>
    1.23 @@ -222,7 +222,7 @@
    1.24  <!-- Bottom and logo's -->
    1.25  <div id="bottom">
    1.26  <p>
    1.27 -<a href="http://validator.w3.org/check?uri=referer"><img src="/static/xhtml10.png" alt="Valid XHTML 1.0" title="Code validé XHTML 1.0" style="width: 80px; height: 15px;" /></a>
    1.28 +<a href="http://validator.w3.org/check?uri=referer"><img src="static/xhtml10.png" alt="Valid XHTML 1.0" title="Code validé XHTML 1.0" style="width: 80px; height: 15px;" /></a>
    1.29  </p>
    1.30  </div>
    1.31  
     2.1 --- a/mirror/root/dir-generator.php	Fri Apr 13 21:59:08 2012 +0000
     2.2 +++ b/mirror/root/dir-generator.php	Sat Apr 14 15:30:37 2012 +0200
     2.3 @@ -292,29 +292,41 @@
     2.4  {
     2.5  	exec("[ -f '".$path."' ]", $tmp, $ret);
     2.6  	return $ret == 0;
     2.7 +//return is_file($path);
     2.8  }
     2.9  
    2.10  function my_filesize($path)	// 2G+ file support
    2.11  {
    2.12  	return rtrim(shell_exec("stat -Lc %s '".$path."'"));
    2.13 +//return filesize($path);
    2.14  }
    2.15  
    2.16  function my_filemtime($path)	// 2G+ file support
    2.17  {
    2.18  	return rtrim(shell_exec("stat -Lc %Y '".$path."'"));
    2.19 +//return filemtime($path);
    2.20  }
    2.21  
    2.22  function my_filemtimeasc($path)	// 2G+ file support
    2.23  {
    2.24 -	return rtrim(shell_exec("date -r '".$path."' '+%Y-%b-%d %H:%M:%S'"));
    2.25 +	return rtrim(shell_exec("LC_ALL=C date -r '".$path."' '+%Y-%b-%d %H:%M:%S'"));
    2.26 +//return date('Y-M-d H:m:s', filemtime($path));
    2.27  }
    2.28  
    2.29 +if (filesize($path.".folderlist") > 0 && filesize($path.".filelist") > 0) {
    2.30 +	$folderlist = unserialize(file_get_contents($path.".folderlist"));
    2.31 +	$filelist = unserialize(file_get_contents($path.".filelist"));
    2.32 +}
    2.33 +else {
    2.34 +
    2.35  // Get all of the folders and files. 
    2.36  $folderlist = array();
    2.37  $filelist = array();
    2.38  if($handle = @opendir($path)) {
    2.39  	while(($item = readdir($handle)) !== false) {
    2.40  		if ($item == "index.php") continue;
    2.41 +		if ($item == ".folderlist") continue;
    2.42 +		if ($item == ".filelist") continue;
    2.43  		if ($item == "dir-generator.php") continue;
    2.44  		if (isset($_GET['f'])) {
    2.45  			$filter = $_GET['f'];
    2.46 @@ -347,6 +359,9 @@
    2.47  		}
    2.48  	}
    2.49  	closedir($handle);
    2.50 +	file_put_contents($path.".folderlist",serialize($folderlist),LOCK_EX);
    2.51 +	file_put_contents($path.".filelist",serialize($filelist),LOCK_EX);
    2.52 +}
    2.53  }
    2.54  
    2.55