升级到Silverstripe 4.1.0得到致命错误:在ErrorPageController.php中找不到类'PageController'?

时间:2018-03-23 03:19:38

标签: php silverstripe silverstripe-4

我正在将Silverstripe 3.6.5站点升级到4.1.0,只是进行升级过程。我遇到了障碍。我收到了这个错误:

Fatal error: Class 'PageController' not found in /Users/username/Sites/chch-builder-v2-ss4/vendor/silverstripe/errorpage/src/ErrorPageController.php on line 11

这是ErrorPageController.php文件:

<?php
namespace SilverStripe\ErrorPage;

use PageController;
use SilverStripe\Control\HTTPRequest;
use SilverStripe\Control\HTTPResponse;

/**
 * Controller for ErrorPages.
 */
class ErrorPageController extends PageController
{
    /**
     * Overload the provided {@link Controller::handleRequest()} to append the
     * correct status code post request since otherwise permission related error
     * pages such as 401 and 403 pages won't be rendered due to
     * {@link HTTPResponse::isFinished() ignoring the response body.
     *
     * @param HTTPRequest $request
     * @return HTTPResponse
     */
    public function handleRequest(HTTPRequest $request)
    {
        /** @var ErrorPage $page */
        $page = $this->data();
        $response = parent::handleRequest($request);
        $response->setStatusCode($page->ErrorCode);
        return $response;
    }
}

我在这里错过了什么/做错了什么?

1 个答案:

答案 0 :(得分:2)

升级到SilverStripe 4时,我们需要将Page_Controller课程重命名为PageController