diff options
author | Tom Needham <needham.thomas@gmail.com> | 2012-03-13 17:27:47 +0000 |
---|---|---|
committer | Tom Needham <needham.thomas@gmail.com> | 2012-03-13 17:27:47 +0000 |
commit | cd2f75fdad6629f850bb07f07cd45e04d75de97d (patch) | |
tree | e2403eff902510e24ab0c7539d96e7ca9038e849 /apps/user_migrate/settings.php | |
parent | 0f3eebbbd95b75e3dfe8f9322d8fd486925ac54a (diff) | |
download | nextcloud-server-cd2f75fdad6629f850bb07f07cd45e04d75de97d.tar.gz nextcloud-server-cd2f75fdad6629f850bb07f07cd45e04d75de97d.zip |
Use data dir from config.php
Diffstat (limited to 'apps/user_migrate/settings.php')
-rw-r--r-- | apps/user_migrate/settings.php | 22 |
1 files changed, 5 insertions, 17 deletions
diff --git a/apps/user_migrate/settings.php b/apps/user_migrate/settings.php index c017ba226cf..5e8ac9c21df 100644 --- a/apps/user_migrate/settings.php +++ b/apps/user_migrate/settings.php @@ -32,20 +32,9 @@ if (isset($_POST['user_export'])) { $zip = new ZipArchive(); $tmp = get_temp_dir(); $user = OC_User::getUser(); - // Create owncoud dir - if( !file_exists( $tmp . '/owncloud' ) ){ - if( !mkdir( $tmp . '/owncloud' ) ){ - die('Failed to create the owncloud tmp directory'); - } - } - // Create the export dir - $exportdir = $tmp . '/owncloud' . '/export_' . $user . '_' . date("y-m-d_H-i-s"); - if( !file_exists( $exportdir ) ){ - if( !mkdir( $exportdir ) ){ - die('Failed to create the owncloud export directory'); - } - } - $filename = $exportdir . '/owncloud_export_' . $user . '_' . date("y-m-d_H-i-s") . ".zip"; + + $userdatadir = OC_Config::getValue( 'datadirectory' ) . '/' . $user; + $filename = $userdatadir . '/owncloud_export_' . $user . '_' . date("y-m-d_H-i-s") . ".zip"; OC_Log::write('user_migrate',"Creating export file at: " . $filename,OC_Log::INFO); if ($zip->open($filename, ZIPARCHIVE::CREATE) !== TRUE) { exit("Cannot open <$filename>\n"); @@ -53,11 +42,11 @@ if (isset($_POST['user_export'])) { // Migrate the app info $info = json_encode( OC_Migrate::export( $user ) ); - $infofile = OC::$SERVERROOT . '/data/' . $user . '/exportinfo.json'; + $infofile = $userdatadir . '/exportinfo.json'; file_put_contents( $infofile, $info ); // Add the data dir (which includes migration.db and exportinfo.json) - zipAddDir(OC::$SERVERROOT . "/data/" . $user, $zip, true, "/"); + zipAddDir( $userdatadir, $zip, true, "/" ); // Save the zip $zip->close(); @@ -70,7 +59,6 @@ if (isset($_POST['user_export'])) { readfile($filename); // Cleanup unlink($filename); - rmdir($exportdir); OC_Migrate::cleanUp(); } if( isset( $_POST['user_import'] ) ){ |