concrete/src/Page/Page.php
public static function addHomePage(TreeInterface $siteTree = null)
    {
        $app = Application::getFacadeApplication();
        // creates the home page of the site
        $db = $app->make(Connection::class);

        $cParentID = 0;
        $uID = HOME_UID;

        $data = [
            'name' => HOME_NAME,
            'uID' => $uID,
        ];
        $cobj = parent::createCollection($data);
        $cID = $cobj->getCollectionID();

        if (!is_object($siteTree)) {
            $site = \Core::make('site')->getSite();
            $siteTree = $site->getSiteTreeObject();
        }
        $siteTreeID = $siteTree->getSiteTreeID();

        $v = [$cID, $siteTreeID, $cParentID, $uID, 'OVERRIDE', 1, (int) $cID, 0];
        $q = 'insert into Pages (cID, siteTreeID, cParentID, uID, cInheritPermissionsFrom, cOverrideTemplatePermissions, cInheritPermissionsFromCID, cDisplayOrder) values (?, ?, ?, ?, ?, ?, ?, ?)';
        $r = $db->prepare($q);
        $r->execute($v);
        if (!$siteTree->getSiteHomePageID()) {
            $siteTree->setSiteHomePageID($cID);
            $em = $app->make(EntityManagerInterface::class);
            $em->flush($siteTree);
        }
        $pc = self::getByID($cID, 'RECENT');

        return $pc;
    }
public static function addHomePage(TreeInterface $siteTree = null)
    {
        $app = Application::getFacadeApplication();
        // creates the home page of the site
        $db = $app->make(Connection::class);

        $cParentID = 0;
        $uID = HOME_UID;

        $data = [
            'name' => HOME_NAME,
            'uID' => $uID,
        ];
        $cobj = parent::createCollection($data);
        $cID = $cobj->getCollectionID();

        if (!is_object($siteTree)) {
            $site = \Core::make('site')->getSite();
            $siteTree = $site->getSiteTreeObject();
        }
        $siteTreeID = $siteTree->getSiteTreeID();

        $v = [$cID, $siteTreeID, $cParentID, $uID, 'OVERRIDE', 1, (int) $cID, 0];
        $q = 'insert into Pages (cID, siteTreeID, cParentID, uID, cInheritPermissionsFrom, cOverrideTemplatePermissions, cInheritPermissionsFromCID, cDisplayOrder) values (?, ?, ?, ?, ?, ?, ?, ?)';
        $r = $db->prepare($q);
        $r->execute($v);
        if (!$siteTree->getSiteHomePageID()) {
            $siteTree->setSiteHomePageID($cID);
            $em = $app->make(EntityManagerInterface::class);
            $em->flush($siteTree);
        }
        $pc = self::getByID($cID, 'RECENT');

        return $pc;
    }
public static function addHomePage ( TreeInterface $ siteTree = null ) { $ app = Application :: getFacadeApplication ( ) ; // creates the home page of the site $ db = $ app -> make ( Connection :: class ) ; $ cParentID = 0 ; $ uID = HOME_UID ; $ data = [ 'name' => HOME_NAME , 'uID' => $ uID , ] ; $ cobj = parent :: createCollection ( $ data ) ; $ cID = $ cobj -> getCollectionID ( ) ; if ( ! is_object ( $ siteTree ) ) { $ site = \ Core :: make ( 'site' ) -> getSite ( ) ; $ siteTree = $ site -> getSiteTreeObject ( ) ; } $ siteTreeID = $ siteTree -> getSiteTreeID ( ) ; $ v = [ $ cID , $ siteTreeID , $ cParentID , $ uID , 'OVERRIDE' , 1 , ( int ) $ cID , 0 ] ; $ q = 'insert into Pages (cID, siteTreeID, cParentID, uID, cInheritPermissionsFrom, cOverrideTemplatePermissions, cInheritPermissionsFromCID, cDisplayOrder) values (?, ?, ?, ?, ?, ?, ?, ?)' ; $ r = $ db -> prepare ( $ q ) ; $ r -> execute ( $ v ) ; if ( ! $ siteTree -> getSiteHomePageID ( ) ) { $ siteTree -> setSiteHomePageID ( $ cID ) ; $ em = $ app -> make ( EntityManagerInterface :: class ) ; $ em -> flush ( $ siteTree ) ; } $ pc = self :: getByID ( $ cID , 'RECENT' ) ; return $ pc ; }
Add the home page to the system. Typically used only by the installation program.

@param \Concrete\Core\Site\Tree\TreeInterface|null $siteTree

@return \Concrete\Core\Page\Page
Add the home page to the system . Typically used only by the installation program .