2
0
forked from Wavyzz/dolibarr

QUAL All $conf->global->module->enabled are replaced with isModEnabled()

This commit is contained in:
Laurent Destailleur
2024-10-07 14:40:29 +02:00
parent 9b378d74af
commit 58cc96cd33
18 changed files with 36 additions and 25 deletions

View File

@@ -137,6 +137,17 @@ class CodingPhpTest extends CommonClassTest
$this->verifyIsModuleEnabledOk($filecontent, $report_filepath);
// Check we do not use the syntax conf->global->enabled->...
$ok = true;
$matches = array();
preg_match_all('/->global->(.*)->enabled/', $filecontent, $matches, PREG_SET_ORDER);
foreach ($matches as $key => $val) {
$ok = false;
break;
}
//print __METHOD__." Result for checking we don't have non escaped string in sql requests for file ".$file."\n";
$this->assertTrue($ok, 'Found a ->global->...->enabled instead of isModEnabled("...") in file '.$file['relativename']);
if (preg_match('/\.class\.php/', $file['relativename'])
|| preg_match('/boxes\/box_/', $file['relativename'])
|| preg_match('/modules\/.*\/doc\/(doc|pdf)_/', $file['relativename'])