| @@ 96-102 (lines=7) @@ | ||
| 93 | $appId = OC_App::cleanAppId($info['id']); |
|
| 94 | $basedir = OC_App::getInstallPath().'/'.$appId; |
|
| 95 | //check if the destination directory already exists |
|
| 96 | if(is_dir($basedir)) { |
|
| 97 | OC_Helper::rmdirr($extractDir); |
|
| 98 | if($data['source']=='http') { |
|
| 99 | unlink($path); |
|
| 100 | } |
|
| 101 | throw new \Exception($l->t("App directory already exists")); |
|
| 102 | } |
|
| 103 | ||
| 104 | if(!empty($data['pretent'])) { |
|
| 105 | return false; |
|
| @@ 118-121 (lines=4) @@ | ||
| 115 | } |
|
| 116 | ||
| 117 | $extractDir .= '/' . $info['id']; |
|
| 118 | if(!file_exists($extractDir)) { |
|
| 119 | OC_Helper::rmdirr($basedir); |
|
| 120 | throw new \Exception($l->t("Archive does not contain a directory named %s", $info['id'])); |
|
| 121 | } |
|
| 122 | OC_Helper::copyr($extractDir, $basedir); |
|
| 123 | ||
| 124 | //remove temporary files |
|
| @@ 282-288 (lines=7) @@ | ||
| 279 | mkdir($extractDir); |
|
| 280 | if($archive=\OC\Archive\Archive::open($path)) { |
|
| 281 | $archive->extract($extractDir); |
|
| 282 | } else { |
|
| 283 | OC_Helper::rmdirr($extractDir); |
|
| 284 | if($data['source']=='http') { |
|
| 285 | unlink($path); |
|
| 286 | } |
|
| 287 | throw new \Exception($l->t("Failed to open archive when installing app")); |
|
| 288 | } |
|
| 289 | ||
| 290 | return [ |
|
| 291 | $extractDir, |
|
| @@ 321-327 (lines=7) @@ | ||
| 318 | } |
|
| 319 | } |
|
| 320 | } |
|
| 321 | if(!is_file($extractDir.'/appinfo/info.xml')) { |
|
| 322 | OC_Helper::rmdirr($extractDir); |
|
| 323 | if($data['source'] === 'http') { |
|
| 324 | unlink($path); |
|
| 325 | } |
|
| 326 | throw new \Exception($l->t("App does not provide an info.xml file")); |
|
| 327 | } |
|
| 328 | ||
| 329 | $info = OC_App::getAppInfo($extractDir.'/appinfo/info.xml', true); |
|
| 330 | if(!is_array($info)) { |
|