public function archive($data, $form)
    {
        $id = $data['ID'];
        /** @var SiteTree $record */
        $record = SiteTree::get()->byID($id);
        if (!$record || !$record->exists()) {
            throw new HTTPResponse_Exception("Bad record ID #$id", 404);
        }
        if (!$record->canArchive()) {
            return Security::permissionFailure();
        }

        // Archive record
        $record->doArchive();

        $this->getResponse()->addHeader(
            'X-Status',
            rawurlencode(_t(
                __CLASS__ . '.ARCHIVEDPAGE',
                "Archived page '{title}'",
                ['title' => $record->Title]
            ))
        );

        // Even if the record has been deleted from stage and live, it can be viewed in "archive mode"
        return $this->getResponseNegotiator()->respond($this->getRequest());
    }
public function archive($data, $form)
    {
        $id = $data['ID'];
        /** @var SiteTree $record */
        $record = SiteTree::get()->byID($id);
        if (!$record || !$record->exists()) {
            throw new HTTPResponse_Exception("Bad record ID #$id", 404);
        }
        if (!$record->canArchive()) {
            return Security::permissionFailure();
        }

        // Archive record
        $record->doArchive();

        $this->getResponse()->addHeader(
            'X-Status',
            rawurlencode(_t(
                __CLASS__ . '.ARCHIVEDPAGE',
                "Archived page '{title}'",
                ['title' => $record->Title]
            ))
        );

        // Even if the record has been deleted from stage and live, it can be viewed in "archive mode"
        return $this->getResponseNegotiator()->respond($this->getRequest());
    }
public function archive ( $ data , $ form ) { $ id = $ data [ 'ID' ] ; /** @var SiteTree $record */ $ record = SiteTree :: get ( ) -> byID ( $ id ) ; if ( ! $ record || ! $ record -> exists ( ) ) { throw new HTTPResponse_Exception ( "Bad record ID #$id" , 404 ) ; } if ( ! $ record -> canArchive ( ) ) { return Security :: permissionFailure ( ) ; } // Archive record $ record -> doArchive ( ) ; $ this -> getResponse ( ) -> addHeader ( 'X-Status' , rawurlencode ( _t ( __CLASS__ . '.ARCHIVEDPAGE' , "Archived page '{title}'" , [ 'title' => $ record -> Title ] ) ) ) ; // Even if the record has been deleted from stage and live, it can be viewed in "archive mode" return $ this -> getResponseNegotiator ( ) -> respond ( $ this -> getRequest ( ) ) ; }
Delete this page from both live and stage

@param array $data
@param Form $form
@return HTTPResponse
@throws HTTPResponse_Exception
Delete this page from both live and stage