mirror of
https://github.com/mrclay/minify.git
synced 2025-08-25 23:06:14 +02:00
Added some two exceptions :
* when java cannot be executed * When execution result_code of yui compressor is not 0 (i.e execution success).
This commit is contained in:
@@ -90,8 +90,11 @@ class Minify_YUICompressor {
|
|||||||
throw new Exception('Minify_YUICompressor : could not create temp file.');
|
throw new Exception('Minify_YUICompressor : could not create temp file.');
|
||||||
}
|
}
|
||||||
file_put_contents($tmpFile, $content);
|
file_put_contents($tmpFile, $content);
|
||||||
exec(self::_getCmd($options, $type, $tmpFile), $output);
|
exec(self::_getCmd($options, $type, $tmpFile), $output, $result_code);
|
||||||
unlink($tmpFile);
|
unlink($tmpFile);
|
||||||
|
if($result_code != 0){
|
||||||
|
throw new Exception('Minify_YUICompressor : YUI compressor execution failed.');
|
||||||
|
}
|
||||||
return implode("\n", $output);
|
return implode("\n", $output);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -131,6 +134,9 @@ class Minify_YUICompressor {
|
|||||||
if (! is_file(self::$jarFile)) {
|
if (! is_file(self::$jarFile)) {
|
||||||
throw new Exception('Minify_YUICompressor : $jarFile('.self::$jarFile.') is not a valid file.');
|
throw new Exception('Minify_YUICompressor : $jarFile('.self::$jarFile.') is not a valid file.');
|
||||||
}
|
}
|
||||||
|
if (! is_executable(self::$jarFile)) {
|
||||||
|
throw new Exception('Minify_YUICompressor : $jarFile('.self::$jarFile.') is not executable.');
|
||||||
|
}
|
||||||
if (! is_dir(self::$tempDir)) {
|
if (! is_dir(self::$tempDir)) {
|
||||||
throw new Exception('Minify_YUICompressor : $tempDir('.self::$tempDir.') is not a valid direcotry.');
|
throw new Exception('Minify_YUICompressor : $tempDir('.self::$tempDir.') is not a valid direcotry.');
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user