From c936eebcf7c57cfca8c3ff2e7b97441351118640 Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Sun, 5 Apr 2009 20:43:05 +0000 Subject: Don't do graphics detection in core_installer::install() because that gets run at scaffolding::package() time, not on the target machine. Instead, create a core module variable to trigger running graphics::choose_default_toolkit() on the first admin login after install. Fixes ticket #206. --- core/helpers/graphics.php | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'core/helpers/graphics.php') diff --git a/core/helpers/graphics.php b/core/helpers/graphics.php index 290d2677..1caebc44 100644 --- a/core/helpers/graphics.php +++ b/core/helpers/graphics.php @@ -274,6 +274,29 @@ class graphics_Core { "graphicsmagick" => dirname(exec("which gm"))); } + /** + * This needs to be run once, after the initial install, to choose a graphics toolkit. + */ + static function choose_default_toolkit() { + // Detect a graphics toolkit + $toolkits = graphics::detect_toolkits(); + foreach (array("imagemagick", "graphicsmagick", "gd") as $tk) { + if ($toolkits[$tk]) { + module::set_var("core", "graphics_toolkit", $tk); + if ($tk != "gd") { + module::set_var("core", "graphics_toolkit_path", $toolkits[$tk]); + } + break; + } + } + if (!module::get_var("core", "graphics_toolkit")) { + site_status::warning( + t("Graphics toolkit missing! Please choose a toolkit", + array("url" => url::site("admin/graphics"))), + "missing_graphics_toolkit"); + } + } + /** * Choose which driver the Kohana Image library uses. */ -- cgit v1.2.3