From caf4f096f7aa29a8bf0c0a985519fc5c7b82845a Mon Sep 17 00:00:00 2001 From: Alan Knowles Date: Fri, 22 Jul 2011 16:33:05 +0800 Subject: [PATCH] JsCompile.php --- JsCompile.php | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) diff --git a/JsCompile.php b/JsCompile.php index a00a10a9..273d6d09 100644 --- a/JsCompile.php +++ b/JsCompile.php @@ -138,6 +138,57 @@ class Pman_Core_JsCompile extends Pman } + } + /** + * wrapper arroudn packer... + * @param {Array} map of $files => filemtime the files to pack + * @param {String} $output name fo file to output + * + */ + function packCssCore($files, $output) + { + + + $o = HTML_FlexyFramework::get()->Pman_Core; + + if (empty($o['jspacker']) || !file_exists($o['jspacker'].'/pack.js')) { + echo ''; + return false; + + } + require_once 'System.php'; + $seed= System::which('seed'); + if (!$seed) { + echo ''; + return false; + + } + $targetm = file_exists($output) ? filemtime($output) : 0; + $max = 0; + $ofiles = array(); + foreach($files as $f => $mt) { + $max = max($max,$mt); + $ofiles[] = escapeshellarg($f); + } + if ($max < $targetm) { + return true; + } + if (!file_exists(dirname($output))) { + mkdir(dirname($output), 0755, true); + } + $eoutput = escapeshellarg($output); + $cmd = "$seed {$o['jspacker']}/pack.js -o $eoutput " . implode($ofiles, ' '); + //echo "
$cmd\n";
+        //echo `$cmd`;
+        `$cmd`;
+        
+        
+        // we should do more checking.. return val etc..
+        if (file_exists($output) && ($max < filemtime($output) ) ) {
+            return true;
+        }
+        return false;
+        
     }
     /**
      * wrapper arroudn packer...
-- 
2.39.2