diff options
author | Bharat Mediratta <bharat@menalto.com> | 2011-01-10 14:04:15 -0800 |
---|---|---|
committer | Bharat Mediratta <bharat@menalto.com> | 2011-01-10 14:04:15 -0800 |
commit | bd6bd029a7c2e0247d4da931c49f3731498cd303 (patch) | |
tree | bcdb739944c34601f51ab885e88e195edd2fd2bf /modules | |
parent | 20ba7b6bee3f5800e73e88e1543856a646a3a973 (diff) |
Fix up the version detecting regex for GraphicsMagick and don't crash
if the regex doesn't return properly. Follow on to
3ec0ba956dced01a97f2ee7bd943d326c42350e3 for ticket #1595.
Diffstat (limited to 'modules')
-rw-r--r-- | modules/gallery/helpers/graphics.php | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/modules/gallery/helpers/graphics.php b/modules/gallery/helpers/graphics.php index a30699e8..29527705 100644 --- a/modules/gallery/helpers/graphics.php +++ b/modules/gallery/helpers/graphics.php @@ -321,16 +321,18 @@ class graphics_Core { // ImageMagick & GraphicsMagick $magick_kits = array( "imagemagick" => array( - "name" => "ImageMagick", "binary" => "convert", "version" => "convert -v"), + "name" => "ImageMagick", "binary" => "convert", "version" => "convert -v", + "version_regex" => "/Version: \S+ (\S+)/"), "graphicsmagick" => array( - "name" => "GraphicsMagick", "binary" => "gm", "version" => "gm version")); + "name" => "GraphicsMagick", "binary" => "gm", "version" => "gm version", + "version_regex" => "/\S+ (\S+)/")); // Loop through the kits foreach ($magick_kits as $index => $settings) { $path = exec("which " . $settings["binary"]); $toolkits->$index->name = $settings["name"]; if ($path) { - if (@is_file($path)) { - preg_match('/Version: \S+ (\S+)/', shell_exec($settings["version"]), $matches); + if (@is_file($path) && + preg_match($settings["version_regex"], shell_exec($settings["version"]), $matches)) { $version = $matches[1]; $toolkits->$index->installed = true; |