From 8c0d48b001429e85af77b736399615965ec20a02 Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Wed, 10 Jun 2009 01:23:44 -0700 Subject: Add CLI sapi support --- modules/gallery/controllers/upgrader.php | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'modules') 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"); + } } } -- cgit v1.2.3