Overview
Comment:Send plugin root as one of parameters passed to events
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | dev
Files: files | file ages | folders
SHA1: f5d8c70106f9b149ad33a21398b1f63c3c90f72d
User & Date: bohwaz on 2020-12-03 00:36:23
Other Links: branch diff | manifest | tags
Context
2020-12-03
00:36
Install welcome plugin if it exists check-in: 46bc707429 user: bohwaz tags: dev
00:36
Send plugin root as one of parameters passed to events check-in: f5d8c70106 user: bohwaz tags: dev
2020-12-02
23:11
Fix plugin install check-in: 530ac81be6 user: bohwaz tags: dev
Changes

Modified src/include/lib/Garradin/Plugin.php from [7d2a1289d6] to [245a731876].

760
761
762
763
764
765
766




767
768
769
770
771


772
773
774
775
776
777


778
779
780
781
782
783
784
785
786
787
788
	static public function fireSignal($signal, $params = null, &$callback_return = null)
	{
		$list = DB::getInstance()->get('SELECT * FROM plugins_signaux WHERE signal = ?;', $signal);

		if (!count($list)) {
			return null;
		}





		$system = explode(',', PLUGINS_SYSTEM);

		foreach ($list as $row)
		{


			// Ne pas appeler les plugins dont le code n'existe pas/plus,
			// SAUF si c'est un plugin système (auquel cas ça fera une erreur)
			if (!self::getPath($row->plugin, in_array($row->plugin, $system)))
			{
				continue;
			}



			$return = call_user_func_array('Garradin\\Plugin\\' . $row->callback, [&$params, &$callback_return]);

			if (true === $return) {
				return true;
			}
		}

		return false;
	}
}







>
>
>
>





>
>


|



>
>











760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
	static public function fireSignal($signal, $params = null, &$callback_return = null)
	{
		$list = DB::getInstance()->get('SELECT * FROM plugins_signaux WHERE signal = ?;', $signal);

		if (!count($list)) {
			return null;
		}

		if (null === $params) {
			$params = [];
		}

		$system = explode(',', PLUGINS_SYSTEM);

		foreach ($list as $row)
		{
			$path = self::getPath($row->plugin, in_array($row->plugin, $system));

			// Ne pas appeler les plugins dont le code n'existe pas/plus,
			// SAUF si c'est un plugin système (auquel cas ça fera une erreur)
			if (!$path)
			{
				continue;
			}

			$params['plugin_root'] = $path;

			$return = call_user_func_array('Garradin\\Plugin\\' . $row->callback, [&$params, &$callback_return]);

			if (true === $return) {
				return true;
			}
		}

		return false;
	}
}