]> source.dussan.org Git - nextcloud-server.git/commitdiff
added cleanUp() method to OC_Migrate
authorTom Needham <needham.thomas@gmail.com>
Tue, 13 Mar 2012 17:18:42 +0000 (17:18 +0000)
committerTom Needham <needham.thomas@gmail.com>
Tue, 13 Mar 2012 17:18:42 +0000 (17:18 +0000)
apps/user_migrate/settings.php
lib/migrate.php

index 00f46660cf50a4810d7e59cd3e669fec5567a427..c017ba226cf8ae47ab2f923ea2ed13bb4d04efd7 100644 (file)
@@ -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
index 88c0e7cfc287d8772e56715e7947d3a802a33766..1be229d8fdd8bd6e88d8c4ca806c27108f7a494d 100644 (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;    
+       }
 }