Craft CMS 업그레이드 실패

Aug 21 2020

제어판에서 3.3.15-> 3.5.5에서 업그레이드하려고합니다.

도커를 통해 실행하므로 올바른 종속성을 갖도록 composer.lock 파일을 업데이트하고 다음에 이미지를 다시 빌드 할 때 모든 것이 정상이어야하지만 이상한 일이 발생합니다.

업그레이드를 선택한 후 몇 분 동안 실행 된 후 내부 서버 오류가 발생합니다. 다음을 기록합니다.

craft_1        | [21-Aug-2020 07:38:50] WARNING: [pool www] child 146 said into stderr: "NOTICE: PHP message: PHP Fatal error:  Uncaught Error: Class 'Yii' not found in /app/vendor/yiisoft/yii2/validators/IpValidator.php:218"
craft_1        | [21-Aug-2020 07:38:50] WARNING: [pool www] child 146 said into stderr: "Stack trace:"
craft_1        | [21-Aug-2020 07:38:50] WARNING: [pool www] child 146 said into stderr: "#0 /app/vendor/yiisoft/yii2/base/BaseObject.php(109): yii\validators\IpValidator->init()"
craft_1        | [21-Aug-2020 07:38:50] WARNING: [pool www] child 146 said into stderr: "#1 /app/vendor/yiisoft/yii2/web/Request.php(345): yii\base\BaseObject->__construct()"
craft_1        | [21-Aug-2020 07:38:50] WARNING: [pool www] child 146 said into stderr: "#2 /app/vendor/yiisoft/yii2/web/Request.php(1877): yii\web\Request->getIpValidator()"
craft_1        | [21-Aug-2020 07:38:50] WARNING: [pool www] child 146 said into stderr: "#3 /app/vendor/yiisoft/yii2/web/Request.php(1859): yii\web\Request->getSecureForwardedHeaderTrustedParts()"
craft_1        | [21-Aug-2020 07:38:50] WARNING: [pool www] child 146 said into stderr: "#4 /app/vendor/yiisoft/yii2/web/Request.php(1084): yii\web\Request->getSecureForwardedHeaderTrustedPart('proto')"
craft_1        | 2020/08/21 07:38:50 [error] 139#139: *4 FastCGI sent in stderr: "PHP message: PHP Fatal error:  Uncaught Error: Class 'Yii' not found in /app/vendor/yiisoft/yii2/validators/IpValidator.php:218

조금 이상합니다. 이렇게 업그레이드 할 때 종속성이 사라지는 이유는 무엇입니까? 업그레이드를 시도한 후 설치가 중단 된 상태로 남아 모든 요청에 ​​대해 500 개의 오류 (동일한 오류, Yii를 찾을 수 없음)를 제공합니다. composer.json + composer.lock 파일을 되돌리고 종속성을 다시 설치하면 기능이 복원됩니다.

3.4로 업그레이드하려고 할 때 같은 문제가 있었지만 다른 우선 순위가 있었기 때문에 그 시점에서 업그레이드를 연기했습니다.

이 이미지에 문제없이 스토어에서 플러그인을 추가, 제거 및 업그레이드 할 수 있습니다. composer.json 및 composer.lock 쓰기 가능, 공급 업체 폴더, 저장소 및 마이그레이션이 있습니다.

편집 : 실제로 3.3.16의 변경으로 인해 yii가 2.0.30으로 업그레이드되는 것 같습니다. 이렇게 :

bash-4.4# composer require craftcms/cms:3.3.16
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - Can only install one of: yiisoft/yii2[2.0.30, 2.0.21].
    - Can only install one of: yiisoft/yii2[2.0.30, 2.0.21].
    - Can only install one of: yiisoft/yii2[2.0.30, 2.0.21].
    - craftcms/cms 3.3.16 requires yiisoft/yii2 ~2.0.30.0 -> satisfiable by yiisoft/yii2[2.0.30].
    - Installation request for craftcms/cms 3.3.16 -> satisfiable by craftcms/cms[3.3.16].
    - Installation request for yiisoft/yii2 (locked at 2.0.21) -> satisfiable by yiisoft/yii2[2.0.21].


Installation failed, reverting ./composer.json to its original content.

왜 yii2가 해당 버전에 고정되어 있다고 불평하는지 이해할 수 없습니다. composer.lock의 어떤 것도 해당 버전을 명시 적으로 나타내지 않으며 모두 ~ 버전을 사용합니다.

하지만 잠금 파일, 공급 업체 폴더를 삭제하고 작곡가 설치를 실행해도 Yii2 2.0.30을 성공적으로 설치 한 것 같지만 여전히 그 메시지가 표시되고 작곡가에 매우 좌절하기 시작합니다 ...

편집 2 : 이것은 내 작곡가 파일입니다.

{
  "repositories": [
    {
      "type": "artifact",
      "url": "composer-artifacts/"
    }
  ],
  "require": {
    "aws/aws-sdk-php": "^3.112",
    "carlcs/craft-redactorcustomstyles": "3.0.2",
    "codemix/yii2-streamlog": "^1.2",
    "craftcms/aws-s3": "^1.2",
    "craftcms/cms": "^3.3.15",
    "craftcms/redactor": "2.3.3.2",
    "dolphiq/redirect": "1.0.24",
    "mmikkel/retcon": "2.0.12",
    "thejoshsmith/craft-title-to-sidebar": "1.0.1",
    "verbb/super-table": "2.3.3",
    "vlucas/phpdotenv": "^3.4.0"
  },
  "autoload": {
    "psr-4": {
      "rex\\craft\\modules\\": "modules/"
    }
  },
  "config": {
    "sort-packages": true,
    "optimize-autoloader": true,
    "platform": {
      "php": "7.0"
    },
    "github-oauth": {
      "github.com": "xxxxxx"
    }
  },
  "scripts": {
    "post-root-package-install": [
      "@php -r \"file_exists('.env') || copy('.env.example', '.env');\""
    ]
  }
}

편집 3 : 완전히 새로운 3.5.5 설정에서 동일한 설정을 사용하고 힉업없이 3.5.6으로 업그레이드했습니다. 3.3.15 및 업그레이드에 문제가 있거나 플러그인 중 일부가있는 것 같습니다 (하지만 composer.json에서 제거하려고 시도했지만 여전히 실패합니다).

편집 4 : ./craft update all지금 컨테이너 내에서 실행을 시도 했으며 출력에 다음과 같이 표시됩니다.

bash-5.0# ./craft update all
Fetching available updates ... done
Performing 6 updates:

    - craft 3.3.15 => 3.5.9
    - aws-s3 1.2.5 => 1.2.11
    - redactor 2.3.3.2 => 2.4.0
    - redactor-custom-styles 3.0.2 => 3.0.4
    - redirect 1.0.24 => 1.1.1
    - retcon 2.0.12 => 2.2.1

Backup the database? (yes|no) [yes]:no
Skipping database backup.
Performing update with Composer ... error: An error occurred

Output:

<warning>Package "craftcms/vue-asset" listed for update is not installed. Ignoring.</warning>
<warning>Package "danielstjules/stringy" listed for update is not installed. Ignoring.</warning>
<warning>Package "yiisoft/yii2-shell" listed for update is not installed. Ignoring.</warning>
Loading composer repositories with package information
Updating dependencies
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - Installation request for carlcs/craft-redactorcustomstyles 3.0.4 -> satisfiable by carlcs/craft-redactorcustomstyles[3.0.4].
    - carlcs/craft-redactorcustomstyles 3.0.4 requires craftcms/redactor ^2.7.0 -> satisfiable by craftcms/redactor[2.7.4, 2.7.3, 2.7.2, 2.7.1, 2.7.0] but these conflict with your requirements or minimum-stability.

<warning>Running update with --no-dev does not mean require-dev is ignored, it just means the packages will not be installed. If dev requirements are blocking the update you have to resolve those problems.</warning>


Revert the Composer changes? (yes|no) [yes]:

편집 5 :

범인을 찾았지만 이것이 일부 버전에서는 작동하지만 다른 버전에서는 작동하지 않는 이유를 실제로 이해하지 못합니다.

general.php yii\web\Request에서 "로컬"호스트 이름을 알아내는 데 사용 하고 있습니다.

use yii\web\Request;
$request = new Request; ... '@baseUrlPrefix' => getenv('BASE_URL_PREFIX') ?: $request->getHostInfo(),

별칭을 설정할 때. 어떤 이유로 특정 버전에서는 실패합니다 (Yii? 모르겠 음).

답변

2 nstCactus Sep 15 2020 at 01:32

Craft가 아직 완전히 초기화되지 않았기 때문에 general.phpyii\web\Request 에서 새 인스턴스를 만들 수 없습니다 . 이전 버전에서 작동했지만 Craft 팀이 로딩 순서를 변경 한 것 같습니다.

사이트 기본 URL을 정의하는 다른 방법을 찾아야합니다.

MattJenkins Sep 09 2020 at 23:36

composer.lock 파일과 공급 업체 디렉토리를 제거한 다음 새로 작성기를 설치하려고 했습니까?