vtenext/modules/Update/changes/2058_2059.php
2021-04-28 20:10:26 +02:00

33 lines
1.0 KiB
PHP

<?php
global $adb, $table_prefix;
// crmv@203532 crmv@202475
// remove Settings.php and CallRelatedList.php from custom modules
$keepSetList = array('Calendar', 'ModComments', 'PBXManager');
$keepRelList = array('Campaigns', 'Emails', 'PBXManager');
$res = $adb->query("SELECT name FROM {$table_prefix}_tab WHERE isentitytype = 1");
while ($row = $adb->fetchByAssoc($res, -1, false)) {
$mod = $row['name'];
$dir = 'modules/'.$mod.'/';
if (!in_array($mod, $keepSetList) && is_dir($dir) && is_file($dir.'Settings.php')) {
$file = $dir.'Settings.php';
if (is_readable($file) && is_writeable($file)) {
$content = file_get_contents($file);
if ($content !== false && strpos($content, 'mycrmv') === false) {
@unlink($file);
}
}
}
if (!in_array($mod, $keepRelList) && is_dir($dir) && is_file($dir.'CallRelatedList.php')) {
$file = $dir.'CallRelatedList.php';
if (is_readable($file) && is_writeable($file)) {
$content = file_get_contents($file);
if ($content !== false && strpos($content, 'mycrmv') === false) {
@unlink($file);
}
}
}
}