Ver código fonte

ComposerUpdate 修复升级的问题

Anyon 4 anos atrás
pai
commit
389c9ba723

+ 4 - 4
composer.lock

@@ -937,12 +937,12 @@
             "source": {
                 "type": "git",
                 "url": "https://github.com/zoujingli/ThinkLibrary.git",
-                "reference": "5caa2ceb15d1a311ee1cfc7cc7a4ec12a7ee540c"
+                "reference": "656726c8c8e1175ec8d0f284e9fd00eb40d77d7f"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/zoujingli/ThinkLibrary/zipball/5caa2ceb15d1a311ee1cfc7cc7a4ec12a7ee540c",
-                "reference": "5caa2ceb15d1a311ee1cfc7cc7a4ec12a7ee540c",
+                "url": "https://api.github.com/repos/zoujingli/ThinkLibrary/zipball/656726c8c8e1175ec8d0f284e9fd00eb40d77d7f",
+                "reference": "656726c8c8e1175ec8d0f284e9fd00eb40d77d7f",
                 "shasum": "",
                 "mirrors": [
                     {
@@ -987,7 +987,7 @@
             ],
             "description": "ThinkPHP v6.0 Development Library",
             "homepage": "http://thinkadmin.top",
-            "time": "2020-08-24T05:23:03+00:00"
+            "time": "2020-08-24T05:44:28+00:00"
         },
         {
             "name": "zoujingli/wechat-developer",

+ 4 - 4
vendor/composer/installed.json

@@ -963,12 +963,12 @@
         "source": {
             "type": "git",
             "url": "https://github.com/zoujingli/ThinkLibrary.git",
-            "reference": "5caa2ceb15d1a311ee1cfc7cc7a4ec12a7ee540c"
+            "reference": "656726c8c8e1175ec8d0f284e9fd00eb40d77d7f"
         },
         "dist": {
             "type": "zip",
-            "url": "https://api.github.com/repos/zoujingli/ThinkLibrary/zipball/5caa2ceb15d1a311ee1cfc7cc7a4ec12a7ee540c",
-            "reference": "5caa2ceb15d1a311ee1cfc7cc7a4ec12a7ee540c",
+            "url": "https://api.github.com/repos/zoujingli/ThinkLibrary/zipball/656726c8c8e1175ec8d0f284e9fd00eb40d77d7f",
+            "reference": "656726c8c8e1175ec8d0f284e9fd00eb40d77d7f",
             "shasum": "",
             "mirrors": [
                 {
@@ -985,7 +985,7 @@
             "ext-mbstring": "*",
             "topthink/framework": "^6.0"
         },
-        "time": "2020-08-24T05:23:03+00:00",
+        "time": "2020-08-24T05:44:28+00:00",
         "type": "library",
         "extra": {
             "think": {

+ 1 - 1
vendor/services.php

@@ -1,5 +1,5 @@
 <?php 
-// This file is automatically generated at:2020-08-24 13:26:32
+// This file is automatically generated at:2020-08-24 13:48:29
 declare (strict_types = 1);
 return array (
   0 => 'think\\admin\\Library',

+ 29 - 21
vendor/zoujingli/think-library/src/service/ModuleService.php

@@ -99,7 +99,7 @@ class ModuleService extends Service
     {
         $data = $this->app->cache->get('moduleOnlineData', []);
         if (!empty($data)) return $data;
-        $result = json_decode(HttpExtend::get("{$this->server}/admin/api.update/version"), true);
+        $result = json_decode(HttpExtend::get($this->server . '/admin/api.update/version'), true);
         if (isset($result['code']) && $result['code'] > 0 && isset($result['data']) && is_array($result['data'])) {
             $this->app->cache->set('moduleOnlineData', $result['data'], 30);
             return $result['data'];
@@ -115,26 +115,24 @@ class ModuleService extends Service
      */
     public function install($name): array
     {
+        $install = InstallService::instance();
         $this->app->cache->set('moduleOnlineData', []);
-        $data = InstallService::instance()->grenerateDifference(['app' . '/' . $name]);
-        if (empty($data)) {
-            return [0, '没有需要安装的文件', []];
-        } else {
-            $lines = [];
-            foreach ($data as $file) {
-                [$state, $mode, $name] = InstallService::instance()->updateFileByDownload($file);
-                if ($state) {
-                    if ($mode === 'add') $lines[] = "add {$name} successed";
-                    if ($mode === 'mod') $lines[] = "modify {$name} successed";
-                    if ($mode === 'del') $lines[] = "deleted {$name} successed";
-                } else {
-                    if ($mode === 'add') $lines[] = "add {$name} failed";
-                    if ($mode === 'mod') $lines[] = "modify {$name} failed";
-                    if ($mode === 'del') $lines[] = "deleted {$name} failed";
-                }
+        $data = $install->grenerateDifference(['app' . '/' . $name]);
+        if (empty($data)) return [0, '没有需要安装的文件', []];
+        $lines = [];
+        foreach ($data as $file) {
+            [$state, $mode, $name] = $install->updateFileByDownload($file);
+            if ($state) {
+                if ($mode === 'add') $lines[] = "add {$name} successed";
+                if ($mode === 'mod') $lines[] = "modify {$name} successed";
+                if ($mode === 'del') $lines[] = "deleted {$name} successed";
+            } else {
+                if ($mode === 'add') $lines[] = "add {$name} failed";
+                if ($mode === 'mod') $lines[] = "modify {$name} failed";
+                if ($mode === 'del') $lines[] = "deleted {$name} failed";
             }
-            return [1, '模块安装成功', $lines];
         }
+        return [1, '模块安装成功', $lines];
     }
 
     /**
@@ -149,7 +147,7 @@ class ModuleService extends Service
             $vars = $this->_getModuleVersion($name);
             if (is_array($vars) && isset($vars['version']) && preg_match('|^\d{4}\.\d{2}\.\d{2}\.\d{2}$|', $vars['version'])) {
                 $data[$name] = array_merge($vars, ['change' => []]);
-                foreach ($service->scanDirectory($this->app->getBasePath() . $name . '/module/change/', [], 'md') as $file) {
+                foreach ($service->scanDirectory($this->_getModulePath($name) . '/module/change/', [], 'md') as $file) {
                     $data[$name]['change'][pathinfo($file, PATHINFO_FILENAME)] = Parsedown::instance()->parse(file_get_contents($file));
                 }
             }
@@ -197,8 +195,7 @@ class ModuleService extends Service
      */
     private function _getModuleVersion($name)
     {
-        $appdir = $this->app->getBasePath() . $name;
-        $filename = $appdir . DIRECTORY_SEPARATOR . 'module' . DIRECTORY_SEPARATOR . 'module.json';
+        $filename = $this->_getModulePath($name) . 'module.json';
         if (file_exists($filename) && is_file($filename) && is_readable($filename)) {
             $vars = json_decode(file_get_contents($filename), true);
             return isset($vars['name']) && isset($vars['version']) ? $vars : null;
@@ -206,4 +203,15 @@ class ModuleService extends Service
             return false;
         }
     }
+
+    /**
+     * 获取模块信息路径
+     * @param string $name
+     * @return string
+     */
+    private function _getModulePath($name)
+    {
+        $appdir = $this->app->getBasePath() . $name;
+        return $appdir . DIRECTORY_SEPARATOR . 'module' . DIRECTORY_SEPARATOR;
+    }
 }

+ 1 - 1
vendor/zoujingli/think-library/src/service/NodeService.php

@@ -148,7 +148,7 @@ class NodeService extends Service
             if (is_readable($realpath)) if (is_dir($realpath)) {
                 $data = $this->scanDirectory($realpath, $data, $ext);
             } elseif (is_file($realpath) && (is_null($ext) || pathinfo($realpath, 4) === $ext)) {
-                $data[] = $realpath;
+                $data[] = strtr($realpath, '\\', '/');
             }
         }
         return $data;