Valider 5db25d84 rédigé par Fil's avatar Fil
Parcourir les fichiers

reparer le cache des plugin.xml : sur les 632 plugins de spip-zone je passe...

reparer le cache des plugin.xml : sur les 632 plugins de spip-zone je passe ainsi de 20s a 1.5s pour afficher la page admin_plugin ; bonus : on enregistre le cache en gz (il fait environ 800 ko decompresse)
parent bca72479
Chargement en cours
Chargement en cours
Chargement en cours
Chargement en cours
+7 −5
Numéro de ligne d'origine Numéro de ligne de diff Ligne de diff
@@ -168,6 +168,7 @@ function liste_plugin_valides($liste_plug, $force = false){
	// creer une premiere liste non ordonnee mais qui ne retient
	// que les plugins valides, et dans leur derniere version en cas de doublon
	$liste_non_classee = array();

	foreach($listes as $dir_type=>$l){
		foreach($l as $k=>$plug) {
			// renseigner ce plugin
@@ -617,13 +618,13 @@ function plugin_est_installe($plug_path){
// lecture du fichier de configuration d'un plugin
// http://doc.spip.org/@plugin_get_infos
function plugin_get_infos($plug, $force_reload=false, $dir_plugins = _DIR_PLUGINS){
	include_spip('inc/xml');
	static $infos=array();
	static $plugin_xml_cache=NULL;
	include_spip('inc/xml');
	if (!isset($infos[$dir_plugins][$plug]) OR $force_reload){
		if ($plugin_xml_cache==NULL){
			$plugin_xml_cache = array();
			if (is_file($f=_DIR_TMP."plugin_xml.cache")){
			if (is_file($f=_DIR_TMP."plugin_xml_cache.gz")){
				lire_fichier($f,$contenu);
				$plugin_xml_cache = unserialize($contenu);
				if (!is_array($plugin_xml_cache)) $plugin_xml_cache = array();
@@ -691,13 +692,14 @@ function plugin_get_infos($plug, $force_reload=false, $dir_plugins = _DIR_PLUGIN

				if ($t=@filemtime($f)){
					$ret['filemtime'] = $t;
					$plugin_xml_cache[$plug]=$ret;
					ecrire_fichier(_DIR_TMP."plugin_xml.cache",serialize($plugin_xml_cache));
					$plugin_xml_cache[$dir_plugins][$plug]=$ret;
					ecrire_fichier(_DIR_TMP."plugin_xml_cache.gz",serialize($plugin_xml_cache));
				}
			}
		}
		$infos[$dir_plugins][$plug] = $ret;
	}

	return $infos[$dir_plugins][$plug];
}