summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorBharat Mediratta <bharat@menalto.com>2009-06-01 00:11:09 -0700
committerBharat Mediratta <bharat@menalto.com>2009-06-01 00:11:09 -0700
commite4f4c8b2e878ae2941ce784cc7f6b5b219f55c18 (patch)
treea90a7693b9e155dafb889e57f7eb67c921df49c0 /modules
parent3c24d9476618496c8f2e1ca2f6025fa157120e43 (diff)
Do a little cleanup and get rid of code left-over from when this
controller rendered HTML. Also, catch all exceptions at the root level and restore the change in 84ce0cdefda162917c7b01722a7259ac52c4e30d which appears to have gotten lost in the shuffle.
Diffstat (limited to 'modules')
-rw-r--r--modules/gallery/controllers/package.php43
1 files changed, 20 insertions, 23 deletions
diff --git a/modules/gallery/controllers/package.php b/modules/gallery/controllers/package.php
index 7b702498..1b096cb5 100644
--- a/modules/gallery/controllers/package.php
+++ b/modules/gallery/controllers/package.php
@@ -23,14 +23,16 @@ class Package_Controller extends Controller {
Kohana::show_404();
}
- $this->auto_render = false;
-
- $this->_reset(); // empty and reinstall the standard modules
-
- $this->_dump_database(); // Dump the database
+ try {
+ $this->_reset(); // empty and reinstall the standard modules
+ $this->_dump_database(); // Dump the database
+ $this->_dump_var(); // Dump the var directory
+ } catch (Exception $e) {
+ print $e->getTraceAsString();
+ return;
+ }
- $this->_dump_var(); // Dump the var directory
- print t("Successfully wrote install.sql and init_var.php\n");
+ print "Successfully wrote install.sql and init_var.php\n";
}
private function _reset() {
@@ -57,19 +59,13 @@ class Package_Controller extends Controller {
// numbers, keeping our install.sql file more stable.
srand(0);
- try {
- gallery_installer::install(true);
- module::load_modules();
+ gallery_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;
+ foreach (array("user", "comment", "organize", "info", "rss",
+ "search", "slideshow", "tag") as $module_name) {
+ module::install($module_name);
+ module::activate($module_name);
}
}
@@ -104,7 +100,9 @@ class Package_Controller extends Controller {
// Post-process the sql file
$buf = "";
- $root_timestamp = ORM::factory("item", 1)->created;
+ $root = ORM::factory("item", 1);
+ $root_created_timestamp = $root->created;
+ $root_updated_timestamp = $root->updated;
foreach (file($sql_file) as $line) {
// Prefix tables
$line = preg_replace(
@@ -112,7 +110,8 @@ class Package_Controller extends Controller {
$line);
// Normalize dates
- $line = preg_replace("/,$root_timestamp,/", ",UNIX_TIMESTAMP(),", $line);
+ $line = preg_replace("/,$root_created_timestamp,/", ",UNIX_TIMESTAMP(),", $line);
+ $line = preg_replace("/,$root_updated_timestamp,/", ",UNIX_TIMESTAMP(),", $line);
$buf .= $line;
}
$fd = fopen($sql_file, "wb");
@@ -121,8 +120,6 @@ class Package_Controller extends Controller {
}
private function _dump_var() {
- $this->auto_render = false;
-
$objects = new RecursiveIteratorIterator(
new RecursiveDirectoryIterator(VARPATH),
RecursiveIteratorIterator::SELF_FIRST);