summaryrefslogtreecommitdiff
path: root/core/controllers/welcome.php
diff options
context:
space:
mode:
Diffstat (limited to 'core/controllers/welcome.php')
-rw-r--r--core/controllers/welcome.php24
1 files changed, 20 insertions, 4 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 {