Skip to content
Snippets Groups Projects
Commit 709b0a1d authored by Tom Needham's avatar Tom Needham
Browse files

Check if app is enabled before exporting its data

parent 4094f6f8
No related branches found
No related tags found
No related merge requests found
...@@ -406,36 +406,38 @@ class OC_Migrate{ ...@@ -406,36 +406,38 @@ class OC_Migrate{
// Foreach provider // Foreach provider
foreach( self::$providers as $provider ){ foreach( self::$providers as $provider ){
$success = true; // Check if the app is enabled
// Does this app use the database? if( OC_App::isEnabled( $provider->getID() ) ){
if( file_exists( OC::$SERVERROOT.'/apps/'.$provider->getID().'/appinfo/database.xml' ) ){ $success = true;
// Create some app tables // Does this app use the database?
$tables = self::createAppTables( $provider->getID() ); if( file_exists( OC::$SERVERROOT.'/apps/'.$provider->getID().'/appinfo/database.xml' ) ){
if( is_array( $tables ) ){ // Create some app tables
// Save the table names $tables = self::createAppTables( $provider->getID() );
foreach($tables as $table){ if( is_array( $tables ) ){
$return['apps'][$provider->getID()]['tables'][] = $table; // Save the table names
foreach($tables as $table){
$return['apps'][$provider->getID()]['tables'][] = $table;
}
} else {
// It failed to create the tables
$success = false;
} }
}
// Run the export function?
if( $success ){
// Set the provider properties
$provider->setData( self::$uid, self::$content );
$return['apps'][$provider->getID()]['success'] = $provider->export();
} else { } else {
// It failed to create the tables $return['apps'][$provider->getID()]['success'] = false;
$success = false; $return['apps'][$provider->getID()]['message'] = 'failed to create the app tables';
} }
// Now add some app info the the return array
$appinfo = OC_App::getAppInfo( $provider->getID() );
$return['apps'][$provider->getID()]['version'] = OC_App::getAppVersion($provider->getID());
} }
// Run the export function?
if( $success ){
// Set the provider properties
$provider->setData( self::$uid, self::$content );
$return['apps'][$provider->getID()]['success'] = $provider->export();
} else {
$return['apps'][$provider->getID()]['success'] = false;
$return['apps'][$provider->getID()]['message'] = 'failed to create the app tables';
}
// Now add some app info the the return array
$appinfo = OC_App::getAppInfo( $provider->getID() );
$return['apps'][$provider->getID()]['version'] = OC_App::getAppVersion($provider->getID());
} }
return $return; return $return;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment