added cleanUp() method to OC_Migrate

This commit is contained in:
Tom Needham 2012-03-13 17:18:42 +00:00
parent 7e3b35a57c
commit 0f3eebbbd9
2 changed files with 16 additions and 1 deletions

View File

@ -70,8 +70,8 @@ if (isset($_POST['user_export'])) {
readfile($filename); readfile($filename);
// Cleanup // Cleanup
unlink($filename); unlink($filename);
unlink($infofile);
rmdir($exportdir); rmdir($exportdir);
OC_Migrate::cleanUp();
} if( isset( $_POST['user_import'] ) ){ } if( isset( $_POST['user_import'] ) ){
// TODO // TODO

View File

@ -438,4 +438,19 @@ class OC_Migrate{
} }
/**
* @breif removes migration.db and exportinfo.json from the users data dir
* @return void
*/
static public function cleanUp(){
if( !self::$uid ){
OC_Log::write('migration', 'Failed to cleanup after migration', OC_Log::ERROR);
return false;
}
// Remove migration.db
unlink( OC::$SERVERROOT . '/data/' . self::$uid . '/migration.db' );
// Remove exportinfo.json
unlink( OC::$SERVERROOT . '/data/' . self::$uid . '/exportinfo.json' );
return true;
}
} }