summaryrefslogtreecommitdiff
path: root/core/controllers/scaffold.php
diff options
context:
space:
mode:
authorBharat Mediratta <bharat@menalto.com>2009-05-26 05:28:59 +0000
committerBharat Mediratta <bharat@menalto.com>2009-05-26 05:28:59 +0000
commit7aed9239088b582a065da3fb63796ff66cd357c8 (patch)
tree8be9bc4faec21b20cbcc060ad5e9ca128465d09e /core/controllers/scaffold.php
parent2966289b147ceae2fed79b9534840607bf38e0d8 (diff)
Restructure the module lifecycle.
Install: <module>_installer::install() is called, any necessary tables are created. Activate: <module>_installer::activate() is called. Module controllers are routable, helpers are accessible, etc. The module is in use. Deactivate: <module>_installer::deactivate() is called. Module code is not accessible or routable. Module is *not* in use, but its tables are still around. Uninstall: <module>_installer::uninstall() is called. Module is completely removed from the database. Admin > Modules will install and activate modules, but will only deactivate (will NOT uninstall modules).
Diffstat (limited to 'core/controllers/scaffold.php')
-rw-r--r--core/controllers/scaffold.php15
1 files changed, 11 insertions, 4 deletions
diff --git a/core/controllers/scaffold.php b/core/controllers/scaffold.php
index 9f306caf..463a092c 100644
--- a/core/controllers/scaffold.php
+++ b/core/controllers/scaffold.php
@@ -78,7 +78,7 @@ class Scaffold_Controller extends Template_Controller {
function add_albums_and_photos($count, $desired_type=null) {
srand(time());
$parents = ORM::factory("item")->where("type", "album")->find_all()->as_array();
- $owner_id = module::is_installed("user") ? user::active()->id : null;
+ $owner_id = user::active()->id;
$test_images = glob(APPPATH . "tests/images/*.[Jj][Pp][Gg]");
@@ -162,7 +162,7 @@ class Scaffold_Controller extends Template_Controller {
url::redirect("scaffold");
}
- if (module::is_installed("akismet")) {
+ if (module::is_active("akismet")) {
akismet::$test_mode = 1;
}
for ($i = 0; $i < $count; $i++) {
@@ -291,20 +291,27 @@ class Scaffold_Controller extends Template_Controller {
dir::unlink(VARPATH . "modules");
dir::unlink(VARPATH . "tmp");
- module::$module_names = array();
- module::$modules = array();
$db->clear_cache();
+ module::$modules = array();
+ module::$active = array();
// Use a known random seed so that subsequent packaging runs will reuse the same random
// numbers, keeping our install.sql file more stable.
srand(0);
+ try {
core_installer::install(true);
module::load_modules();
foreach (array("user", "comment", "organize", "info", "rss",
"search", "slideshow", "tag") as $module_name) {
module::install($module_name);
+ module::activate($module_name);
+ }
+ } catch (Exception $e) {
+ Kohana::log("error", $e->getTraceAsString());
+ print $e->getTrace();
+ throw $e;
}
url::redirect("scaffold/dump_database");