diff options
author | Tom Needham <needham.thomas@gmail.com> | 2012-03-13 17:18:42 +0000 |
---|---|---|
committer | Tom Needham <needham.thomas@gmail.com> | 2012-03-13 17:18:42 +0000 |
commit | 0f3eebbbd95b75e3dfe8f9322d8fd486925ac54a (patch) | |
tree | 06fe5c0abef1a3df893ec8e97547b32be2dab1c9 | |
parent | 7e3b35a57c53b6e90cb8560d7b4c90e3aba2a3b5 (diff) | |
download | nextcloud-server-0f3eebbbd95b75e3dfe8f9322d8fd486925ac54a.tar.gz nextcloud-server-0f3eebbbd95b75e3dfe8f9322d8fd486925ac54a.zip |
added cleanUp() method to OC_Migrate
-rw-r--r-- | apps/user_migrate/settings.php | 2 | ||||
-rw-r--r-- | lib/migrate.php | 15 |
2 files changed, 16 insertions, 1 deletions
diff --git a/apps/user_migrate/settings.php b/apps/user_migrate/settings.php index 00f46660cf5..c017ba226cf 100644 --- a/apps/user_migrate/settings.php +++ b/apps/user_migrate/settings.php @@ -70,8 +70,8 @@ if (isset($_POST['user_export'])) { readfile($filename); // Cleanup unlink($filename); - unlink($infofile); rmdir($exportdir); + OC_Migrate::cleanUp(); } if( isset( $_POST['user_import'] ) ){ // TODO diff --git a/lib/migrate.php b/lib/migrate.php index 88c0e7cfc28..1be229d8fdd 100644 --- a/lib/migrate.php +++ b/lib/migrate.php @@ -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; + } } |