// Move log classes and add logger in new installer

This commit is contained in:
rMalie
2012-01-05 16:11:43 +00:00
parent bf1ebd0700
commit c8732842af
6 changed files with 15 additions and 13 deletions
+11
View File
@@ -32,6 +32,11 @@ abstract class InstallAbstractModel
*/
public $language;
/**
* @var FileLogger
*/
public $logger;
/**
* @var array List of errors
*/
@@ -40,6 +45,9 @@ abstract class InstallAbstractModel
public function __construct()
{
$this->language = InstallLanguages::getInstance();
$this->logger = new FileLogger();
$this->logger->setFilename(_PS_ROOT_DIR_.'/log/'.@date('Ymd').'_installation.log');
}
public function setError($errors)
@@ -48,7 +56,10 @@ abstract class InstallAbstractModel
$errors = array($errors);
foreach ($errors as $error)
{
$this->errors[] = $error;
$this->logger->logError($error);
}
}
public function getErrors()
+4 -13
View File
@@ -377,21 +377,12 @@ class InstallModelInstall extends InstallAbstractModel
}
// Set localization configuration
$version = str_replace('.', '', _PS_VERSION_);
$version = substr($version, 0, 2);
$localization_file_content = @Tools::file_get_contents('http://api.prestashop.com/download/localization/'.$version.'/'.$data['shop_country'].'.xml');
if (!$localization_file_content)
{
$localization_file = _PS_ROOT_DIR_.'/localization/default.xml';
if (file_exists(_PS_ROOT_DIR_.'/localization/'.$data['shop_country'].'.xml'))
$localization_file = _PS_ROOT_DIR_.'/localization/'.$data['shop_country'].'.xml';
$localization_file_content = file_get_contents($localization_file);
}
$localization_file = _PS_ROOT_DIR_.'/localization/default.xml';
if (file_exists(_PS_ROOT_DIR_.'/localization/'.$data['shop_country'].'.xml'))
$localization_file = _PS_ROOT_DIR_.'/localization/'.$data['shop_country'].'.xml';
$locale = new LocalizationPackCore();
$locale->loadLocalisationPack($localization_file_content, '', true);
$locale->loadLocalisationPack(file_get_contents($localization_file), '', true);
// Create default employee
if (isset($data['admin_firstname']) && isset($data['admin_lastname']) && isset($data['admin_password']) && isset($data['admin_email']))