public function requireDefaultRecords()
    {
        parent::requireDefaultRecords();
        if (NewsHolderPage::get()->count() === 0) {
            /** @var NewsHolderPage $page */
            $page = NewsHolderPage::create();
            $page->Title = _t('NewsHolderPage.DEFAULTPAGETITLE', 'Newspage');
            $page->Content = '';
            $page->URLSegment = 'news';
            $page->Sort = 1;
            $page->Status = 'Published';
            $page->IsPrimary = true;
            $page->write();
            $page->publish('Stage', 'Live');
            $page->flushCache();
            DB::alteration_message('Newsholder Page created', 'created');
        } else {
            /** Migration is only possible, if the module is installed. We're assuming, this means there's at least one Holderpage. */
            $this->migrateUp();
        }
    }
public function requireDefaultRecords()
    {
        parent::requireDefaultRecords();
        if (NewsHolderPage::get()->count() === 0) {
            /** @var NewsHolderPage $page */
            $page = NewsHolderPage::create();
            $page->Title = _t('NewsHolderPage.DEFAULTPAGETITLE', 'Newspage');
            $page->Content = '';
            $page->URLSegment = 'news';
            $page->Sort = 1;
            $page->Status = 'Published';
            $page->IsPrimary = true;
            $page->write();
            $page->publish('Stage', 'Live');
            $page->flushCache();
            DB::alteration_message('Newsholder Page created', 'created');
        } else {
            /** Migration is only possible, if the module is installed. We're assuming, this means there's at least one Holderpage. */
            $this->migrateUp();
        }
    }
public function requireDefaultRecords ( ) { parent :: requireDefaultRecords ( ) ; if ( NewsHolderPage :: get ( ) -> count ( ) === 0 ) { /** @var NewsHolderPage $page */ $ page = NewsHolderPage :: create ( ) ; $ page -> Title = _t ( 'NewsHolderPage.DEFAULTPAGETITLE' , 'Newspage' ) ; $ page -> Content = '' ; $ page -> URLSegment = 'news' ; $ page -> Sort = 1 ; $ page -> Status = 'Published' ; $ page -> IsPrimary = true ; $ page -> write ( ) ; $ page -> publish ( 'Stage' , 'Live' ) ; $ page -> flushCache ( ) ; DB :: alteration_message ( 'Newsholder Page created' , 'created' ) ; } else { /** Migration is only possible, if the module is installed. We're assuming, this means there's at least one Holderpage. */ $ this -> migrateUp ( ) ; } }
Create a default NewsHolderPage. This prevents error500 because of a missing page.
Create a default NewsHolderPage . This prevents error500 because of a missing page .