aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorKamil Domanski <kdomanski@kdemail.net>2011-06-21 22:16:41 +0200
committerKamil Domanski <kdomanski@kdemail.net>2011-06-21 22:17:53 +0200
commite047feb2ad90c3b103c92d35f794988767b2ba21 (patch)
tree78cbff89498262f9df8a85b25c9594120fc1cc7d /lib
parentee0f1490e1872cbe6071f5758e292ae1646ab1af (diff)
downloadnextcloud-server-e047feb2ad90c3b103c92d35f794988767b2ba21.tar.gz
nextcloud-server-e047feb2ad90c3b103c92d35f794988767b2ba21.zip
install shipped apps also in "installed apps" page
Diffstat (limited to 'lib')
-rw-r--r--lib/installer.php38
-rw-r--r--lib/setup.php28
2 files changed, 39 insertions, 27 deletions
diff --git a/lib/installer.php b/lib/installer.php
index 91b7ea7da67..a237caa0983 100644
--- a/lib/installer.php
+++ b/lib/installer.php
@@ -236,4 +236,42 @@ class OC_INSTALLER{
// TODO: write function
return true;
}
+
+ /**
+ * @brief Installs shipped apps
+ * @param $enabled
+ *
+ * This function installs all apps found in the 'apps' directory;
+ * If $enabled is true, apps are installed as enabled.
+ * If $enabled is false, apps are installed as disabled.
+ */
+ public static function installShippedApps( $enabled ){
+ global $SERVERROOT;
+ $dir = opendir( "$SERVERROOT/apps" );
+ while( false !== ( $filename = readdir( $dir ))){
+ 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']);
+ if( $enabled ){
+ OC_APPCONFIG::setValue($filename,'enabled','yes');
+ }else{
+ OC_APPCONFIG::setValue($filename,'enabled','no');
+ }
+ }
+ }
+ }
+ }
+ closedir( $dir );
+ }
}
diff --git a/lib/setup.php b/lib/setup.php
index bdb5dcc4e24..281f24db507 100644
--- a/lib/setup.php
+++ b/lib/setup.php
@@ -136,7 +136,7 @@ class OC_SETUP {
OC_GROUP::addToGroup($username, 'admin');
//guess what this does
- self::installShippedApps();
+ OC_INSTALLER::installShippedApps(true);
//create htaccess files for apache hosts
self::createHtaccess(); //TODO detect if apache is used
@@ -186,32 +186,6 @@ class OC_SETUP {
$content = "deny from all";
file_put_contents(OC_CONFIG::getValue('datadirectory', $SERVERROOT.'/data').'/.htaccess', $content);
}
-
- private static function installShippedApps(){
- global $SERVERROOT;
- $dir = opendir( "$SERVERROOT/apps" );
- while( false !== ( $filename = readdir( $dir ))){
- 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_APPCONFIG::setValue($filename,'enabled','yes');
- }
- }
- }
- }
- closedir( $dir );
- }
}
?>