$filename){ // Find the name of the file generated by the updateclass script $pos=strrpos($filename,"/"); $Newfilename=substr_replace($filename, 'SugarCore.', $pos+1, 0); //delete the new SugarBean that extends CoreBean and replace it by the old one undoing all the changes if (file_exists($Newfilename)){ unlink($filename); $handle = file_get_contents($Newfilename); $data = preg_replace("/class SugarCore".$Classname."/", 'class '.$Classname, $handle); $data1 = preg_replace("/function SugarCore".$Classname."/", 'function '.$Classname, $data); file_put_contents($Newfilename,$data1); rename($Newfilename,$filename); } } ?>