From e4e28626a30e2c8c6981c0293d06b833bd53c388 Mon Sep 17 00:00:00 2001
From: Matthieu Marcillaud <marcimat@rezo.net>
Date: Thu, 28 Feb 2013 20:30:40 +0000
Subject: [PATCH] =?UTF-8?q?-=20report=20de=20r20212=20(d=C3=A9placer=20la?=
 =?UTF-8?q?=20d=C3=A9claration=20de=20constante=20=5FLOG=5FFILTRE=5FGRAVIT?=
 =?UTF-8?q?E=20apr=C3=A8s=20les=20chargements=20des=20plugins=20pour=20que?=
 =?UTF-8?q?=20le=20plugin=20'dev'=20puisse=20la=20d=C3=A9clarer=20avant=20?=
 =?UTF-8?q?SPIP).=20-=20mais=20du=20coup,=20si=20un=20plugin=20fait=20un?=
 =?UTF-8?q?=20spip=5Flog=20dans=20son=20fichier=20d'option,=20la=20constan?=
 =?UTF-8?q?te=20ne=20serait=20pas=20encore=20d=C3=A9clar=C3=A9e=20:=20ajou?=
 =?UTF-8?q?t=20d'un=20test=20dans=20spip=5Flog()=20du=20coup.?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

+ phpdoc des constantes doivent être… juste avant la constante. C'est ennuyant.
+ phpdoc de journal()
---
 ecrire/inc/utils.php   | 17 +++++++++++------
 ecrire/inc_version.php | 40 +++++++++++++++++++++++++++-------------
 2 files changed, 38 insertions(+), 19 deletions(-)

diff --git a/ecrire/inc/utils.php b/ecrire/inc/utils.php
index d8d3604ca6..d420720fe3 100644
--- a/ecrire/inc/utils.php
+++ b/ecrire/inc/utils.php
@@ -228,9 +228,10 @@ function pipeline($action, $val=null) {
  *   spip_log($message,_LOG_DEBUG)
  *   spip_log($message,'recherche.'._LOG_DEBUG)
  *   ```
- * 
+ *
+ * @api
  * @link http://doc.spip.org/@spip_log
- * @see inc_log_dist()
+ * @uses inc_log_dist()
  *
  * @param string $message
  *     Message à loger
@@ -251,7 +252,7 @@ function spip_log($message=NULL, $name=NULL) {
 	if (!isset($regs[2]) OR !$niveau = $regs[2])
 		$niveau = _LOG_INFO;
 
-	if ($niveau <= _LOG_FILTRE_GRAVITE) {
+	if ($niveau <= (defined('_LOG_FILTRE_GRAVITE') ? _LOG_FILTRE_GRAVITE : _LOG_INFO_IMPORTANTE)) {
 		if (!$pre){
 			$pre = array(
 				_LOG_HS=>'HS:',
@@ -269,9 +270,13 @@ function spip_log($message=NULL, $name=NULL) {
 	}
 }
 
-//
-// Enregistrement des journaux
-//
+/**
+ * Enregistrement des journaux
+ *
+ * @uses inc_journal_dist()
+ * @param string $phrase Texte du journal
+ * @param array $opt Tableau d'options
+**/
 function journal($phrase, $opt = array()) {
 	$journal = charger_fonction('journal', 'inc');
 	$journal($phrase, $opt);
diff --git a/ecrire/inc_version.php b/ecrire/inc_version.php
index a610ed1af8..1472edcd97 100644
--- a/ecrire/inc_version.php
+++ b/ecrire/inc_version.php
@@ -33,8 +33,10 @@ error_reporting(E_ALL ^ E_NOTICE);
 /** version PHP minimum exigee (cf. inc/utils) */
 define ('_PHP_MIN', '5.1.0');
 
-/** le nom du repertoire ecrire/ */
-if (!defined('_DIR_RESTREINT_ABS')) define('_DIR_RESTREINT_ABS', 'ecrire/');
+if (!defined('_DIR_RESTREINT_ABS')) {
+	/** le nom du repertoire ecrire/ */
+	define('_DIR_RESTREINT_ABS', 'ecrire/');
+}
 
 /** Chemin relatif pour aller dans ecrire
  *  vide si on est dans ecrire, 'ecrire/' sinon */
@@ -102,12 +104,15 @@ OR (@file_exists($f = _ROOT_RESTREINT . _NOM_CONFIG . '.php'))) {
 	define('_FILE_OPTIONS', $f);
 } else define('_FILE_OPTIONS', '');
 
+if (!defined('MODULES_IDIOMES')) {
 /**
  * Modules par défaut pour la traduction.
  * 
  * Constante utilisée par le compilateur et le décompilateur
- * sa valeur etant traitée par inc_traduire_dist */
-if (!defined('MODULES_IDIOMES')) define('MODULES_IDIOMES', 'public|spip|ecrire');
+ * sa valeur etant traitée par inc_traduire_dist
+ */
+	define('MODULES_IDIOMES', 'public|spip|ecrire');
+}
 
 // *** Fin des define *** //
 
@@ -347,15 +352,16 @@ require_once _ROOT_RESTREINT . 'base/connect_sql.php';
 
 if (_FILE_OPTIONS) {include_once _FILE_OPTIONS;}
 
-/** Compatibilite PHP 5.3 */
-if (!defined('E_DEPRECATED')) define('E_DEPRECATED', 8192);
-/** Masquer les warning */
-if (!defined('SPIP_ERREUR_REPORT')) define('SPIP_ERREUR_REPORT', E_ALL ^ E_NOTICE ^ E_DEPRECATED);
+if (!defined('E_DEPRECATED')) {
+	/** Compatibilite PHP 5.3 */
+	define('E_DEPRECATED', 8192);
+}
+if (!defined('SPIP_ERREUR_REPORT')) {
+	/** Masquer les warning */
+	define('SPIP_ERREUR_REPORT', E_ALL ^ E_NOTICE ^ E_DEPRECATED);
+}
 error_reporting(SPIP_ERREUR_REPORT);
 
-/** niveau maxi d'enregistrement des logs */
-defined('_LOG_FILTRE_GRAVITE') || define('_LOG_FILTRE_GRAVITE', _LOG_INFO_IMPORTANTE);
-
 // Initialisations critiques non surchargeables par les plugins
 // INITIALISER LES REPERTOIRES NON PARTAGEABLES ET LES CONSTANTES
 // (charge aussi inc/flock)
@@ -387,11 +393,19 @@ if (@is_readable(_CACHE_PLUGINS_OPT) AND @is_readable(_CACHE_PLUGINS_PATH)){
 	// de chargement des plugins et des pipelines
 	actualise_plugins_actifs();
 }
+
 // Initialisations non critiques surchargeables par les plugins
 spip_initialisation_suite();
 
-if (!defined('_OUTILS_DEVELOPPEURS'))
-	define('_OUTILS_DEVELOPPEURS',false);
+if (!defined('_LOG_FILTRE_GRAVITE')) {
+	/** niveau maxi d'enregistrement des logs */
+	define('_LOG_FILTRE_GRAVITE', _LOG_INFO_IMPORTANTE);
+}
+
+if (!defined('_OUTILS_DEVELOPPEURS')) {
+	/** Activer des outils pour développeurs ? */
+	define('_OUTILS_DEVELOPPEURS', false);
+}
 
 // charger systematiquement inc/autoriser dans l'espace restreint
 if (test_espace_prive())
-- 
GitLab