Changeset View
Changeset View
Standalone View
Standalone View
support/ArcanistRuntime.php
<?php | <?php | ||||
final class ArcanistRuntime { | final class ArcanistRuntime { | ||||
public function execute(array $argv) { | public function execute(array $argv) { | ||||
$err = $this->checkEnvironment(); | |||||
if ($err) { | try { | ||||
return $err; | $this->checkEnvironment(); | ||||
} catch (Exception $ex) { | |||||
echo "CONFIGURATION ERROR\n\n"; | |||||
echo $ex->getMessage(); | |||||
echo "\n\n"; | |||||
return 1; | |||||
} | } | ||||
PhutilTranslator::getInstance() | PhutilTranslator::getInstance() | ||||
->setLocale(PhutilLocale::loadLocale('en_US')) | ->setLocale(PhutilLocale::loadLocale('en_US')) | ||||
->setTranslations(PhutilTranslation::getTranslationMapForLocale('en_US')); | ->setTranslations(PhutilTranslation::getTranslationMapForLocale('en_US')); | ||||
try { | try { | ||||
return $this->executeCore($argv); | return $this->executeCore($argv); | ||||
▲ Show 20 Lines • Show All 87 Lines • ▼ Show 20 Lines | private function checkEnvironment() { | ||||
$min_version = ($is_windows ? '5.3.0' : '5.2.3'); | $min_version = ($is_windows ? '5.3.0' : '5.2.3'); | ||||
$cur_version = phpversion(); | $cur_version = phpversion(); | ||||
if (version_compare($cur_version, $min_version, '<')) { | if (version_compare($cur_version, $min_version, '<')) { | ||||
$message = sprintf( | $message = sprintf( | ||||
'You are running a version of PHP ("%s"), which is older than the '. | 'You are running a version of PHP ("%s"), which is older than the '. | ||||
'minimum supported version ("%s"). Update PHP to continue.', | 'minimum supported version ("%s"). Update PHP to continue.', | ||||
$cur_version, | $cur_version, | ||||
$min_version); | $min_version); | ||||
return $this->fatalError($message); | |||||
throw new Exception($message); | |||||
} | } | ||||
if ($is_windows) { | if ($is_windows) { | ||||
$need_functions = array( | $need_functions = array( | ||||
'curl_init' => array('builtin-dll', 'php_curl.dll'), | 'curl_init' => array('builtin-dll', 'php_curl.dll'), | ||||
); | ); | ||||
} else { | } else { | ||||
$need_functions = array( | $need_functions = array( | ||||
▲ Show 20 Lines • Show All 64 Lines • ▼ Show 20 Lines | foreach ($need_functions as $fname => $resolution) { | ||||
$fname); | $fname); | ||||
} | } | ||||
if ($problems) { | if ($problems) { | ||||
if ($show_config) { | if ($show_config) { | ||||
$problems[] = "PHP was built with this configure command:\n\n{$config}"; | $problems[] = "PHP was built with this configure command:\n\n{$config}"; | ||||
} | } | ||||
$problems = implode("\n\n", $problems); | $problems = implode("\n\n", $problems); | ||||
return $this->fatalError($problems); | |||||
} | |||||
return 0; | throw new Exception($problems); | ||||
} | } | ||||
private function fatalError($message) { | |||||
echo "CONFIGURATION ERROR\n\n"; | |||||
echo $message; | |||||
echo "\n\n"; | |||||
return 1; | |||||
} | } | ||||
private function loadConfiguration(PhutilArgumentParser $args) { | private function loadConfiguration(PhutilArgumentParser $args) { | ||||
$configuration_manager = new ArcanistConfigurationManager(); | $configuration_manager = new ArcanistConfigurationManager(); | ||||
$cwd = getcwd(); | $cwd = getcwd(); | ||||
$working_copy = ArcanistWorkingCopyIdentity::newFromPath($cwd); | $working_copy = ArcanistWorkingCopyIdentity::newFromPath($cwd); | ||||
$configuration_manager->setWorkingCopyIdentity($working_copy); | $configuration_manager->setWorkingCopyIdentity($working_copy); | ||||
▲ Show 20 Lines • Show All 319 Lines • Show Last 20 Lines |