public function remove($pageName)
    {
        if ($pageName == $this->configurationHandler->homepage()) {
            throw new RuntimeException("exception_homepage_cannot_be_removed");
        }

        $pageDir = $this->pagesDir . '/' . $pageName;
        Dispatcher::dispatch(PageCollectionEvents::PAGE_COLLECTION_REMOVING, new PageCollectionRemovingEvent($this->username, $pageDir));

        $filesystem = new Filesystem();
        if (file_exists($pageDir . '/page.json')) {
            $filesystem->mirror($pageDir, $this->pagesRemovedDir . '/' . $pageName . "-" . date("Y-m-d-H.i.s"));
        }
        $filesystem->remove($pageDir);

        Dispatcher::dispatch(PageCollectionEvents::PAGE_COLLECTION_REMOVED, new PageCollectionRemovedEvent($this->username, $pageDir));
        DataLogger::log(sprintf('Page "%s" was successfully removed from website', $pageName));
    }
public function remove($pageName)
    {
        if ($pageName == $this->configurationHandler->homepage()) {
            throw new RuntimeException("exception_homepage_cannot_be_removed");
        }

        $pageDir = $this->pagesDir . '/' . $pageName;
        Dispatcher::dispatch(PageCollectionEvents::PAGE_COLLECTION_REMOVING, new PageCollectionRemovingEvent($this->username, $pageDir));

        $filesystem = new Filesystem();
        if (file_exists($pageDir . '/page.json')) {
            $filesystem->mirror($pageDir, $this->pagesRemovedDir . '/' . $pageName . "-" . date("Y-m-d-H.i.s"));
        }
        $filesystem->remove($pageDir);

        Dispatcher::dispatch(PageCollectionEvents::PAGE_COLLECTION_REMOVED, new PageCollectionRemovedEvent($this->username, $pageDir));
        DataLogger::log(sprintf('Page "%s" was successfully removed from website', $pageName));
    }
public function remove ( $ pageName ) { if ( $ pageName == $ this -> configurationHandler -> homepage ( ) ) { throw new RuntimeException ( "exception_homepage_cannot_be_removed" ) ; } $ pageDir = $ this -> pagesDir . '/' . $ pageName ; Dispatcher :: dispatch ( PageCollectionEvents :: PAGE_COLLECTION_REMOVING , new PageCollectionRemovingEvent ( $ this -> username , $ pageDir ) ) ; $ filesystem = new Filesystem ( ) ; if ( file_exists ( $ pageDir . '/page.json' ) ) { $ filesystem -> mirror ( $ pageDir , $ this -> pagesRemovedDir . '/' . $ pageName . "-" . date ( "Y-m-d-H.i.s" ) ) ; } $ filesystem -> remove ( $ pageDir ) ; Dispatcher :: dispatch ( PageCollectionEvents :: PAGE_COLLECTION_REMOVED , new PageCollectionRemovedEvent ( $ this -> username , $ pageDir ) ) ; DataLogger :: log ( sprintf ( 'Page "%s" was successfully removed from website' , $ pageName ) ) ; }
Removes the given page

@param $pageName
Removes the given page