public function getOrphanedPages($class = SiteTree::class, $filter = array(), $sort = null, $join = null, $limit = null)
    {
        // Alter condition
        $table = DataObject::getSchema()->tableName($class);
        if (empty($filter)) {
            $where = array();
        } elseif (is_array($filter)) {
            $where = $filter;
        } else {
            $where = array($filter);
        }
        $where[] = array("\"{$table}\".\"ParentID\" != ?" => 0);
        $where[] = '"Parents"."ID" IS NULL';

        $orphans = new ArrayList();
        foreach (array(Versioned::DRAFT, Versioned::LIVE) as $stage) {
            $table .= ($stage == Versioned::LIVE) ? '_Live' : '';
            $stageOrphans = Versioned::get_by_stage(
                $class,
                $stage,
                $where,
                $sort,
                null,
                $limit
            )->leftJoin($table, "\"$table\".\"ParentID\" = \"Parents\".\"ID\"", "Parents");
            $orphans->merge($stageOrphans);
        }

        $orphans->removeDuplicates();

        return $orphans;
    }
public function getOrphanedPages($class = SiteTree::class, $filter = array(), $sort = null, $join = null, $limit = null)
    {
        // Alter condition
        $table = DataObject::getSchema()->tableName($class);
        if (empty($filter)) {
            $where = array();
        } elseif (is_array($filter)) {
            $where = $filter;
        } else {
            $where = array($filter);
        }
        $where[] = array("\"{$table}\".\"ParentID\" != ?" => 0);
        $where[] = '"Parents"."ID" IS NULL';

        $orphans = new ArrayList();
        foreach (array(Versioned::DRAFT, Versioned::LIVE) as $stage) {
            $table .= ($stage == Versioned::LIVE) ? '_Live' : '';
            $stageOrphans = Versioned::get_by_stage(
                $class,
                $stage,
                $where,
                $sort,
                null,
                $limit
            )->leftJoin($table, "\"$table\".\"ParentID\" = \"Parents\".\"ID\"", "Parents");
            $orphans->merge($stageOrphans);
        }

        $orphans->removeDuplicates();

        return $orphans;
    }
public function getOrphanedPages ( $ class = SiteTree :: class , $ filter = array ( ) , $ sort = null , $ join = null , $ limit = null ) { // Alter condition $ table = DataObject :: getSchema ( ) -> tableName ( $ class ) ; if ( empty ( $ filter ) ) { $ where = array ( ) ; } elseif ( is_array ( $ filter ) ) { $ where = $ filter ; } else { $ where = array ( $ filter ) ; } $ where [ ] = array ( "\"{$table}\".\"ParentID\" != ?" => 0 ) ; $ where [ ] = '"Parents"."ID" IS NULL' ; $ orphans = new ArrayList ( ) ; foreach ( array ( Versioned :: DRAFT , Versioned :: LIVE ) as $ stage ) { $ table .= ( $ stage == Versioned :: LIVE ) ? '_Live' : '' ; $ stageOrphans = Versioned :: get_by_stage ( $ class , $ stage , $ where , $ sort , null , $ limit ) -> leftJoin ( $ table , "\"$table\".\"ParentID\" = \"Parents\".\"ID\"" , "Parents" ) ; $ orphans -> merge ( $ stageOrphans ) ; } $ orphans -> removeDuplicates ( ) ; return $ orphans ; }
Gets all orphans from "Stage" and "Live" stages.

@param string $class
@param array $filter
@param string $sort
@param string $join
@param int|array $limit
@return SS_List
Gets all orphans from Stage and Live stages .