]> source.dussan.org Git - nextcloud-server.git/commitdiff
install shipped apps also in "installed apps" page
authorKamil Domanski <kdomanski@kdemail.net>
Tue, 21 Jun 2011 20:16:41 +0000 (22:16 +0200)
committerKamil Domanski <kdomanski@kdemail.net>
Tue, 21 Jun 2011 20:17:53 +0000 (22:17 +0200)
admin/apps.php
lib/installer.php
lib/setup.php

index 5eec7e626d32ba79ee4f24b44ed2a2fa91187d43..56e76d139d2b98ba7360dfb599aee4a939fe453b 100644 (file)
@@ -22,6 +22,7 @@
 */
 
 require_once('../lib/base.php');
+include_once('../lib/installer.php');
 require( 'template.php' );
 if( !OC_USER::isLoggedIn() || !OC_GROUP::inGroup( $_SESSION['user_id'], 'admin' )){
        header( "Location: ".OC_HELPER::linkTo( "", "index.php" ));
@@ -42,6 +43,8 @@ if($installed){
        $apps = OC_APPCONFIG::getApps();
        $records = array();
 
+       OC_INSTALLER::installShippedApps(false);
+
        OC_APP::setActiveNavigationEntry( "core_apps_installed" );
        foreach($apps as $app){
                $info=OC_APP::getAppInfo("$SERVERROOT/apps/$app/appinfo/info.xml");
index 91b7ea7da6786fbf11bd3c02cd2b5e0867a2829a..a237caa0983f203df4393f4b76d22ee91f682c77 100644 (file)
@@ -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 );
+       }
 }
index bdb5dcc4e24db4ae60112308aa15771eacac0190..281f24db5077ba6bded86b01408f191e63fcdce3 100644 (file)
@@ -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 );
-       }
 }
 
 ?>