function upgrade_db_connect()
{
    global $conf;
    try {
        pwg_db_connect($conf['db_host'], $conf['db_user'], $conf['db_password'], $conf['db_base']);
        pwg_db_check_version();
    } catch (Exception $e) {
        my_error(l10n($e->getMessage()), true);
    }
}
Exemple #2
0
    exit;
}
include PHPWG_ROOT_PATH . 'include/dblayer/functions_' . $conf['dblayer'] . '.inc.php';
if (isset($conf['show_php_errors']) && !empty($conf['show_php_errors'])) {
    @ini_set('error_reporting', $conf['show_php_errors']);
    @ini_set('display_errors', true);
}
include PHPWG_ROOT_PATH . 'include/constants.php';
include PHPWG_ROOT_PATH . 'include/functions.inc.php';
include PHPWG_ROOT_PATH . 'include/template.class.php';
include PHPWG_ROOT_PATH . 'include/cache.class.php';
include PHPWG_ROOT_PATH . 'include/Logger.class.php';
$persistent_cache = new PersistentFileCache();
// Database connection
try {
    pwg_db_connect($conf['db_host'], $conf['db_user'], $conf['db_password'], $conf['db_base']);
} catch (Exception $e) {
    my_error(l10n($e->getMessage()), true);
}
pwg_db_check_charset();
load_conf_from_db();
$logger = new Logger(array('directory' => PHPWG_ROOT_PATH . $conf['data_location'] . $conf['log_dir'], 'severity' => $conf['log_level'], 'filename' => 'log_' . date('Y-m-d') . '_' . sha1(date('Y-m-d') . $conf['db_password']) . '.txt', 'globPattern' => 'log_*.txt', 'archiveDays' => $conf['log_archive_days']));
if (!$conf['check_upgrade_feed']) {
    if (!isset($conf['piwigo_db_version']) or $conf['piwigo_db_version'] != get_branch_from_version(PHPWG_VERSION)) {
        redirect(get_root_url() . 'upgrade.php');
    }
}
ImageStdParams::load_from_db();
session_start();
load_plugins();
// users can have defined a custom order pattern, incompatible with GUI form
/**
 * Connect to database during installation. Uses $_POST.
 *
 * @param array &$infos - populated with infos
 * @param array &$errors - populated with errors
 */
function install_db_connect(&$infos, &$errors)
{
    try {
        pwg_db_connect($_POST['dbhost'], $_POST['dbuser'], $_POST['dbpasswd'], $_POST['dbname']);
        pwg_db_check_version();
    } catch (Exception $e) {
        $errors[] = l10n($e->getMessage());
    }
}