lgro...@hephaestos.ovh.adullact.org
unread,Sep 14, 2020, 6:26:25 AM9/14/20Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to openmairie...@googlegroups.com
Author: lgroleau
Date: 2020-09-14 12:26:23 +0200 (Mon, 14 Sep 2020)
New Revision: 4645
Modified:
openmairie_exemple/branches/4.9-extras/core/om_application.class.php
openmairie_exemple/branches/4.9-extras/core/om_logger.class.php
openmairie_exemple/branches/4.9-extras/core/om_rest_client.class.php
Log:
* Correction : le chemin des logs par defaut du module REST ignorait le parametrage general
Modified: openmairie_exemple/branches/4.9-extras/core/om_application.class.php
===================================================================
--- openmairie_exemple/branches/4.9-extras/core/om_application.class.php 2020-09-14 08:36:37 UTC (rev 4644)
+++ openmairie_exemple/branches/4.9-extras/core/om_application.class.php 2020-09-14 10:26:23 UTC (rev 4645)
@@ -1594,6 +1594,7 @@
}
}
$this->addToLog(__METHOD__."(): this->filestorage_config = ".print_r($this->filestorage_config, true), EXTRA_VERBOSE_MODE);
+ logger::instance()->set_log_path_default($this->filestorage_config["log"]["path"]);
//
return true;
}
Modified: openmairie_exemple/branches/4.9-extras/core/om_logger.class.php
===================================================================
--- openmairie_exemple/branches/4.9-extras/core/om_logger.class.php 2020-09-14 08:36:37 UTC (rev 4644)
+++ openmairie_exemple/branches/4.9-extras/core/om_logger.class.php 2020-09-14 10:26:23 UTC (rev 4645)
@@ -41,7 +41,7 @@
*/
var $logname;
- /**
+ /**
* Chemin du fichier log
* @var resource
*/
@@ -48,6 +48,12 @@
var $logpath;
/**
+ * Chemin par défaut du fichier log
+ * @var resource
+ */
+ var $logpath_default = "../var/log";
+
+ /**
* Constructeur.
*/
private function __construct() {
@@ -360,8 +366,10 @@
private function set_targetfolder_path($logpath = "") {
// si aucun chemin n'est précisé
if ( $logpath == "" ) {
- // valeur par défaut
- $logpath = "../var/log/" ;
+ // valeur par défaut à récupérer depuis la configuration filestorage
+ //
+
+ $logpath = $this->logpath_default;
}
// si le chemin est relatif
@@ -378,6 +386,34 @@
}
/**
+ * Renseigne le path par défaut vers le répertoire cible des fichiers de log.
+ *
+ * @return true
+ */
+ public function set_log_path_default($logpath = "") {
+ // si aucun chemin n'est précisé
+ if ( $logpath == "" ) {
+ // valeur par défaut
+ $logpath = "../var/log/" ;
+ } else {
+ $this->logpath_default = $logpath;
+ }
+
+ // retour en succès
+ return true;
+ }
+
+ /**
+ * Retourne le path par défaut vers le répertoire cible des fichiers de log.
+ *
+ * @return true
+ */
+ public function get_log_path_default() {
+ //
+ return $this->logpath_default;
+ }
+
+ /**
* Retourne le path vers le répertoire cible des fichiers de log.
*
* @return string
Modified: openmairie_exemple/branches/4.9-extras/core/om_rest_client.class.php
===================================================================
--- openmairie_exemple/branches/4.9-extras/core/om_rest_client.class.php 2020-09-14 08:36:37 UTC (rev 4644)
+++ openmairie_exemple/branches/4.9-extras/core/om_rest_client.class.php 2020-09-14 10:26:23 UTC (rev 4645)
@@ -130,13 +130,17 @@
* @param string $logpath Optionnel : nom du fichier log, par défaut "services.log"
*
*/
- public function __construct($url, $username = "", $password = "", $logpath = "../var/log", $logfile = "services.log") {
+ public function __construct($url, $username = "", $password = "", $logpath = "", $logfile = "services.log") {
//Initialisation des variables de la classe
$this->url = $url;
$this->username = $username;
$this->password = $password;
+ $this->log_file_name = $logfile;
+ // chemin des logs par défaut est celui initialisé par l'application
+ if ( $logpath == "" ) {
+ $logpath = logger::instance()->get_log_path_default();
+ }
$this->log_file_path = $logpath;
- $this->log_file_name = $logfile;
//Initialisation de la session curl
$this->curl = curl_init();