*/ die('Remove the "die()" statement on line '.__LINE__.' to execute this script'.PHP_EOL); require_once __DIR__.'/../../public/main/inc/global.inc.php'; api_protect_admin_script(); // Search string $search = 'be:8181'; $replace = 'be'; $dir = api_get_path(SYS_COURSE_PATH); $courses = scandir($dir); $i = 0; foreach ($courses as $courseDir) { if (substr($courseDir, 0, 1) === '.') { continue; } exec('find '.$dir.$courseDir.'/document/ -type f -name "*.html" -exec sed -i '."'s/hn:8181/hn/g' {} +"); //print('find '.$dir.$courseDir.'/document/ -type f -name "*.html" -exec sed -i '."'s/hn:8181/hn/g' {} +
"); $i++; //if ($i == 2) { // exit; //} echo "Replaced all $search in ".$dir.$courseDir."
"; } echo "Done";