fix installing shipped apps
This commit is contained in:
parent
c9a11d0aab
commit
af3080402b
|
@ -95,6 +95,9 @@ class OC_App{
|
|||
* This function set an app as enabled in appconfig.
|
||||
*/
|
||||
public static function enable( $app ){
|
||||
if(!OC_Installer::isInstalled($app)){
|
||||
OC_Installer::installShippedApp($app);
|
||||
}
|
||||
OC_Appconfig::setValue( $app, 'enabled', 'yes' );
|
||||
}
|
||||
|
||||
|
@ -202,7 +205,6 @@ class OC_App{
|
|||
$admin=array(
|
||||
array( "id" => "core_users", "order" => 2, "href" => OC_Helper::linkTo( "settings", "users.php" ), "name" => $l->t("Users"), "icon" => OC_Helper::imagePath( "settings", "users.svg" )),
|
||||
array( "id" => "core_apps", "order" => 3, "href" => OC_Helper::linkTo( "settings", "apps.php?installed" ), "name" => $l->t("Apps"), "icon" => OC_Helper::imagePath( "settings", "apps.svg" )),
|
||||
// array( "id" => "files_administration", "order" => 3, "href" => OC_Helper::linkTo( "files", "admin.php" ), "name" => $l->t("Files"), "icon" => OC_Helper::imagePath( "settings", "options.svg" )),
|
||||
);
|
||||
$settings=array(
|
||||
array( "id" => "help", "order" => 1000, "href" => OC_Helper::linkTo( "settings", "help.php" ), "name" => $l->t("Help"), "icon" => OC_Helper::imagePath( "settings", "help.svg" )),
|
||||
|
|
|
@ -252,17 +252,7 @@ class OC_Installer{
|
|||
if( substr( $filename, 0, 1 ) != '.' and is_dir("$SERVERROOT/apps/$filename") ){
|
||||
if( file_exists( "$SERVERROOT/apps/$filename/appinfo/app.php" )){
|
||||
if(!OC_Installer::isInstalled($filename)){
|
||||
//install the database
|
||||
if(is_file("$SERVERROOT/apps/$filename/appinfo/database.xml")){
|
||||
OC_DB::createDbFromStructure("$SERVERROOT/apps/$filename/appinfo/database.xml");
|
||||
}
|
||||
|
||||
//run appinfo/install.php
|
||||
if(is_file("$SERVERROOT/apps/$filename/appinfo/install.php")){
|
||||
include("$SERVERROOT/apps/$filename/appinfo/install.php");
|
||||
}
|
||||
$info=OC_App::getAppInfo("$SERVERROOT/apps/$filename/appinfo/info.xml");
|
||||
OC_Appconfig::setValue($filename,'installed_version',$info['version']);
|
||||
OC_Installer::installShippedApp($filename);
|
||||
if( $enabled ){
|
||||
OC_Appconfig::setValue($filename,'enabled','yes');
|
||||
}else{
|
||||
|
@ -274,4 +264,23 @@ class OC_Installer{
|
|||
}
|
||||
closedir( $dir );
|
||||
}
|
||||
|
||||
/**
|
||||
* install an app already placed in the app folder
|
||||
* @param string $app id of the app to install
|
||||
* @return bool
|
||||
*/
|
||||
public static function installShippedApp($app){
|
||||
//install the database
|
||||
if(is_file(OC::$SERVERROOT."/apps/$app/appinfo/database.xml")){
|
||||
OC_DB::createDbFromStructure(OC::$SERVERROOT."/apps/$app/appinfo/database.xml");
|
||||
}
|
||||
|
||||
//run appinfo/install.php
|
||||
if(is_file(OC::$SERVERROOT."/apps/$app/appinfo/install.php")){
|
||||
include(OC::$SERVERROOT."/apps/$app/appinfo/install.php");
|
||||
}
|
||||
$info=OC_App::getAppInfo(OC::$SERVERROOT."/apps/$app/appinfo/info.xml");
|
||||
OC_Appconfig::setValue($app,'installed_version',$info['version']);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue