summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
Diffstat (limited to 'core')
-rw-r--r--core/controllers/welcome.php42
-rw-r--r--core/helpers/access.php8
-rw-r--r--core/helpers/module.php16
-rw-r--r--core/views/welcome.html.php2
-rw-r--r--core/views/welcome_syscheck.html.php2
5 files changed, 42 insertions, 28 deletions
diff --git a/core/controllers/welcome.php b/core/controllers/welcome.php
index 7730d254..8f8421d3 100644
--- a/core/controllers/welcome.php
+++ b/core/controllers/welcome.php
@@ -62,15 +62,27 @@ class Welcome_Controller extends Template_Controller {
}
function install($module_name) {
+ $to_install = array();
if ($module_name == "*") {
foreach ($this->_read_modules() as $module_name => $version) {
if (empty($version)) {
- Kohana::log("debug", "${module_name}_install (initial)");
- call_user_func(array("${module_name}_installer", "install"));
+ $to_install[] = $module_name;
}
}
} else {
- call_user_func(array("{$module_name}_installer", "install"));
+ $to_install[] = $module_name;
+ }
+
+ foreach ($to_install as $module_name) {
+ if ($module_name != "core") {
+ require_once(DOCROOT . "modules/${module_name}/helpers/${module_name}_installer.php");
+ }
+ $modules = Kohana::config('core.modules');
+ $modules[] = MODPATH . $module_name;
+ Kohana::config_set('core.modules', $modules);
+
+ Kohana::log("debug", "${module_name}_install (initial)");
+ call_user_func(array("${module_name}_installer", "install"));
}
url::redirect("welcome");
@@ -371,15 +383,11 @@ class Welcome_Controller extends Template_Controller {
* @return array(moduleId => version)
*/
private function _read_modules() {
- $modules = array();
+ $modules = module::available();
try {
- $installed = module::installed();
- foreach ($installed as $installed_module) {
+ foreach (module::installed() as $installed_module) {
$modules[$installed_module->name] = $installed_module->version;
}
-
- $modules = module::available($modules);
-
} catch (Exception $e) {
// The database may not be installed
}
@@ -388,31 +396,31 @@ class Welcome_Controller extends Template_Controller {
}
private function _load_group_info() {
- try {
+ if (class_exists("Group_Model")) {
$this->template->groups = ORM::factory("group")->find_all();
- } catch (Exception $e) {
+ } else {
$this->template->groups = array();
}
}
private function _load_user_info() {
- try {
+ if (class_exists("User_Model")) {
$this->template->users = ORM::factory("user")->find_all();
- } catch (Exception $e) {
+ } else {
$this->template->users = array();
}
}
private function _load_comment_info() {
- try {
+ if (class_exists("Comment_Model")) {
$this->template->comment_count = ORM::factory("comment")->count_all();
- } catch (Exception $e) {
+ } else {
$this->template->comment_count = 0;
}
}
private function _load_tag_info() {
- try {
+ if (class_exists("Tag_Model")) {
$this->template->tag_count = ORM::factory("tag")->count_all();
$this->template->most_tagged = Database::instance()
->select("item_id AS id", "COUNT(tag_id) AS count")
@@ -422,7 +430,7 @@ class Welcome_Controller extends Template_Controller {
->limit(1)
->get()
->current();
- } catch (Exception $e) {
+ } else {
$this->template->tag_count = 0;
$this->template->most_tagged = 0;
}
diff --git a/core/helpers/access.php b/core/helpers/access.php
index 95b9819c..e859b1d5 100644
--- a/core/helpers/access.php
+++ b/core/helpers/access.php
@@ -162,7 +162,7 @@ class access_Core {
foreach (self::_get_all_groups() as $group) {
self::_add_columns($perm_name, $group->id);
}
- self::_add_columns($perm_name, group::EVERYBODY);
+ self::_add_columns($perm_name, 0);
}
/**
@@ -175,7 +175,7 @@ class access_Core {
foreach (self::_get_all_groups() as $group) {
self::_drop_columns($name, $group->id);
}
- self::_drop_columns($name, group::EVERYBODY);
+ self::_drop_columns($name, 0);
ORM::factory("permission")->where("name", $name)->find()->delete();
}
@@ -247,9 +247,9 @@ class access_Core {
* @return ORM_Iterator
*/
private static function _get_all_groups() {
- try {
+ if (module::is_installed("user")) {
return ORM::factory("group")->find_all();
- } catch (Kohana_Database_Exception $e) {
+ } else {
return array();
}
}
diff --git a/core/helpers/module.php b/core/helpers/module.php
index 4d977268..ca5b5cfb 100644
--- a/core/helpers/module.php
+++ b/core/helpers/module.php
@@ -65,7 +65,8 @@ class module_Core {
}
}
- public static function available($modules=array()) {
+ public static function available() {
+ $modules = array();
foreach (glob(MODPATH . "*/helpers/*_installer.php") as $file) {
if (empty($modules[basename(dirname(dirname($file)))])) {
$modules[basename(dirname(dirname($file)))] = 0;
@@ -76,12 +77,15 @@ class module_Core {
}
public static function load_modules() {
- $modules = Kohana::config('core.modules');
+ try {
+ $modules = Kohana::config('core.modules');
- foreach (array_keys(self::available()) as $module_name) {
- $modules[] = MODPATH . $module_name;
- }
+ foreach (self::installed() as $module) {
+ $modules[] = MODPATH . $module->name;
+ }
- Kohana::config_set('core.modules', $modules);
+ Kohana::config_set('core.modules', $modules);
+ } catch (Exception $e) {
+ }
}
}
diff --git a/core/views/welcome.html.php b/core/views/welcome.html.php
index 68fa9c3d..748bc074 100644
--- a/core/views/welcome.html.php
+++ b/core/views/welcome.html.php
@@ -153,7 +153,9 @@
<?= html::script("lib/jquery.form.js") ?>
<?= html::script("lib/jquery.cookie.js") ?>
<?= html::script("lib/jquery.MultiFile.js") ?>
+ <? if (class_exists("rearrange_block")): ?>
<?= rearrange_block::head(null) ?>
+ <? endif ?>
</head>
<body>
<div class="outer">
diff --git a/core/views/welcome_syscheck.html.php b/core/views/welcome_syscheck.html.php
index e469a724..e46a179b 100644
--- a/core/views/welcome_syscheck.html.php
+++ b/core/views/welcome_syscheck.html.php
@@ -18,7 +18,7 @@
<? if (empty($errors)): ?>
<div class="block">
- <? if (empty($modules)): ?>
+ <? if (empty($modules['core'])): ?>
<p class="success">
Your system is ready, but Gallery is not yet installed.
</p>