private function doRename($name, $new_name) { global $CORE, $AUTHORISATION; $files = array(); // loop all map configs to replace mapname in all map configs foreach ($CORE->getAvailableMaps() as $mapName) { try { $MAPCFG1 = new GlobalMapCfg($mapName); $MAPCFG1->readMapConfig(); $i = 0; // loop definitions of type map foreach ($MAPCFG1->getDefinitions('map') as $key => $obj) { // check if old map name is linked... if ($obj['map_name'] == $name) { $MAPCFG1->setValue('map', $i, 'map_name', $new_name); $MAPCFG1->writeElement('map', $i); } $i++; } } catch (Exception $e) { // Do nothing. Siletly pass config errors here... } } // And also remove the permission $AUTHORISATION->renameMapPermissions($name, $new_name); // rename config file rename(cfg('paths', 'mapcfg') . $name . '.cfg', cfg('paths', 'mapcfg') . $new_name . '.cfg'); }