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/controllers/admin_graphics.php | 4 ++-- core/helpers/core_installer.php | 19 +------------------ core/helpers/graphics.php | 23 +++++++++++++++++++++++ core/views/admin_graphics_none.html.php | 7 +++++++ 4 files changed, 33 insertions(+), 20 deletions(-) create mode 100644 core/views/admin_graphics_none.html.php (limited to 'core') diff --git a/core/controllers/admin_graphics.php b/core/controllers/admin_graphics.php index 1624c896..6676a808 100644 --- a/core/controllers/admin_graphics.php +++ b/core/controllers/admin_graphics.php @@ -24,8 +24,8 @@ class Admin_Graphics_Controller extends Admin_Controller { $view->content->available = ""; $tk = new ArrayObject(graphics::detect_toolkits(), ArrayObject::ARRAY_AS_PROPS); - $active = module::get_var("core", "graphics_toolkit"); - foreach (array("gd", "imagemagick", "graphicsmagick") as $id) { + $active = module::get_var("core", "graphics_toolkit", "none"); + foreach (array("gd", "imagemagick", "graphicsmagick", "none") as $id) { if ($id == $active) { $view->content->active = new View("admin_graphics_$id.html"); $view->content->active->tk = $tk; diff --git a/core/helpers/core_installer.php b/core/helpers/core_installer.php index 7bdcd376..8775cafe 100644 --- a/core/helpers/core_installer.php +++ b/core/helpers/core_installer.php @@ -224,24 +224,6 @@ class core_installer { array("width" => 640, "height" => 480, "master" => Image::AUTO), 100); - // 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"); - } - // Instantiate default themes (site and admin) foreach (array("default", "admin_default") as $theme_name) { $theme_info = new ArrayObject(parse_ini_file(THEMEPATH . $theme_name . "/theme.info"), @@ -262,6 +244,7 @@ class core_installer { module::set_version("core", 1); module::set_var("core", "version", "3.0 pre-beta svn"); + module::set_var("core", "choose_default_tookit", 1); } } 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. */ diff --git a/core/views/admin_graphics_none.html.php b/core/views/admin_graphics_none.html.php new file mode 100644 index 00000000..5306a70d --- /dev/null +++ b/core/views/admin_graphics_none.html.php @@ -0,0 +1,7 @@ + +
+

+

+ +

+
-- cgit v1.2.3