]> source.dussan.org Git - nextcloud-server.git/commitdiff
install apps that are shipped with owncloud the first time they are loaded
authorRobin Appelman <icewind1991@gmail.com>
Wed, 1 Jun 2011 13:05:48 +0000 (15:05 +0200)
committerRobin Appelman <icewind1991@gmail.com>
Wed, 1 Jun 2011 13:05:48 +0000 (15:05 +0200)
lib/app.php

index cec7468c8e73eb582bbe108f7cd50ef5d2de9541..a56e0c2f9e66c8dde64282e87b66feea5b517e13 100644 (file)
@@ -61,6 +61,19 @@ class OC_APP{
                while( false !== ( $filename = readdir( $dir ))){
                        if( substr( $filename, 0, 1 ) != '.' ){
                                if( file_exists( "$SERVERROOT/apps/$filename/appinfo/app.php" )){
+                                       if(OC_APPCONFIG::getValue($filename,'installed_version',0)==0){ //check if the plugin is fully installed
+                                               //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=self::getAppInfo("$SERVERROOT/apps/$filename/appinfo/info.xml");
+                                               OC_APPCONFIG::setValue($filename,'installed_version',$info['version']);
+                                       }
                                        require( "apps/$filename/appinfo/app.php" );
                                }
                        }