fixes #2872 CMS Maintenance deletes published HTML files

Fixed the issue and committed code for review, please check it.