--- /tmp/dsg/dolibarr/htdocs/debugbar/class/github_19.0.3_DebugBar.php +++ /tmp/dsg/dolibarr/htdocs/debugbar/class/client_DebugBar.php @@ -2,21 +1,0 @@ -/* Copyright (C) 2023 Laurent Destailleur - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -/** - * \file htdocs/debugbar/class/DebugBar.php - * \brief Class for debugbar - * \ingroup debugbar - */ @@ -26,2 +5,2 @@ -use DebugBar\DebugBar; - +use \DebugBar\DebugBar; +use \DebugBar\DataCollector\PhpInfoCollector; @@ -33 +11,0 @@ -dol_include_once('/debugbar/class/DataCollector/DolPhpCollector.php'); @@ -60 +37,0 @@ - $this->addCollector(new PhpCollector()); @@ -65 +42 @@ - if (isModEnabled('syslog')) { + if ($conf->syslog->enabled) { @@ -73 +50 @@ - * @return \DebugBar\JavascriptRenderer String content + * @return string String content @@ -77,7 +54,5 @@ - $renderer = parent::getJavascriptRenderer(DOL_URL_ROOT.'/includes/maximebf/debugbar/src/DebugBar/Resources'); - $renderer->disableVendor('jquery'); // We already have jquery loaded globally by the main.inc.php - $renderer->disableVendor('fontawesome'); // We already have fontawesome loaded globally by the main.inc.php - $renderer->disableVendor('highlightjs'); // We don't need this - $renderer->setEnableJqueryNoConflict(false); // We don't need no conflict - - return $renderer; + $renderer = parent::getJavascriptRenderer(DOL_URL_ROOT.'/includes/DebugBar/Resources'); + //$renderer->disableVendor('jquery'); + $renderer->disableVendor('fontawesome'); + $renderer->disableVendor('highlightjs'); + return $renderer; --- /tmp/dsg/dolibarr/htdocs/debugbar/class/github_19.0.3_TraceableDB.php +++ /tmp/dsg/dolibarr/htdocs/debugbar/class/client_TraceableDB.php @@ -2,21 +1,0 @@ -/* Copyright (C) 2023 Laurent Destailleur - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -/** - * \file htdocs/debugbar/class/DataCollector/TraceableDB.php - * \brief Class for debugbar DB - * \ingroup debugbar - */ @@ -70 +49 @@ - $this->type = $this->db->type; + $this->type = $db->type; @@ -96 +75 @@ - // phpcs:enable + // phpcs:enable @@ -104,7 +83,6 @@ - * @param int $param Date TMS to convert - * @param mixed $gm 'gmt'=Input informations are GMT values, 'tzserver'=Local to server TZ - * @return string Date in a string YYYY-MM-DD HH:MM:SS - */ - public function idate($param, $gm = 'tzserver') - { - return $this->db->idate($param, $gm); + * @param int $param Date TMS to convert + * @return string Date in a string YYYYMMDDHHMMSS + */ + public function idate($param) + { + return $this->db->idate($param); @@ -126,6 +104,5 @@ - * @param string $textinlog Add a small text into log. '' by default. - * @return int 1 if transaction successfuly opened or already opened, 0 if error - */ - public function begin($textinlog = '') - { - return $this->db->begin($textinlog); + * @return int 1 if transaction successfuly opened or already opened, 0 if error + */ + public function begin() + { + return $this->db->begin(); @@ -167,3 +144,3 @@ - public function convertSQLFromMysql($line, $type = 'ddl') - { - return $this->db->convertSQLFromMysql($line); + public static function convertSQLFromMysql($line, $type = 'ddl') + { + return self::$db->convertSQLFromMysql($line); @@ -182 +159 @@ - // phpcs:enable + // phpcs:enable @@ -209,12 +185,0 @@ - * List tables into a database with table info - * - * @param string $database Name of database - * @param string $table Nmae of table filter ('xxx%') - * @return array List of tables in an array - */ - public function DDLListTablesFull($database, $table = '') - { - return $this->db->DDLListTablesFull($database, $table); - } - - /** @@ -262 +227 @@ - // phpcs:enable + // phpcs:enable @@ -285,11 +249,0 @@ - } - - /** - * Escape a string to insert data into a like - * - * @param string $stringtoencode String to escape - * @return string String escaped - */ - public function escapeforlike($stringtoencode) - { - return $this->db->escapeforlike($stringtoencode); @@ -308,2 +262,2 @@ - // phpcs:enable - return $this->db->last_insert_id($tab, $fieldid); + // phpcs:enable + return $this->db->last_insert_id($tab, $fieldid); @@ -336,8 +290,7 @@ - * @param string $query SQL query string - * @param int $usesavepoint 0=Default mode, 1=Run a savepoint before and a rollback to savepoint if error (this allow to have some request with errors inside global transactions). - * Note that with Mysql, this parameter is not used as Myssql can already commit a transaction even if one request is in error, without using savepoints. - * @param string $type Type of SQL order ('ddl' for insert, update, select, delete or 'dml' for create, alter...) - * @param int $result_mode Result mode - * @return resource Resultset of answer - */ - public function query($query, $usesavepoint = 0, $type = 'auto', $result_mode = 0) + * @param string $query SQL query string + * @param int $usesavepoint 0=Default mode, 1=Run a savepoint before and a rollback to savepoint if error (this allow to have some request with errors inside global transactions). + * Note that with Mysql, this parameter is not used as Myssql can already commit a transaction even if one request is in error, without using savepoints. + * @param string $type Type of SQL order ('ddl' for insert, update, select, delete or 'dml' for create, alter...) + * @return resource Resultset of answer + */ + public function query($query, $usesavepoint = 0, $type = 'auto') @@ -347 +300 @@ - $resql = $this->db->query($query, $usesavepoint, $type, $result_mode); + $resql = $this->db->query($query, $usesavepoint, $type); @@ -459 +412 @@ - // phpcs:enable + // phpcs:enable @@ -503 +456 @@ - * @return int Return integer <0 if KO, >=0 if OK + * @return int <0 if KO, >=0 if OK @@ -514 +467 @@ - * @return int Return integer <0 if KO, >=0 if OK + * @return int <0 if KO, >=0 if OK @@ -538 +491 @@ - * @return int Return integer <0 if KO, >0 if OK + * @return int <0 if KO, >0 if OK @@ -550 +503 @@ - * @return int Return integer <0 if KO, >0 if OK + * @return int <0 if KO, >0 if OK @@ -563 +516 @@ - * @return int Return integer <0 if KO, >0 if OK + * @return int <0 if KO, >0 if OK @@ -619 +572 @@ - * @return int Return integer <0 if KO, >=0 if OK + * @return int <0 if KO, >=0 if OK @@ -638 +591 @@ - // phpcs:enable + // phpcs:enable @@ -644,7 +597,7 @@ - * Warning: This function includes the escape and add the SQL simple quotes on strings. - * - * @param string $fieldorvalue Field name or value to encrypt - * @param int $withQuotes Return string including the SQL simple quotes. This param must always be 1 (Value 0 is bugged and deprecated). - * @return string XXX(field) or XXX('value') or field or 'value' - */ - public function encrypt($fieldorvalue, $withQuotes = 1) + * Warning: This function includes the escape, so it must use direct value + * + * @param string $fieldorvalue Field name or value to encrypt + * @param int $withQuotes Return string with quotes + * @return string XXX(field) or XXX('value') or field or 'value' + */ + public function encrypt($fieldorvalue, $withQuotes = 0) @@ -685 +638 @@ - $this->db->free($resultset); + return $this->db->free($resultset); @@ -721,4 +674,4 @@ - * Returns the current line (as an object) for the resultset cursor - * - * @param resource|PgSql\Connection $resultset Handler of the desired SQL request - * @return Object Object result line or false if KO or end of cursor + * Renvoie la ligne courante (comme un objet) pour le curseur resultset + * + * @param resource $resultset Curseur de la requete voulue + * @return Object Object result line or false if KO or end of cursor @@ -728 +681 @@ - // phpcs:enable + // phpcs:enable @@ -741 +694 @@ - // phpcs:enable + // phpcs:enable --- /tmp/dsg/dolibarr/htdocs/debugbar/class/github_19.0.3_autoloader.php +++ /tmp/dsg/dolibarr/htdocs/debugbar/class/client_autoloader.php @@ -1,0 +2 @@ + @@ -7,28 +8,10 @@ - if (preg_match('/^DebugBar/', $class)) { - $file = DOL_DOCUMENT_ROOT.'/includes/maximebf/debugbar/src/'.str_replace('\\', DIRECTORY_SEPARATOR, $class).'.php'; - //var_dump($class.' - '.file_exists($file).' - '.$file); - if (file_exists($file)) { - require_once $file; - return true; - } - return false; - } - if (preg_match('/^'.preg_quote('Psr\Log', '/').'/', $class)) { - $file = DOL_DOCUMENT_ROOT.'/includes/'.str_replace('\\', DIRECTORY_SEPARATOR, $class).'.php'; - //var_dump($class.' - '.file_exists($file).' - '.$file); - if (file_exists($file)) { - require_once $file; - return true; - } - return false; - } - if (preg_match('/^'.preg_quote('Symfony\Component\VarDumper', '/').'/', $class)) { - $class = preg_replace('/'.preg_quote('Symfony\Component\VarDumper', '/').'/', '', $class); - $file = DOL_DOCUMENT_ROOT.'/includes/symfony/var-dumper/'.str_replace('\\', DIRECTORY_SEPARATOR, $class).'.php'; - if (file_exists($file)) { - require_once $file; - return true; - } - return false; - } - return true; + if (preg_match('/^DebugBar/', $class) || preg_match('/^'.preg_quote('Psr\Log', '/').'/', $class)) { + $file = DOL_DOCUMENT_ROOT.'/includes/'.str_replace('\\', DIRECTORY_SEPARATOR, $class).'.php'; + //var_dump($class.' - '.file_exists($file).' - '.$file); + if (file_exists($file)) { + require_once $file; + return true; + } + return false; + } + return true;