|
|
@ -56,7 +56,7 @@ class OC_Installer{ |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public static function installApp( $data = array()){ |
|
|
|
public static function installApp( $data = array()){ |
|
|
|
if(!isset($data['source'])){ |
|
|
|
if(!isset($data['source'])){ |
|
|
|
if(defined("DEBUG") && DEBUG) {error_log("No source specified when installing app");} |
|
|
|
OC_Log::write('core','No source specified when installing app',OC_Log::ERROR); |
|
|
|
return false; |
|
|
|
return false; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -64,13 +64,13 @@ class OC_Installer{ |
|
|
|
if($data['source']=='http'){ |
|
|
|
if($data['source']=='http'){ |
|
|
|
$path=tempnam(sys_get_temp_dir(),'oc_installer_'); |
|
|
|
$path=tempnam(sys_get_temp_dir(),'oc_installer_'); |
|
|
|
if(!isset($data['href'])){ |
|
|
|
if(!isset($data['href'])){ |
|
|
|
if(defined("DEBUG") && DEBUG) {error_log("No href specified when installing app from http");} |
|
|
|
OC_Log::write('core','No href specified when installing app from http',OC_Log::ERROR); |
|
|
|
return false; |
|
|
|
return false; |
|
|
|
} |
|
|
|
} |
|
|
|
copy($data['href'],$path); |
|
|
|
copy($data['href'],$path); |
|
|
|
}else{ |
|
|
|
}else{ |
|
|
|
if(!isset($data['path'])){ |
|
|
|
if(!isset($data['path'])){ |
|
|
|
if(defined("DEBUG") && DEBUG) {error_log("No path specified when installing app from local file");} |
|
|
|
OC_Log::write('core','No path specified when installing app from local file',OC_Log::ERROR); |
|
|
|
return false; |
|
|
|
return false; |
|
|
|
} |
|
|
|
} |
|
|
|
$path=$data['path']; |
|
|
|
$path=$data['path']; |
|
|
@ -85,7 +85,7 @@ class OC_Installer{ |
|
|
|
$zip->extractTo($extractDir); |
|
|
|
$zip->extractTo($extractDir); |
|
|
|
$zip->close(); |
|
|
|
$zip->close(); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
if(defined("DEBUG") && DEBUG) {error_log("Failed to open archive when installing app");} |
|
|
|
OC_Log::write('core','Failed to open archive when installing app',OC_Log::ERROR); |
|
|
|
OC_Helper::rmdirr($extractDir); |
|
|
|
OC_Helper::rmdirr($extractDir); |
|
|
|
if($data['source']=='http'){ |
|
|
|
if($data['source']=='http'){ |
|
|
|
unlink($path); |
|
|
|
unlink($path); |
|
|
@ -95,7 +95,7 @@ class OC_Installer{ |
|
|
|
|
|
|
|
|
|
|
|
//load the info.xml file of the app |
|
|
|
//load the info.xml file of the app |
|
|
|
if(!is_file($extractDir.'/appinfo/info.xml')){ |
|
|
|
if(!is_file($extractDir.'/appinfo/info.xml')){ |
|
|
|
if(defined("DEBUG") && DEBUG) {error_log("App does not provide an info.xml file");} |
|
|
|
OC_Log::write('core','App does not provide an info.xml file',OC_Log::ERROR); |
|
|
|
OC_Helper::rmdirr($extractDir); |
|
|
|
OC_Helper::rmdirr($extractDir); |
|
|
|
if($data['source']=='http'){ |
|
|
|
if($data['source']=='http'){ |
|
|
|
unlink($path); |
|
|
|
unlink($path); |
|
|
@ -107,7 +107,7 @@ class OC_Installer{ |
|
|
|
|
|
|
|
|
|
|
|
//check if an app with the same id is already installed |
|
|
|
//check if an app with the same id is already installed |
|
|
|
if(self::isInstalled( $info['id'] )){ |
|
|
|
if(self::isInstalled( $info['id'] )){ |
|
|
|
if(defined("DEBUG") && DEBUG) {error_log("App already installed");} |
|
|
|
OC_Log::write('core','App already installed',OC_Log::WARN); |
|
|
|
OC_Helper::rmdirr($extractDir); |
|
|
|
OC_Helper::rmdirr($extractDir); |
|
|
|
if($data['source']=='http'){ |
|
|
|
if($data['source']=='http'){ |
|
|
|
unlink($path); |
|
|
|
unlink($path); |
|
|
@ -117,7 +117,7 @@ class OC_Installer{ |
|
|
|
|
|
|
|
|
|
|
|
//check if the destination directory already exists |
|
|
|
//check if the destination directory already exists |
|
|
|
if(is_dir($basedir)){ |
|
|
|
if(is_dir($basedir)){ |
|
|
|
if(defined("DEBUG") && DEBUG) {error_log("App's directory already exists");} |
|
|
|
OC_Log::write('core','App directory already exists',OC_Log::WARN); |
|
|
|
OC_Helper::rmdirr($extractDir); |
|
|
|
OC_Helper::rmdirr($extractDir); |
|
|
|
if($data['source']=='http'){ |
|
|
|
if($data['source']=='http'){ |
|
|
|
unlink($path); |
|
|
|
unlink($path); |
|
|
@ -131,7 +131,7 @@ class OC_Installer{ |
|
|
|
|
|
|
|
|
|
|
|
//copy the app to the correct place |
|
|
|
//copy the app to the correct place |
|
|
|
if(!mkdir($basedir)){ |
|
|
|
if(!mkdir($basedir)){ |
|
|
|
if(defined("DEBUG") && DEBUG) {error_log('Can\'t create app folder ('.$basedir.')');} |
|
|
|
OC_Log::write('core','Can\'t create app folder ('.$basedir.')',OC_Log::ERROR); |
|
|
|
OC_Helper::rmdirr($extractDir); |
|
|
|
OC_Helper::rmdirr($extractDir); |
|
|
|
if($data['source']=='http'){ |
|
|
|
if($data['source']=='http'){ |
|
|
|
unlink($path); |
|
|
|
unlink($path); |
|
|
|