Optimize php file cleaning to avoid lag on undo.