Overview
Comment:Don't allow to restore an old upgrade as it would mean you are logged out
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | dev
Files: files | file ages | folders
SHA1: 3d65b650cd9338aa4b78127b0c58e96e677b5a01
User & Date: bohwaz on 2020-11-25 12:51:14
Other Links: branch diff | manifest | tags
Context
2020-11-25
15:24
Refactor date modifiers, remove format_sqlite_date_to_french modifier check-in: 6f8a05aa31 user: bohwaz tags: dev
12:51
Don't allow to restore an old upgrade as it would mean you are logged out check-in: 3d65b650cd user: bohwaz tags: dev
12:36
Config: only include images check-in: 491a0dc0f2 user: bohwaz tags: dev
Changes

Modified src/include/lib/Garradin/Sauvegarde.php from [1afcef389e] to [7f664d6dd4].

337
338
339
340
341
342
343
344
345
346
347




348
349
350
351
352
353
354
355
356
357
358
359
360
		if (!$table)
		{
			throw new UserException('Le fichier fourni ne semble pas contenir de données liées à Garradin.');
		}

		// On récupère la version
		$version = $db->querySingle('SELECT valeur FROM config WHERE cle=\'version\';');

		// rification de l'AppID pour les versions récentes
		if (version_compare($version, '0.8.0', '>='))
		{




			$appid = $db->querySingle('PRAGMA application_id;', false);

			if ($appid !== DB::APPID)
			{
				throw new UserException('Ce fichier n\'est pas une sauvegarde Garradin (application_id ne correspond pas).', self::NO_APP_ID);
			}
		}

		if ($user_id)
		{
			// Empêchons l'admin de se tirer une balle dans le pied
			$is_still_admin = $db->querySingle('SELECT 1 FROM membres_categories
				WHERE id = (SELECT id_categorie FROM membres WHERE id = ' . (int) $user_id . ')








|
|

>
>
>
>
|

|
|
|
<







337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356

357
358
359
360
361
362
363
		if (!$table)
		{
			throw new UserException('Le fichier fourni ne semble pas contenir de données liées à Garradin.');
		}

		// On récupère la version
		$version = $db->querySingle('SELECT valeur FROM config WHERE cle=\'version\';');

		// On ne permet pas de restaurer une vieille version
		if (version_compare($version, '0.9.8', '<'))
		{
			throw new UserException(sprintf('Ce fichier a été créé avec une version trop ancienne (%s), il n\'est pas possible de le restaurer.', $version));
		}

		// Vérification de l'AppID pour les versions récentes
		$appid = $db->querySingle('PRAGMA application_id;', false);

		if ($appid !== DB::APPID)
		{
			throw new UserException('Ce fichier n\'est pas une sauvegarde Garradin (application_id ne correspond pas).', self::NO_APP_ID);

		}

		if ($user_id)
		{
			// Empêchons l'admin de se tirer une balle dans le pied
			$is_still_admin = $db->querySingle('SELECT 1 FROM membres_categories
				WHERE id = (SELECT id_categorie FROM membres WHERE id = ' . (int) $user_id . ')