private function installCountries()
{
$countryPlugins = CountryPluginHelper::getCountryPlugins(false);
$hasError = false;
$results = array();
$count = 0;
$folders = array();
foreach ($countryPlugins as $currCountry) {
// ensure the country uninstalls itself first
$currCountry->uninstall();
try {
list($success, $content) = $currCountry->install();
if (!$success) {
$hasError = true;
break;
}
$folder = $currCountry->getFolder();
$results[] = array("name" => $currCountry->getName(), "folder" => $folder);
$folders[] = $folder;
$count++;
} catch (Exception $e) {
$hasError = true;
break;
}
}
// need error handling here
Settings::setSetting("installedCountries", implode(",", $folders));
$this->response["success"] = !$hasError;
$this->response["content"] = array("total" => $count, "results" => $results);
}