jqh 3 лет назад
Родитель
Сommit
af1e5204ee
4 измененных файлов с 66 добавлено и 5 удалено
  1. 46 0
      .github/workflows/dusk.yml
  2. 1 1
      composer.json
  3. 1 1
      src/Admin.php
  4. 18 3
      src/Console/PublishCommand.php

+ 46 - 0
.github/workflows/dusk.yml

@@ -190,3 +190,49 @@ jobs:
 
       - name: Run test suite
         run: cd ./laravel-tests && php artisan dusk
+
+  laravel9:
+    runs-on: ubuntu-latest
+
+    steps:
+      - uses: shivammathur/setup-php@b7d1d9c9a92d8d8463ce36d7f60da34d461724f8
+        with:
+          php-version: '8.0'
+
+      - uses: actions/checkout@v2
+
+      - name: Composer Update
+        run: composer self-update --2
+
+      - name: Setup MySQL
+        # You may pin to the exact commit or the version.
+        # uses: mirromutth/mysql-action@de1fba8b3f90ce8db80f663a7043be3cf3231248
+        uses: mirromutth/mysql-action@v1.1
+        with:
+          # Version of MySQL to use
+          mysql version: 5.7
+          # MYSQL_ROOT_PASSWORD - root superuser password
+          mysql root password: 123456
+          # MYSQL_DATABASE - name for the default database that is created
+          mysql database: laravel
+          # MYSQL_USER - create the specified user with superuser power for created database
+          mysql user: root
+          # MYSQL_PASSWORD - specified superuser password which user is power for created database
+          mysql password: 123456
+
+      - name: Install Dependencies
+        run: |
+          composer create-project --prefer-dist laravel/laravel laravel-tests 9.*
+          sh ./tests/bin/install-dep.sh
+
+      - name: Install Admin
+        run: sh ./tests/bin/install-admin.sh
+
+      - name: Install Xvfb
+        run: sudo apt-get install xvfb
+
+      - name: Start Server
+        run: sh ./tests/bin/start.sh
+
+      - name: Run test suite
+        run: cd ./laravel-tests && php artisan dusk

+ 1 - 1
composer.json

@@ -13,7 +13,7 @@
     ],
     "require": {
         "php": ">=7.1.0",
-        "laravel/framework": "~5.5|~6.0|~7.0|~8.0",
+        "laravel/framework": "~5.5|~6.0|~7.0|~8.0|~9.0",
         "spatie/eloquent-sortable": "3.*|4.*",
         "doctrine/dbal": "^2.6|^3.0"
     },

+ 1 - 1
src/Admin.php

@@ -31,7 +31,7 @@ class Admin
     use HasAssets;
     use HasHtml;
 
-    const VERSION = '2.1.7-beta';
+    const VERSION = '2.2.0-beta';
 
     const SECTION = [
         // 往 <head> 标签内输入内容

+ 18 - 3
src/Console/PublishCommand.php

@@ -7,6 +7,7 @@ use Illuminate\Filesystem\Filesystem;
 use Illuminate\Support\ServiceProvider;
 use Illuminate\Support\Str;
 use League\Flysystem\Adapter\Local as LocalAdapter;
+use League\Flysystem\Local\LocalFilesystemAdapter;
 use League\Flysystem\Filesystem as Flysystem;
 use League\Flysystem\MountManager;
 
@@ -145,16 +146,30 @@ class PublishCommand extends Command
 
     protected function publishDirectory($from, $to)
     {
+        $localClass = class_exists(LocalAdapter::class) ? LocalAdapter::class : LocalFilesystemAdapter::class;
+
         $this->moveManagedFiles(new MountManager([
-            'from' => new Flysystem(new LocalAdapter($from)),
-            'to' => new Flysystem(new LocalAdapter($to)),
+            'from' => new Flysystem(new $localClass($from)),
+            'to' => new Flysystem(new $localClass($to)),
         ]));
 
         $this->status($from, $to, 'Directory');
     }
 
-    protected function moveManagedFiles($manager)
+    protected function moveManagedFiles(MountManager $manager)
     {
+        if (method_exists($manager, 'write')) {
+            foreach ($manager->listContents('from://', true) as $file) {
+                $path = Str::after($file['path'], 'from://');
+
+                if ($file['type'] === 'file' && (! $manager->fileExists('to://'.$path) || $this->option('force'))) {
+                    $manager->write('to://'.$path, $manager->read($file['path']));
+                }
+            }
+
+            return;
+        }
+
         foreach ($manager->listContents('from://', true) as $file) {
             if (
                 $file['type'] === 'file'