From 3da1c1c84335f97211e57543b2670703433ae2f0 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Tue, 4 Feb 2025 04:54:54 +0100 Subject: [PATCH] FIX more bugs and warnings --- htdocs/core/lib/files.lib.php | 4 +++- htdocs/core/modules/modAgenda.class.php | 5 +---- htdocs/install/upgrade2.php | 2 +- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/htdocs/core/lib/files.lib.php b/htdocs/core/lib/files.lib.php index fccce0cc1a9..9033ff0c87d 100644 --- a/htdocs/core/lib/files.lib.php +++ b/htdocs/core/lib/files.lib.php @@ -1562,7 +1562,9 @@ function dol_delete_file($file, $disableglob = 0, $nophperrors = 0, $nohook = 0, } } } else { - $ok = false; // to avoid false positive + if (empty($nophperrors)) { + $ok = false; // to avoid false positive + } dol_syslog("No files to delete found", LOG_DEBUG); } } else { diff --git a/htdocs/core/modules/modAgenda.class.php b/htdocs/core/modules/modAgenda.class.php index 6f05062276d..7e17b32b699 100644 --- a/htdocs/core/modules/modAgenda.class.php +++ b/htdocs/core/modules/modAgenda.class.php @@ -603,10 +603,7 @@ class modAgenda extends DolibarrModules // Permissions $this->remove($options); - $sql = array( - "DELETE FROM ".MAIN_DB_PREFIX."document_model WHERE nom = '".$this->db->escape($this->const[0][2])."' AND type='member' AND entity = ".((int) $conf->entity), - "INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity) VALUES('".$this->db->escape($this->const[0][2])."','member',".((int) $conf->entity).")" - ); + $sql = array(); return $this->_init($sql, $options); } diff --git a/htdocs/install/upgrade2.php b/htdocs/install/upgrade2.php index 53c9d12c399..a0af8634baa 100644 --- a/htdocs/install/upgrade2.php +++ b/htdocs/install/upgrade2.php @@ -4135,7 +4135,7 @@ function migrate_delete_old_files($db, $langs, $conf) //print ''DOL_DOCUMENT_ROOT.$filetodelete."
\n"; if (preg_match('/\*/', $filetodelete) || file_exists(DOL_DOCUMENT_ROOT.$filetodelete)) { //print "Process file ".$filetodelete."\n"; - $result = dol_delete_file(DOL_DOCUMENT_ROOT.$filetodelete, 0, 0, 0, null, true, false); + $result = dol_delete_file(DOL_DOCUMENT_ROOT.$filetodelete, 0, 1, 0, null, true, false); // nophperrors to avoid false positive with asterisk if (!$result) { $langs->load("errors"); print '
'.$langs->trans("Error").': '.$langs->trans("ErrorFailToDeleteFile", DOL_DOCUMENT_ROOT.$filetodelete);