Browse Source

PHP 8.1 compatibility

baijunyao 3 years ago
parent
commit
0ff388983e

+ 122 - 1
.github/workflows/CI.yml

@@ -228,10 +228,131 @@ jobs:
         with:
           files: storage/framework/testing/coverage.xml
 
+  php_8_1_mysql_5_6:
+    name: PHP8.1+MySQL5.6
+    runs-on: ubuntu-latest
+    services:
+      mysql:
+        image: mysql:5.6
+        env:
+          MYSQL_ROOT_PASSWORD: laravel_bjyblog
+          MYSQL_DATABASE: laravel_bjyblog
+    container:
+      image: baijunyao/php:8.1-local
+      volumes:
+        - /__w/laravel-bjyblog/laravel-bjyblog:/app
+    steps:
+      - name: Checkout
+        uses: actions/checkout@v2
+      - name: Get Composer Cache Directory
+        id: composer-cache
+        run: |
+          echo "::set-output name=dir::$(composer config cache-files-dir)"
+      - uses: actions/cache@v1
+        with:
+          path: ${{ steps.composer-cache.outputs.dir }}
+          key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
+          restore-keys: |
+            ${{ runner.os }}-composer-
+      - name: Initial
+        run: |
+          cp .env.actions .env
+          composer install
+          php artisan key:generate
+          php artisan passport:keys
+          php artisan migrate
+          php artisan db:seed
+          php artisan storage:link --relative
+      - name: Test
+        run: |
+          composer test
+
+  php_8_1_mysql_5_7:
+    name: PHP8.1+MySQL5.7
+    runs-on: ubuntu-latest
+    services:
+      mysql:
+        image: mysql:5.7
+        env:
+          MYSQL_ROOT_PASSWORD: laravel_bjyblog
+          MYSQL_DATABASE: laravel_bjyblog
+    container:
+      image: baijunyao/php:8.1-local
+      volumes:
+        - /__w/laravel-bjyblog/laravel-bjyblog:/app
+    steps:
+      - name: Checkout
+        uses: actions/checkout@v2
+      - name: Get Composer Cache Directory
+        id: composer-cache
+        run: |
+          echo "::set-output name=dir::$(composer config cache-files-dir)"
+      - uses: actions/cache@v1
+        with:
+          path: ${{ steps.composer-cache.outputs.dir }}
+          key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
+          restore-keys: |
+            ${{ runner.os }}-composer-
+      - name: Initial
+        run: |
+          cp .env.actions .env
+          composer install
+          php artisan key:generate
+          php artisan passport:keys
+          php artisan migrate
+          php artisan db:seed
+          php artisan storage:link --relative
+      - name: Test
+        run: |
+          composer test
+
+  php_8_1_mysql_8_0:
+    name: PHP8.1+MySQL8.0
+    runs-on: ubuntu-latest
+    services:
+      mysql:
+        image: baijunyao/mysql:8.0
+        env:
+          MYSQL_ROOT_PASSWORD: laravel_bjyblog
+          MYSQL_DATABASE: laravel_bjyblog
+    container:
+      image: baijunyao/php:8.1-local
+      volumes:
+        - /__w/laravel-bjyblog/laravel-bjyblog:/app
+    steps:
+      - name: Checkout
+        uses: actions/checkout@v2
+      - name: Get Composer Cache Directory
+        id: composer-cache
+        run: |
+          echo "::set-output name=dir::$(composer config cache-files-dir)"
+      - uses: actions/cache@v1
+        with:
+          path: ${{ steps.composer-cache.outputs.dir }}
+          key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
+          restore-keys: |
+            ${{ runner.os }}-composer-
+      - name: Initial
+        run: |
+          cp .env.actions .env
+          composer install
+          php artisan key:generate
+          php artisan passport:keys
+          php artisan migrate
+          php artisan db:seed
+          php artisan storage:link --relative
+      - name: Test
+        run: |
+          composer test:coverage-xml
+      - name: Upload coverage to Codecov
+        uses: codecov/codecov-action@v1
+        with:
+          files: storage/framework/testing/coverage.xml
+
   notify:
     name: Slack Notify
     runs-on: ubuntu-latest
-    needs: [dotenv_lint, markdown_lint, helm_lint, ansible_lint, phpcs, phpstan, php_8_0_mysql_5_6, php_8_0_mysql_5_7, php_8_0_mysql_8_0,]
+    needs: [dotenv_lint, markdown_lint, helm_lint, ansible_lint, phpcs, phpstan, php_8_0_mysql_5_6, php_8_0_mysql_5_7, php_8_0_mysql_8_0, php_8_1_mysql_5_6, php_8_1_mysql_5_7, php_8_1_mysql_8_0]
     if: always()
     steps:
       - name: Slack Notify

+ 47 - 3
_ide_helper.php

@@ -3,7 +3,7 @@
 
 /**
  * A helper file for Laravel, to provide autocomplete information to your IDE
- * Generated for Laravel 8.74.0.
+ * Generated for Laravel 8.75.0.
  *
  * This file should not be included in your code, only analyzed by your IDE!
  *
@@ -6400,6 +6400,36 @@
                         return $instance->has($ability);
         }
                     /**
+         * Perform an on-demand authorization check. Throw an authorization exception if the condition or callback is false.
+         *
+         * @param \Illuminate\Auth\Access\Response|\Closure|bool $condition
+         * @param string|null $message
+         * @param string|null $code
+         * @return \Illuminate\Auth\Access\Response 
+         * @throws \Illuminate\Auth\Access\AuthorizationException
+         * @static 
+         */ 
+        public static function allowIf($condition, $message = null, $code = null)
+        {
+                        /** @var \Illuminate\Auth\Access\Gate $instance */
+                        return $instance->allowIf($condition, $message, $code);
+        }
+                    /**
+         * Perform an on-demand authorization check. Throw an authorization exception if the condition or callback is true.
+         *
+         * @param \Illuminate\Auth\Access\Response|\Closure|bool $condition
+         * @param string|null $message
+         * @param string|null $code
+         * @return \Illuminate\Auth\Access\Response 
+         * @throws \Illuminate\Auth\Access\AuthorizationException
+         * @static 
+         */ 
+        public static function denyIf($condition, $message = null, $code = null)
+        {
+                        /** @var \Illuminate\Auth\Access\Gate $instance */
+                        return $instance->denyIf($condition, $message, $code);
+        }
+                    /**
          * Define a new ability.
          *
          * @param string $ability
@@ -8271,9 +8301,23 @@
                     /**
          * Assert the total amount of times a notification was sent.
          *
+         * @param string $notification
+         * @param int $expectedCount
+         * @return void 
+         * @static 
+         */ 
+        public static function assertSentTimes($notification, $expectedCount)
+        {
+                        /** @var \Illuminate\Support\Testing\Fakes\NotificationFake $instance */
+                        $instance->assertSentTimes($notification, $expectedCount);
+        }
+                    /**
+         * Assert the total amount of times a notification was sent.
+         *
          * @param int $expectedCount
          * @param string $notification
          * @return void 
+         * @deprecated Use the assertSentTimes method instead
          * @static 
          */ 
         public static function assertTimesSent($expectedCount, $notification)
@@ -15463,7 +15507,7 @@
                         return \Illuminate\View\Factory::parentPlaceholder($section);
         }
                     /**
-         * Check if the section exists.
+         * Check if section exists.
          *
          * @param string $name
          * @return bool 
@@ -19574,7 +19618,7 @@ namespace  {
                 /**
              * Add a "where date" statement to the query.
              *
-             * @param string $column
+             * @param \Illuminate\Database\Query\Expression|string $column
              * @param string $operator
              * @param \DateTimeInterface|string|null $value
              * @param string $boolean

+ 0 - 1
composer.json

@@ -25,7 +25,6 @@
         "doctrine/dbal": "^2.5",
         "fideloper/proxy": "^4.2",
         "fruitcake/laravel-cors": "^2.0",
-        "fukuball/jieba-php": "~0.25",
         "genealabs/laravel-model-caching": "^0.11",
         "graham-campbell/markdown": "^13.1",
         "guzzlehttp/guzzle": "^7.0.1",

File diff suppressed because it is too large
+ 247 - 230
composer.lock


+ 0 - 44
config/scout.php

@@ -87,48 +87,4 @@ return [
         'id' => env('ALGOLIA_APP_ID', ''),
         'secret' => env('ALGOLIA_SECRET', ''),
     ],
-
-    'tntsearch' => [
-        'storage' => storage_path('indexes'), //必须有可写权限
-        'fuzziness' => env('TNTSEARCH_FUZZINESS', false),
-        'searchBoolean' => env('TNTSEARCH_BOOLEAN', false),
-        'asYouType' => true,
-
-        'fuzzy' => [
-            'prefix_length' => 2,
-            'max_expansions' => 50,
-            'distance' => 2,
-        ],
-
-        'tokenizer' => [
-            'driver' => env('TNTSEARCH_TOKENIZER', 'default'),
-
-            'jieba' => [
-                'dict' => 'small',
-                //'user_dict' => resource_path('dicts/mydict.txt'), //自定义词典路径
-            ],
-
-            'analysis' => [
-                'result_type' => 2,
-                'unit_word' => true,
-                'differ_max' => true,
-            ],
-
-            'scws' => [
-                'charset' => 'utf-8',
-                'dict' => '/usr/local/scws/etc/dict.utf8.xdb',
-                'rule' => '/usr/local/scws/etc/rules.utf8.ini',
-                'multi' => 1,
-                'ignore' => true,
-                'duality' => false,
-            ],
-        ],
-
-        'stopwords' => [
-            '的',
-            '了',
-            '而是',
-        ],
-    ],
-
 ];

+ 1 - 1
deploy/helm/templates/deployment.yaml

@@ -66,7 +66,7 @@ spec:
     spec:
       containers:
         - name: php
-          image: {{ if eq .Values.container_registry "Aliyun" }}registry.cn-beijing.aliyuncs.com/{{ end }}baijunyao/php:8.0-{{ .Values.env }}
+          image: {{ if eq .Values.container_registry "Aliyun" }}registry.cn-beijing.aliyuncs.com/{{ end }}baijunyao/php:8.1-{{ .Values.env }}
           {{- if eq .Values.container_registry "Aliyun" }}
           lifecycle:
             postStart:

+ 1 - 1
docker-compose-nfs.yml

@@ -23,7 +23,7 @@ services:
       DOCUMENT_ROOT: /app/public
 
   php:
-    image: baijunyao/php:8.0-${APP_ENV}
+    image: baijunyao/php:8.1-${APP_ENV}
     container_name: laravel-bjyblog-php
     tty: true
     volumes:

+ 1 - 1
docker-compose.yml

@@ -42,7 +42,7 @@ services:
       DOCUMENT_ROOT: /app/public
 
   php:
-    image: baijunyao/php:8.0-${APP_ENV}
+    image: baijunyao/php:8.1-${APP_ENV}
     container_name: laravel-bjyblog-php
     tty: true
     volumes:

+ 0 - 2
storage/indexes/.gitignore

@@ -1,2 +0,0 @@
-*
-!.gitignore