Réorganise étape 4
This commit is contained in:
parent
78f7a1c063
commit
6823ce3dc8
@ -379,34 +379,13 @@ class install extends common
|
|||||||
$success = true;
|
$success = true;
|
||||||
$message = '';
|
$message = '';
|
||||||
$rewrite = $this->getInput('data');
|
$rewrite = $this->getInput('data');
|
||||||
// Réécriture d'URL
|
|
||||||
if ($rewrite === 'true') { // Ajout des lignes dans le .htaccess
|
|
||||||
$fileContent = file_get_contents('.htaccess');
|
|
||||||
$rewriteData = PHP_EOL .
|
|
||||||
'# URL rewriting' . PHP_EOL .
|
|
||||||
'<IfModule mod_rewrite.c>' . PHP_EOL .
|
|
||||||
"\tRewriteEngine on" . PHP_EOL .
|
|
||||||
"\tRewriteBase " . helper::baseUrl(false, false) . PHP_EOL .
|
|
||||||
"\tRewriteCond %{REQUEST_FILENAME} !-f" . PHP_EOL .
|
|
||||||
"\tRewriteCond %{REQUEST_FILENAME} !-d" . PHP_EOL .
|
|
||||||
"\tRewriteRule ^(.*)$ index.php?$1 [L]" . PHP_EOL .
|
|
||||||
'</IfModule>' . PHP_EOL .
|
|
||||||
'# URL rewriting' . PHP_EOL;
|
|
||||||
$fileContent = str_replace('# URL rewriting', $rewriteData, $fileContent);
|
|
||||||
$success = file_put_contents(
|
|
||||||
'.htaccess',
|
|
||||||
$fileContent
|
|
||||||
);
|
|
||||||
if ($success === false) {
|
|
||||||
$message = helper::translate('La réécriture d\'URL n\'a pas été restaurée !');
|
|
||||||
http_response_code(500);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
/**
|
||||||
|
* Restaure le fichier htaccess
|
||||||
|
*/
|
||||||
// Recopie htaccess
|
// Recopie htaccess
|
||||||
if (
|
if (
|
||||||
$this->getData(['config', 'autoUpdateHtaccess']) &&
|
$this->getData(['config', 'autoUpdateHtaccess'])
|
||||||
$success && file_exists('.htaccess.bak')
|
|
||||||
) {
|
) {
|
||||||
// L'écraser avec le backup
|
// L'écraser avec le backup
|
||||||
$success = copy('.htaccess.bak', '.htaccess');
|
$success = copy('.htaccess.bak', '.htaccess');
|
||||||
@ -416,6 +395,32 @@ class install extends common
|
|||||||
}
|
}
|
||||||
// Effacer le backup
|
// Effacer le backup
|
||||||
unlink('.htaccess.bak');
|
unlink('.htaccess.bak');
|
||||||
|
} else {
|
||||||
|
/**
|
||||||
|
* Restaure la réécriture d'URL
|
||||||
|
*/
|
||||||
|
if ($rewrite === 'true') { // Ajout des lignes dans le .htaccess
|
||||||
|
$fileContent = file_get_contents('.htaccess');
|
||||||
|
$rewriteData = PHP_EOL .
|
||||||
|
'# URL rewriting' . PHP_EOL .
|
||||||
|
'<IfModule mod_rewrite.c>' . PHP_EOL .
|
||||||
|
"\tRewriteEngine on" . PHP_EOL .
|
||||||
|
"\tRewriteBase " . helper::baseUrl(false, false) . PHP_EOL .
|
||||||
|
"\tRewriteCond %{REQUEST_FILENAME} !-f" . PHP_EOL .
|
||||||
|
"\tRewriteCond %{REQUEST_FILENAME} !-d" . PHP_EOL .
|
||||||
|
"\tRewriteRule ^(.*)$ index.php?$1 [L]" . PHP_EOL .
|
||||||
|
'</IfModule>' . PHP_EOL .
|
||||||
|
'# URL rewriting' . PHP_EOL;
|
||||||
|
$fileContent = str_replace('# URL rewriting', $rewriteData, $fileContent);
|
||||||
|
$success = file_put_contents(
|
||||||
|
'.htaccess',
|
||||||
|
$fileContent
|
||||||
|
);
|
||||||
|
if ($success === false) {
|
||||||
|
$message = helper::translate('La réécriture d\'URL n\'a pas été restaurée !');
|
||||||
|
http_response_code(500);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -426,8 +431,10 @@ class install extends common
|
|||||||
$installedLanguages = $this->getData(['language']);
|
$installedLanguages = $this->getData(['language']);
|
||||||
$defaultLanguages = init::$defaultData['language'];
|
$defaultLanguages = init::$defaultData['language'];
|
||||||
foreach ($installedLanguages as $key => $value) {
|
foreach ($installedLanguages as $key => $value) {
|
||||||
if (isset($defaultLanguages[$key]['version']) &&
|
if (
|
||||||
$defaultLanguages[$key]['version'] > $value['version']) {
|
isset($defaultLanguages[$key]['version']) &&
|
||||||
|
$defaultLanguages[$key]['version'] > $value['version']
|
||||||
|
) {
|
||||||
copy('core/module/install/ressource/i18n/' . $key . '.json', self::I18N_DIR . $key . '.json');
|
copy('core/module/install/ressource/i18n/' . $key . '.json', self::I18N_DIR . $key . '.json');
|
||||||
$this->setData(['language', $key, $defaultLanguages[$key]]);
|
$this->setData(['language', $key, $defaultLanguages[$key]]);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user