Merge remote-tracking branch 'origin/master' into chapril-1.1.8

mise à jour vers 1.1.8
This commit is contained in:
Didier Clermonté 2018-08-12 15:00:08 +02:00 committed by root
commit 30c94c7aa1
8 changed files with 34 additions and 24 deletions

3
.gitignore vendored
View File

@ -8,7 +8,8 @@ nav
app/inc/config.php app/inc/config.php
vendor vendor
cache/ cache/
tpl_c/ tpl_c/*
!tpl_c/.gitkeep
.php_cs.cache .php_cs.cache
.zanata-cache/ .zanata-cache/

View File

@ -10,7 +10,6 @@ test:
stage: test stage: test
script: script:
- composer install -o --no-interaction --no-progress --prefer-dist - composer install -o --no-interaction --no-progress --prefer-dist
- mkdir tpl_c
- php vendor/bin/php-cs-fixer fix --verbose --dry-run - php vendor/bin/php-cs-fixer fix --verbose --dry-run
- vendor/bin/phpunit --bootstrap app/tests/bootstrap.php --debug app/tests - vendor/bin/phpunit --bootstrap app/tests/bootstrap.php --debug app/tests
cache: cache:
@ -39,10 +38,10 @@ pages:
- git checkout ${latesttag} - git checkout ${latesttag}
- composer install -o --no-interaction --no-progress --prefer-dist --no-dev - composer install -o --no-interaction --no-progress --prefer-dist --no-dev
- composer dump-autoload --optimize --no-dev --classmap-authoritative - composer dump-autoload --optimize --no-dev --classmap-authoritative
- mkdir tpl_c
- mkdir framadate - mkdir framadate
- mv `ls -A | grep -v framadate` ./framadate - mv `ls -A | grep -v framadate` ./framadate
- chmod -R 644 framadate/ && chmod -R 770 framadate/tpl_c/ && chmod -R 770 framadate/app/inc/ - find framadate/ -type d -exec chmod 750 {} \;
- find framadate/ -type f -exec chmod 640 {} \;
- zip -r latest.zip framadate - zip -r latest.zip framadate
- mkdir .public - mkdir .public
- cp latest.zip .public - cp latest.zip .public
@ -64,7 +63,6 @@ beta:
- composer dump-autoload --optimize --no-dev --classmap-authoritative - composer dump-autoload --optimize --no-dev --classmap-authoritative
- if [ ! -z ${ZANATA_CONFIG_FRAMABOT+x} ]; then mkdir -p ${HOME}/.config; echo -e "${ZANATA_CONFIG_FRAMABOT}" > ${HOME}/.config/zanata.ini; fi - if [ ! -z ${ZANATA_CONFIG_FRAMABOT+x} ]; then mkdir -p ${HOME}/.config; echo -e "${ZANATA_CONFIG_FRAMABOT}" > ${HOME}/.config/zanata.ini; fi
- if [ ! -z ${ZANATA_CONFIG_FRAMABOT+x} ]; then make pull-locales; fi - if [ ! -z ${ZANATA_CONFIG_FRAMABOT+x} ]; then make pull-locales; fi
- mkdir tpl_c
- mkdir .public - mkdir .public
- cp -r * .public - cp -r * .public
- cp -r .git .public - cp -r .git .public

View File

@ -37,11 +37,13 @@ if (!empty($_POST)) {
if ($result['status'] === 'OK') { if ($result['status'] === 'OK') {
header(('Location: ' . Utils::get_server_name() . 'admin/migration.php')); header(('Location: ' . Utils::get_server_name() . 'admin/migration.php'));
exit; exit;
} }
$error = __('Error', $result['code']);
$error = __('Error', $result['code']);
} }
$smarty->assign('error', $error); $smarty->assign('error', $error);
$smarty->assign('error_details', $result['details']);
$smarty->assign('title', __('Admin', 'Installation')); $smarty->assign('title', __('Admin', 'Installation'));
$smarty->assign('fields', $installService->getFields()); $smarty->assign('fields', $installService->getFields());
$smarty->display('admin/install.tpl'); $smarty->display('admin/install.tpl');

View File

@ -55,9 +55,10 @@ class InstallService {
} }
// Connect to database // Connect to database
$connect = $this->connectTo($this->fields['dbConnectionString'], $this->fields['dbUser'], $this->fields['dbPassword']); try {
if (!$connect) { $connect = $this->connectTo($this->fields['dbConnectionString'], $this->fields['dbUser'], $this->fields['dbPassword']);
return $this->error('CANT_CONNECT_TO_DATABASE'); } catch(\Exception $e) {
return $this->error('CANT_CONNECT_TO_DATABASE', $e->getMessage());
} }
// Write configuration to conf.php file // Write configuration to conf.php file
@ -68,15 +69,19 @@ class InstallService {
return $this->ok(); return $this->ok();
} }
/**
* Connect to PDO compatible source
*
* @param string $connectionString
* @param string $user
* @param string $password
* @return \PDO
*/
function connectTo($connectionString, $user, $password) { function connectTo($connectionString, $user, $password) {
try { $pdo = @new \PDO($connectionString, $user, $password);
$pdo = @new \PDO($connectionString, $user, $password); $pdo->setAttribute(\PDO::ATTR_DEFAULT_FETCH_MODE, \PDO::FETCH_OBJ);
$pdo->setAttribute(\PDO::ATTR_DEFAULT_FETCH_MODE, \PDO::FETCH_OBJ); $pdo->setAttribute(\PDO::ATTR_ERRMODE, \PDO::ERRMODE_EXCEPTION);
$pdo->setAttribute(\PDO::ATTR_ERRMODE, \PDO::ERRMODE_EXCEPTION); return $pdo;
return $pdo;
} catch(\Exception $e) {
return null;
}
} }
function writeConfiguration(Smarty &$smarty) { function writeConfiguration(Smarty &$smarty) {
@ -110,10 +115,11 @@ class InstallService {
* @param $msg * @param $msg
* @return array * @return array
*/ */
function error($msg) { function error($msg, $details = '') {
return [ return [
'status' => 'ERROR', 'status' => 'ERROR',
'code' => $msg 'code' => $msg,
'details' => $details,
]; ];
} }

View File

@ -18,7 +18,7 @@
*/ */
// FRAMADATE version // FRAMADATE version
const VERSION = '1.1.7'; const VERSION = '1.1.8';
// PHP Needed version // PHP Needed version
const PHP_NEEDED_VERSION = '5.6'; const PHP_NEEDED_VERSION = '5.6';

View File

@ -4,7 +4,7 @@ log_errors = On
error_log = /var/log/apache2/error.log error_log = /var/log/apache2/error.log
ignore_repeated_errors = On ignore_repeated_errors = On
register_globals = Off register_globals = Off
session.cookie_httponly = 1
[Date] [Date]
date.timezone = "Europe/Paris" date.timezone = "Europe/Paris"

View File

@ -6,7 +6,10 @@
<form action="" method="POST"> <form action="" method="POST">
{if $error} {if $error}
<div id="result" class="alert alert-danger">{$error}</div> <div id="result" class="alert alert-danger">
<h4>{$error}</h4>
<small>{$error_details}</small>
</div>
{/if} {/if}
<fieldset> <fieldset>

0
tpl_c/.gitkeep Normal file
View File