diff options
-rw-r--r-- | core/controllers/welcome.php | 24 | ||||
-rw-r--r-- | core/views/welcome.html.php | 2 | ||||
-rw-r--r-- | core/views/welcome_syscheck.html.php | 35 |
3 files changed, 53 insertions, 8 deletions
diff --git a/core/controllers/welcome.php b/core/controllers/welcome.php index 061a4176..93670cfe 100644 --- a/core/controllers/welcome.php +++ b/core/controllers/welcome.php @@ -18,14 +18,30 @@ * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ class Welcome_Controller extends Template_Controller { - public $template = 'welcome.html'; + public $template = "welcome.html"; function index() { - $this->template->syscheck = new View('welcome_syscheck.html'); + $this->template->syscheck = new View("welcome_syscheck.html"); $this->template->syscheck->errors = $this->_get_config_errors(); + + try { + $this->template->syscheck->modules = ORM::factory("module")->find_all(); + } catch (Exception $e) { + $this->template->syscheck->modules = array(); + } $this->_create_directories(); } + function install($module) { + call_user_func(array("{$module}_installer", "install")); + url::redirect("welcome"); + } + + function uninstall($module) { + call_user_func(array("{$module}_installer", "uninstall")); + url::redirect("welcome"); + } + private function _get_config_errors() { $errors = array(); if (!file_exists(VARPATH)) { @@ -56,13 +72,13 @@ class Welcome_Controller extends Template_Controller { $error->message2 = "Then edit this file and enter your database configuration settings."; $errors[] = $error; } else { - $old_handler = set_error_handler(array('Welcome_Controller', '_error_handler')); + $old_handler = set_error_handler(array("Welcome_Controller", "_error_handler")); try { Database::instance()->connect(); } catch (Exception $e) { $error = new stdClass(); $error->message = "Database error: {$e->getMessage()}"; - $db_name = Kohana::config('database.default.connection.database'); + $db_name = Kohana::config("database.default.connection.database"); if (strchr($error->message, "Unknown database")) { $error->instructions[] = "mysqladmin -uroot create $db_name"; } else { diff --git a/core/views/welcome.html.php b/core/views/welcome.html.php index 9b77ce20..957b091c 100644 --- a/core/views/welcome.html.php +++ b/core/views/welcome.html.php @@ -27,7 +27,6 @@ p { margin: 0 0 0 0; - padding-left: 1em; } pre { @@ -49,6 +48,7 @@ div.block { padding: 0px; + padding-left: 1em; margin: 0px; padding-bottom: 1em; } diff --git a/core/views/welcome_syscheck.html.php b/core/views/welcome_syscheck.html.php index 3a6b352c..7355e431 100644 --- a/core/views/welcome_syscheck.html.php +++ b/core/views/welcome_syscheck.html.php @@ -15,8 +15,37 @@ <? endif ?> </div> <? endforeach ?> + <? if (empty($errors)): ?> -<p class="success"> - Your system is ready to go. -</p> +<div class="block"> + <? if (empty($modules)): ?> + <p class="success"> + Your system is ready, but Gallery is not yet installed. + </p> + <p> + <?= html::anchor("welcome/install/core", "install gallery") ?> + </p> + <? else: ?> + <p class="success"> + Your Gallery is ready with the following modules installed: + </p> + <table style="width: 400px"> + <tr> + <th align="left">Name</th> + <th align="left">Version</th> + <th align="left">Action</th> + </tr> + <? foreach ($modules as $module): ?> + <tr> + <td><?= $module->name ?></td> + <td><?= $module->version ?></td> + <td> + <?= html::anchor("welcome/install/{$module->name}", "install") ?>, + <?= html::anchor("welcome/uninstall/{$module->name}", "uninstall") ?> + </td> + </tr> + <? endforeach; ?> + </table> + <? endif; ?> +</div> <? endif ?> |