Overview
Comment:Ne pas laisser une config invalide
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: a612e3c073f4ce26d29b38ecd137fe3435abf7a2
User & Date: bohwaz on 2014-04-01 18:09:37
Other Links: manifest | tags
Context
2014-04-01
18:10
Ne pas obliger à avoir un param check-in: f588c9e6cb user: bohwaz tags: trunk
18:09
Ne pas laisser une config invalide check-in: a612e3c073 user: bohwaz tags: trunk
16:58
première rc check-in: 1635cec26d user: bohwaz tags: trunk
Changes

Modified src/include/class.plugin.php from [fc78aaa227] to [a31ccbe5ea].

468
469
470
471
472
473
474
475







476
477
478
479
480
481
482

			if (!file_exists('phar://' . PLUGINS_ROOT . '/' . $id . '.phar/www/admin/config.php'))
			{
				throw new \RuntimeException('L\'archive '.$id.'.phar ne comporte pas de fichier www/admin/config.php 
					alors que le plugin nécessite le stockage d\'une configuration.');
			}

			$config = json_encode(file_get_contents('phar://' . PLUGINS_ROOT . '/' . $id . '.phar/config.json'));







		}

		$db = DB::getInstance();
		$db->simpleInsert('plugins', [
			'id' 		=> 	$id,
			'officiel' 	=> 	(int)(bool)$official,
			'nom'		=>	$infos['nom'],







|
>
>
>
>
>
>
>







468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489

			if (!file_exists('phar://' . PLUGINS_ROOT . '/' . $id . '.phar/www/admin/config.php'))
			{
				throw new \RuntimeException('L\'archive '.$id.'.phar ne comporte pas de fichier www/admin/config.php 
					alors que le plugin nécessite le stockage d\'une configuration.');
			}

			$config = json_decode(file_get_contents('phar://' . PLUGINS_ROOT . '/' . $id . '.phar/config.json'), true);

			if (is_null($config))
			{
				throw new \RuntimeException('config.json invalide. Code erreur JSON: ' . json_last_error());
			}

			$config = json_encode($config);
		}

		$db = DB::getInstance();
		$db->simpleInsert('plugins', [
			'id' 		=> 	$id,
			'officiel' 	=> 	(int)(bool)$official,
			'nom'		=>	$infos['nom'],