Classes/TcaDataGenerator/Generator.php
public function delete()
    {
        $recordFinder = GeneralUtility::makeInstance(RecordFinder::class);

        $commands = [];

        // Delete page tree and all their records on this tree
        $topUids = $recordFinder->findUidsOfStyleguideEntryPages();
        if (!empty($topUids)) {
            foreach ($topUids as $topUid) {
                $commands['pages'][(int)$topUid]['delete'] = 1;
            }
        }

        // Delete all the sys_language demo records
        $languageUids = $recordFinder->findUidsOfDemoLanguages();
        if (!empty($languageUids)) {
            foreach ($languageUids as $languageUid) {
                $commands['sys_language'][(int)$languageUid]['delete'] = 1;
            }
        }

        // Delete demo users
        $demoUserUids = $recordFinder->findUidsOfDemoBeUsers();
        if (!empty($demoUserUids)) {
            foreach ($demoUserUids as $demoUserUid) {
                $commands['be_users'][(int)$demoUserUid]['delete'] = 1;
            }
        }

        // Delete demo groups
        $demoGroupUids = $recordFinder->findUidsOfDemoBeGroups();
        if (!empty($demoGroupUids)) {
            foreach ($demoGroupUids as $demoUserGroup) {
                $commands['be_groups'][(int)$demoUserGroup]['delete'] = 1;
            }
        }

        // Do the thing
        if (!empty($commands)) {
            $dataHandler = GeneralUtility::makeInstance(DataHandler::class);
            $dataHandler->deleteTree = true;
            $dataHandler->start([], $commands);
            $dataHandler->process_cmdmap();
            BackendUtility::setUpdateSignal('updatePageTree');
        }

        // Delete demo images in fileadmin again
        $storageRepository = GeneralUtility::makeInstance(StorageRepository::class);
        $storage = $storageRepository->findByUid(1);
        $folder = $storage->getRootLevelFolder();
        try {
            $folder = $folder->getSubfolder('styleguide');
            $folder->delete(true);
        } catch (\InvalidArgumentException $e) {
            // No op if folder does not exist
        }
    }
public function delete()
    {
        $recordFinder = GeneralUtility::makeInstance(RecordFinder::class);

        $commands = [];

        // Delete page tree and all their records on this tree
        $topUids = $recordFinder->findUidsOfStyleguideEntryPages();
        if (!empty($topUids)) {
            foreach ($topUids as $topUid) {
                $commands['pages'][(int)$topUid]['delete'] = 1;
            }
        }

        // Delete all the sys_language demo records
        $languageUids = $recordFinder->findUidsOfDemoLanguages();
        if (!empty($languageUids)) {
            foreach ($languageUids as $languageUid) {
                $commands['sys_language'][(int)$languageUid]['delete'] = 1;
            }
        }

        // Delete demo users
        $demoUserUids = $recordFinder->findUidsOfDemoBeUsers();
        if (!empty($demoUserUids)) {
            foreach ($demoUserUids as $demoUserUid) {
                $commands['be_users'][(int)$demoUserUid]['delete'] = 1;
            }
        }

        // Delete demo groups
        $demoGroupUids = $recordFinder->findUidsOfDemoBeGroups();
        if (!empty($demoGroupUids)) {
            foreach ($demoGroupUids as $demoUserGroup) {
                $commands['be_groups'][(int)$demoUserGroup]['delete'] = 1;
            }
        }

        // Do the thing
        if (!empty($commands)) {
            $dataHandler = GeneralUtility::makeInstance(DataHandler::class);
            $dataHandler->deleteTree = true;
            $dataHandler->start([], $commands);
            $dataHandler->process_cmdmap();
            BackendUtility::setUpdateSignal('updatePageTree');
        }

        // Delete demo images in fileadmin again
        $storageRepository = GeneralUtility::makeInstance(StorageRepository::class);
        $storage = $storageRepository->findByUid(1);
        $folder = $storage->getRootLevelFolder();
        try {
            $folder = $folder->getSubfolder('styleguide');
            $folder->delete(true);
        } catch (\InvalidArgumentException $e) {
            // No op if folder does not exist
        }
    }
public function delete ( ) { $ recordFinder = GeneralUtility :: makeInstance ( RecordFinder :: class ) ; $ commands = [ ] ; // Delete page tree and all their records on this tree $ topUids = $ recordFinder -> findUidsOfStyleguideEntryPages ( ) ; if ( ! empty ( $ topUids ) ) { foreach ( $ topUids as $ topUid ) { $ commands [ 'pages' ] [ ( int ) $ topUid ] [ 'delete' ] = 1 ; } } // Delete all the sys_language demo records $ languageUids = $ recordFinder -> findUidsOfDemoLanguages ( ) ; if ( ! empty ( $ languageUids ) ) { foreach ( $ languageUids as $ languageUid ) { $ commands [ 'sys_language' ] [ ( int ) $ languageUid ] [ 'delete' ] = 1 ; } } // Delete demo users $ demoUserUids = $ recordFinder -> findUidsOfDemoBeUsers ( ) ; if ( ! empty ( $ demoUserUids ) ) { foreach ( $ demoUserUids as $ demoUserUid ) { $ commands [ 'be_users' ] [ ( int ) $ demoUserUid ] [ 'delete' ] = 1 ; } } // Delete demo groups $ demoGroupUids = $ recordFinder -> findUidsOfDemoBeGroups ( ) ; if ( ! empty ( $ demoGroupUids ) ) { foreach ( $ demoGroupUids as $ demoUserGroup ) { $ commands [ 'be_groups' ] [ ( int ) $ demoUserGroup ] [ 'delete' ] = 1 ; } } // Do the thing if ( ! empty ( $ commands ) ) { $ dataHandler = GeneralUtility :: makeInstance ( DataHandler :: class ) ; $ dataHandler -> deleteTree = true ; $ dataHandler -> start ( [ ] , $ commands ) ; $ dataHandler -> process_cmdmap ( ) ; BackendUtility :: setUpdateSignal ( 'updatePageTree' ) ; } // Delete demo images in fileadmin again $ storageRepository = GeneralUtility :: makeInstance ( StorageRepository :: class ) ; $ storage = $ storageRepository -> findByUid ( 1 ) ; $ folder = $ storage -> getRootLevelFolder ( ) ; try { $ folder = $ folder -> getSubfolder ( 'styleguide' ) ; $ folder -> delete ( true ) ; } catch ( \ InvalidArgumentException $ e ) { // No op if folder does not exist } }
Delete all pages and their records that belong to the
tx_styleguide demo pages

@return void
Delete all pages and their records that belong to the tx_styleguide demo pages