Merge branch 'master' of git://anongit.kde.org/owncloud
This commit is contained in:
commit
86406c6cfe
3 changed files with 77 additions and 10 deletions
41
lib/app.php
41
lib/app.php
|
@ -59,7 +59,9 @@ class OC_APP{
|
|||
// The rest comes here
|
||||
$apps = OC_APPCONFIG::getApps();
|
||||
foreach( $apps as $app ){
|
||||
require( "apps/$app/appinfo/app.php" );
|
||||
if( self::isEnabled( $app )){
|
||||
require( "apps/$app/appinfo/app.php" );
|
||||
}
|
||||
}
|
||||
|
||||
self::$init = true;
|
||||
|
@ -68,6 +70,43 @@ class OC_APP{
|
|||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief checks whether or not an app is enabled
|
||||
* @param $app app
|
||||
* @returns true/false
|
||||
*
|
||||
* This function checks whether or not an app is enabled.
|
||||
*/
|
||||
public static function isEnabled( $app ){
|
||||
if( 'yes' == OC_APPCONFIG::getValue( $app, 'enabled' )){
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief enables an app
|
||||
* @param $app app
|
||||
* @returns true/false
|
||||
*
|
||||
* This function set an app as enabled in appconfig.
|
||||
*/
|
||||
public static function enable( $app ){
|
||||
OC_APPCONFIG::setValue( $app, 'enabled', 'yes' );
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief enables an app
|
||||
* @param $app app
|
||||
* @returns true/false
|
||||
*
|
||||
* This function set an app as enabled in appconfig.
|
||||
*/
|
||||
public static function disable( $app ){
|
||||
OC_APPCONFIG::setValue( $app, 'enabled', 'no' );
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief makes owncloud aware of this app
|
||||
* @param $data array with all information
|
||||
|
|
|
@ -59,7 +59,7 @@ class OC_INSTALLER{
|
|||
|
||||
if(!isset($data['source'])){
|
||||
error_log("No source specified when installing app");
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
|
||||
//download the file if necesary
|
||||
|
@ -67,13 +67,13 @@ class OC_INSTALLER{
|
|||
$path=tempnam(sys_get_temp_dir(),'oc_installer_');
|
||||
if(!isset($data['href'])){
|
||||
error_log("No href specified when installing app from http");
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
copy($data['href'],$path);
|
||||
}else{
|
||||
if(!isset($data['path'])){
|
||||
error_log("No path specified when installing app from local file");
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
$path=$data['path'];
|
||||
}
|
||||
|
@ -92,7 +92,7 @@ class OC_INSTALLER{
|
|||
if($data['source']=='http'){
|
||||
unlink($path);
|
||||
}
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
|
||||
//load the info.xml file of the app
|
||||
|
@ -102,23 +102,33 @@ class OC_INSTALLER{
|
|||
if($data['source']=='http'){
|
||||
unlink($path);
|
||||
}
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
$info=OC_APP::getAppInfo($extractDir.'/appinfo/info.xml');
|
||||
$basedir=$SERVERROOT.'/apps/'.$info['id'];
|
||||
|
||||
//check if an app with the same id is already installed
|
||||
if(is_dir($basedir)){
|
||||
if(self::isInstalled( $info['id'] ))){
|
||||
error_log("App already installed");
|
||||
OC_HELPER::rmdirr($extractDir);
|
||||
if($data['source']=='http'){
|
||||
unlink($path);
|
||||
}
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
|
||||
//check if the destination directory already exists
|
||||
+ if(is_dir($basedir)){
|
||||
+ error_log("App's directory already exists");
|
||||
+ OC_HELPER::rmdirr($extractDir);
|
||||
+ if($data['source']=='http'){
|
||||
+ unlink($path);
|
||||
+ }
|
||||
+ return false;
|
||||
+ }
|
||||
|
||||
if(isset($data['pretent']) and $data['pretent']==true){
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
|
||||
//copy the app to the correct place
|
||||
|
@ -128,7 +138,7 @@ class OC_INSTALLER{
|
|||
if($data['source']=='http'){
|
||||
unlink($path);
|
||||
}
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
OC_HELPER::copyr($extractDir,$basedir);
|
||||
|
||||
|
@ -150,6 +160,23 @@ class OC_INSTALLER{
|
|||
|
||||
//set the installed version
|
||||
OC_APPCONFIG::setValue($info['id'],'installed_version',$info['version']);
|
||||
OC_APPCONFIG::setValue($info['id'],'enabled','no');
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief checks whether or not an app is installed
|
||||
* @param $app app
|
||||
* @returns true/false
|
||||
*
|
||||
* Checks whether or not an app is installed, i.e. registered in apps table.
|
||||
*/
|
||||
public static function isInstalled( $app ){
|
||||
|
||||
if( null == OC_APPCONFIG::getValue( $app, "installed_version" )){
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -147,6 +147,7 @@ class OC_SETUP {
|
|||
|
||||
$info=OC_APP::getAppInfo("$SERVERROOT/apps/$app/appinfo/info.xml");
|
||||
OC_APPCONFIG::setValue($app,'installed_version',$info['version']);
|
||||
OC_APPCONFIG::setValue($app,'enabled','yes');
|
||||
}
|
||||
|
||||
//create htaccess files for apache hosts
|
||||
|
|
Loading…
Reference in a new issue