* */ /** * Ensure that the files for folder browsing protection (.htaccess, web.config) are kept after an "npm install/update" command */ $iTopFolder = __DIR__."/../../../"; require_once("$iTopFolder/approot.inc.php"); $sDependenciesRootFolderAbsPath = APPROOT . "node_modules/"; $aFilesToCheck = [ ".htaccess", "web.config", ]; echo "This command aims at ensuring that folder browsing protection files (.htaccess, web.config) are present in the dependencies folder even after an install/upgrade command\n"; echo "Checking files:\n"; foreach($aFilesToCheck as $sFileToCheck) { if (file_exists($sDependenciesRootFolderAbsPath . $sFileToCheck)) { echo "✔️ $sFileToCheck is present\n"; continue; } // If missing, copy the one from /lib as it contains the necessary allow/deny directives for third-parties copy(APPROOT . "lib/$sFileToCheck", $sDependenciesRootFolderAbsPath . $sFileToCheck); echo "✔️ $sFileToCheck was missing and has been re-created\n"; } // Ensure separation with following scripts echo "\n";