diff options
author | Bharat Mediratta <bharat@menalto.com> | 2009-06-10 01:23:44 -0700 |
---|---|---|
committer | Bharat Mediratta <bharat@menalto.com> | 2009-06-10 01:23:44 -0700 |
commit | 8c0d48b001429e85af77b736399615965ec20a02 (patch) | |
tree | d704ba74871c3f29c62728cb8d569df9ba2da86e | |
parent | 73de6eedd9100bf88eed4c8d638f118485869cd3 (diff) |
Add CLI sapi support
-rw-r--r-- | modules/gallery/controllers/upgrader.php | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/modules/gallery/controllers/upgrader.php b/modules/gallery/controllers/upgrader.php index 0d5bb4f6..0833e253 100644 --- a/modules/gallery/controllers/upgrader.php +++ b/modules/gallery/controllers/upgrader.php @@ -32,7 +32,11 @@ class Upgrader_Controller extends Controller { public function upgrade() { // Todo: give the admin a chance to log in here - if (!user::active()->admin) { + if (php_sapi_name() == "cli") { + // @todo this may screw up some module installers, but we don't have a better answer at + // this time. + $_SERVER["HTTP_HOST"] = "example.com"; + } else if (!user::active()->admin) { access::forbidden(); } @@ -51,6 +55,10 @@ class Upgrader_Controller extends Controller { } } - url::redirect("upgrader?done=1"); + if (php_sapi_name() == "cli") { + print "Upgrade complete\n"; + } else { + url::redirect("upgrader?done=1"); + } } } |