Changeset 951 for trunk/contrib/compress.php
- Timestamp:
- 01/27/08 17:13:50 (4 years ago)
- Files:
-
- 1 modified
-
trunk/contrib/compress.php (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/contrib/compress.php
r905 r951 1 1 <? 2 2 die("Run this script to batch-compress the current Xinha snapshot. To run the script, open the file and comment out the die() command"); 3 3 $repository_url = 'http://svn.xinha.webfactional.com/trunk'; 4 $version =''; 5 $date = date('r'); 4 6 error_reporting(E_ALL); 5 7 ini_set('show_errors',1); 6 8 7 9 $return = array(); 8 function scan($dir, $durl = '',$min_size=" 3000")10 function scan($dir, $durl = '',$min_size="0") 9 11 { 10 12 static $seen = array(); … … 48 50 scan("../"); 49 51 $cwd = getcwd(); 52 53 $root_dir = realpath($cwd.'/..'); 54 50 55 print "Processing ".count($return)." files<br />"; 51 56 52 $prefix = "/* This compressed file is part of Xinha. For uncomressed sources, forum, and bug reports, go to xinha.org */"; 57 $prefix = "/* This compressed file is part of Xinha. For uncompressed sources, forum, and bug reports, go to xinha.org */"; 58 if ($version) $prefix .= "\n/* This file is part of version $version released $date */"; 59 53 60 $core_prefix = ' 54 61 /*-------------------------------------------------------------------------- … … 58 65 -- BSD license) please read license.txt in this package for details. 59 66 -- 60 -- Copyright (c) 2005-200 7Xinha Developer Team and contributors67 -- Copyright (c) 2005-2008 Xinha Developer Team and contributors 61 68 -- 62 69 -- Xinha was originally based on work by Mihai Bazon which is: … … 71 78 print "Processed $file<br />"; 72 79 flush(); 80 $file_url = $repository_url.str_replace($root_dir,'',$file); 81 73 82 copy($file,$file."_uncompr.js"); 74 75 exec("echo \"".(preg_match('/XinhaCore.js$/',$file) ? $prefix.$core_prefix : $prefix)."\" > $file && java -jar ${cwd}/dojo_js_compressor.jar -c ${file}_uncompr.js >> $file 2>&1"); 83 84 $file_prefix = $prefix."\n/* The URL of the most recent version of this file is $file_url */"; 85 86 exec("echo \"".(preg_match('/XinhaCore.js$/',$file) ? $file_prefix.$core_prefix : $file_prefix)."\" > $file && java -jar ${cwd}/dojo_js_compressor.jar -c ${file}_uncompr.js >> $file 2>&1"); 76 87 if (preg_match('/js: ".*?", line \d+:/',file_get_contents($file))) 77 88 { … … 83 94 unlink($file."_uncompr.js"); 84 95 } 96 85 97 } 86 98 print "Operation complete."
