diff --git a/modules/Migration/schema/810_to_820.php b/modules/Migration/schema/810_to_820.php index d0315444bb21edc529a41c26dcc628b7deb84fc0..73ad5bad4eb457352d988e9b323377590f47ddc6 100644 --- a/modules/Migration/schema/810_to_820.php +++ b/modules/Migration/schema/810_to_820.php @@ -41,4 +41,25 @@ if (defined('VTIGER_UPGRADE')) { $db->pquery('ALTER TABLE vtiger_purchaseorder MODIFY s_h_percent DECIMAL(25,3)', array()); $db->pquery('ALTER TABLE vtiger_quotes MODIFY s_h_percent DECIMAL(25,3)', array()); -} + // START - Adding htaccess to upload_badext array in config file. + // Updating the config file + $fileName = 'config.inc.php'; + if (file_exists($fileName)) { + // Read the contents of the file + $completeData = file_get_contents('config.inc.php'); + $pattern = "/upload_badext\s*=+\s*array\(?...+\);/i"; + + if (preg_match($pattern, $completeData, $matches)) { + $arrayString = $matches[0]; + $content = '/htaccess/i'; + if (!preg_match($content, $arrayString)) { + $updateStringPattern = "/upload_badext\s*=+\s*array\(?...+'/i"; + preg_match($updateStringPattern,$completeData,$matches); + $updatedContent = preg_replace($updateStringPattern, "$matches[0],'htaccess'", $completeData); + // Put the new contents into the file + file_put_contents($fileName, $updatedContent); + } + } + } + //END +} \ No newline at end of file