@@ -32,15 +32,12 @@ public static function download($name, $extend = [])
3232 $ addonsTempDir = self ::getAddonsBackupDir ();
3333 $ tmpFile = $ addonsTempDir . $ name . ".zip " ;
3434 try {
35- \think \Log::record (\think \Debug::getUseTime ());
3635 $ client = self ::getClient ();
3736 $ response = $ client ->get ('/addon/download ' , ['query ' => array_merge (['name ' => $ name ], $ extend )]);
38- \think \Log::record (\think \Debug::getUseTime ());
3937 $ body = $ response ->getBody ();
4038 $ content = $ body ->getContents ();
4139 if (substr ($ content , 0 , 1 ) === '{ ' ) {
4240 $ json = (array )json_decode ($ content , true );
43- \think \Log::record (\think \Debug::getUseTime ());
4441
4542 //如果传回的是一个下载链接,则再次下载
4643 if ($ json ['data ' ] && isset ($ json ['data ' ]['url ' ])) {
@@ -59,7 +56,6 @@ public static function download($name, $extend = [])
5956 if ($ write = fopen ($ tmpFile , 'w ' )) {
6057 fwrite ($ write , $ content );
6158 fclose ($ write );
62- \think \Log::record (\think \Debug::getUseTime ());
6359 return $ tmpFile ;
6460 }
6561 throw new Exception ("No permission to write temporary files " );
@@ -672,7 +668,9 @@ public static function disable($name, $force = false)
672668 if (!is_dir ($ itemBaseDir )) {
673669 @mkdir ($ itemBaseDir , 0755 , true );
674670 }
675- copy (ROOT_PATH . $ item , $ addonDir . $ item );
671+ if (is_file (ROOT_PATH . $ item )) {
672+ @copy (ROOT_PATH . $ item , $ addonDir . $ item );
673+ }
676674 }
677675 $ list = $ config ['files ' ];
678676 }
0 commit comments