Beispiel #1
0
 public function get($args)
 {
     $key = $args[0];
     $env = isset($args[1]) ? $args[1] : APPLICATION_ENV;
     $application = Zend_Registry::get('application');
     $configFile = $application->getConfigFile();
     $application = new Garp_Application($env, $configFile);
     $conf = $application->getOptions();
     $bits = explode('.', $key);
     while (isset($bits[0]) && isset($conf[$bits[0]])) {
         $conf = $conf[$bits[0]];
         array_shift($bits);
     }
     Garp_Cli::lineOut(is_array($conf) ? print_r($conf, true) : $conf);
     return true;
 }
Beispiel #2
0
if (file_exists($appSpecificInit)) {
    include_once $appSpecificInit;
}
defined('READ_FROM_CACHE') || define('READ_FROM_CACHE', true);
defined('MEMCACHE_HOST') || define('MEMCACHE_HOST', '127.0.0.1');
defined('MEMCACHE_PORT') || define('MEMCACHE_PORT', '11211');
$isCli = false;
if (array_key_exists('HTTP_HOST', $_SERVER) && $_SERVER['HTTP_HOST']) {
    //  h t t p   c o n t e x t
    define('HTTP_HOST', $_SERVER['HTTP_HOST']);
} else {
    //  c l i   c o n t e x t
    define('HTTP_HOST', gethostname());
    $isCli = true;
}
if (!$isCli && Garp_Application::isUnderConstruction()) {
    //header('HTTP/1.1 503 Service Temporarily Unavailable');
    //header('Retry-After: ' . date(DateTime::RFC2822, strtotime('+5 minutes')));
    header('Cache-Control: no-cache');
    header('Pragma: no-cache');
    header('Expires: ' . date(DATE_RFC1123, strtotime('-1 year')));
    include GARP_APPLICATION_PATH . '/modules/g/views/scripts/under-construction.phtml';
    // @codingStandardsIgnoreStart
    exit;
    // @codingStandardsIgnoreEnd
}
/**
 * Save wether we are in a cli context
 */
Zend_Registry::set('CLI', $isCli);
/**
Beispiel #3
0
 /**
  * Toggle wether the app is under construction
  *
  * @param array $args Accept "false", "0", 0, and false as disablers.
  * @return bool
  */
 public function setUnderConstruction(array $args = array())
 {
     $enabled = empty($args) ? true : !in_array(current($args), array(0, false, 'false', '0'));
     Garp_Cli::lineOut(Zend_Registry::get('config')->app->name . ' is' . ($enabled ? '' : ' no longer') . ' under construction');
     return Garp_Application::setUnderConstruction($enabled);
 }
Beispiel #4
0
    // Set BASE_PATH to be the root of the host project
    $basePath = realpath(dirname(__FILE__) . '/../../../../');
}
define('BASE_PATH', $basePath);
if (file_exists(BASE_PATH . '/vendor/autoload.php')) {
    include_once BASE_PATH . '/vendor/autoload.php';
}
// Include new-style environment configuration. This sets memcache ports
if (file_exists(BASE_PATH . '/application/configs/environment.php')) {
    include_once BASE_PATH . '/application/configs/environment.php';
}
require_once dirname(__FILE__) . "/../application/init.php";
// Create application, bootstrap, and run
$applicationIni = APPLICATION_PATH . '/configs/application.ini';
try {
    $application = new Garp_Application(APPLICATION_ENV, $applicationIni);
    $application->bootstrap();
} catch (Garp_Config_Ini_InvalidSectionException $e) {
    Garp_Cli::errorOut('Invalid environment: ' . APPLICATION_ENV);
    Garp_Cli::lineOut("Valid options are: \n- " . implode("\n- ", $e->getValidSections()), Garp_Cli::BLUE);
    // @codingStandardsIgnoreStart
    exit(1);
    // @codingStandardsIgnoreEnd
}
// save the application in the registry, so it can be used by commands.
Zend_Registry::set('application', $application);
/**
 * Report errors, since we're in CLI.
 * Note that log_errors = 1, which outputs to STDERR. display_errors however outputs to STDOUT.
 * In a CLI environment this results in a double error. display_errors is therefore set to 0
 * so that STDERR is the only stream showing errors.
Beispiel #5
0
 /**
  * Restore a gumball. Assumption: this is run after a gumball is uploaded and extracted to the
  * webroot.
  *
  * @return void
  */
 public function restore()
 {
     // if database, import database
     if ($this->_hasDatabaseDump()) {
         $this->restoreDatabase();
     } else {
         // Execute a spawn call in batch mode, to make sure all new columns are there
         $spawnCmd = new Garp_Cli_Command_Spawn();
         $spawnCmd->main(array('b' => true, 'only' => 'db'));
     }
     // set permissions on folders
     $this->setWritePermissions();
     // create snippets
     $this->createSnippets();
     // disable under construction
     Garp_Application::setUnderConstruction(false);
 }