From 2a196978589d845edafe0b2da3b4164a42da40e3 Mon Sep 17 00:00:00 2001
From: 镜面 <153555712@qq.com>
Date: Tue, 3 Sep 2019 14:52:23 +0800
Subject: [PATCH] 修复更新插件没有权限addons文件夹

---
 application/admin/controller/Addon.php | 4 ++++
 1 file changed, 4 insertions(+), 0 deletions(-)

diff --git a/application/admin/controller/Addon.php b/application/admin/controller/Addon.php
index 374f9b7..7fe7946 100644
--- a/application/admin/controller/Addon.php
+++ b/application/admin/controller/Addon.php
@@ -268,12 +268,16 @@ class Addon extends Backend
     public function upgrade()
     {
         $name = $this->request->post("name");
+        $addonTmpDir = RUNTIME_PATH . 'addons' . DS;
         if (!$name) {
             $this->error(__('Parameter %s can not be empty', 'name'));
         }
         if (!preg_match("/^[a-zA-Z0-9]+$/", $name)) {
             $this->error(__('Addon name incorrect'));
         }
+        if (!is_dir($addonTmpDir)) {
+            @mkdir($addonTmpDir, 0755, true);
+        }
         try {
             $uid = $this->request->post("uid");
             $token = $this->request->post("token");
--
libgit2 0.24.0