BUGFIX ErrorPage::requireDefaultRecords() case where no assets directory causes an fopen() error. Ensure assets directory is created before attempting to write error page files

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/branches/2.4@113590 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Sean Harvey 2010-11-10 01:51:31 +00:00 committed by Sam Minnee
parent cfcf7a5358
commit 68eebd8023

View File

@ -60,6 +60,11 @@ class ErrorPage extends Page {
function requireDefaultRecords() {
parent::requireDefaultRecords();
// Ensure that an assets path exists before we do any error page creation
if(!file_exists(ASSETS_PATH)) {
mkdir(ASSETS_PATH);
}
$pageNotFoundErrorPage = DataObject::get_one('ErrorPage', "\"ErrorCode\" = '404'");
$pageNotFoundErrorPageExists = ($pageNotFoundErrorPage && $pageNotFoundErrorPage->exists()) ? true : false;
$pageNotFoundErrorPagePath = self::get_filepath_for_errorcode(404);