Overview
Comment:Prevent loop redirects when the config is wrong
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk | stable
Files: files | file ages | folders
SHA1: 92f7d0328263cd2894f97919af9bdbfcfd1476fe
User & Date: bohwaz on 2021-01-11 14:50:33
Other Links: manifest | tags
Context
2021-01-11
15:14
Refactor and fix getSelfURI/URL so that it works without a dedicated vhost check-in: 34dda73b93 user: bohwaz tags: trunk
14:50
Prevent loop redirects when the config is wrong check-in: 92f7d03282 user: bohwaz tags: trunk, stable
14:50
Error template fallback cannot be used here, as it might be the compiled cache directory that is not writable! check-in: 2843d64bbc user: bohwaz tags: trunk, stable
Changes

Modified src/include/init.php from [2ed6772737] to [bdb571d287].

312
313
314
315
316
317
318
319



320
321
322
323
324
325
326
327
328
329
330

/*
 * Vérifications pour enclencher le processus d'installation ou de mise à jour
 */

if (!defined('Garradin\INSTALL_PROCESS') && !defined('Garradin\UPGRADE_PROCESS'))
{
	if (!file_exists(DB_FILE))



	{
		Utils::redirect(ADMIN_URL . 'install.php');
	}

	$config = Config::getInstance();

	if (version_compare($config->getVersion(), garradin_version(), '<'))
	{
		Utils::redirect(ADMIN_URL . 'upgrade.php');
	}
}







|
>
>
>
|










312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333

/*
 * Vérifications pour enclencher le processus d'installation ou de mise à jour
 */

if (!defined('Garradin\INSTALL_PROCESS') && !defined('Garradin\UPGRADE_PROCESS'))
{
	if (!file_exists(DB_FILE)) {
		if (Utils::getSelfURL() == ADMIN_URL . 'install.php') {
			die('Erreur de redirection en boucle : problème de configuration ?');
		}

		Utils::redirect(ADMIN_URL . 'install.php');
	}

	$config = Config::getInstance();

	if (version_compare($config->getVersion(), garradin_version(), '<'))
	{
		Utils::redirect(ADMIN_URL . 'upgrade.php');
	}
}