summaryrefslogtreecommitdiffstats
path: root/apps/user_migrate
diff options
context:
space:
mode:
authorTom Needham <needham.thomas@gmail.com>2012-04-06 20:52:41 +0000
committerTom Needham <needham.thomas@gmail.com>2012-04-06 20:52:41 +0000
commit2fe0716cb4ba74d338d6af04a8b02fbb8eb1f903 (patch)
treea2cb32e71f00c40effff4e7641fe710959170f73 /apps/user_migrate
parenteba6a65908ab848741a29467a2c054818e3c740c (diff)
downloadnextcloud-server-2fe0716cb4ba74d338d6af04a8b02fbb8eb1f903.tar.gz
nextcloud-server-2fe0716cb4ba74d338d6af04a8b02fbb8eb1f903.zip
Show nice errors
Diffstat (limited to 'apps/user_migrate')
-rw-r--r--apps/user_migrate/admin.php24
1 files changed, 20 insertions, 4 deletions
diff --git a/apps/user_migrate/admin.php b/apps/user_migrate/admin.php
index 61b83c2a140..280f7b71969 100644
--- a/apps/user_migrate/admin.php
+++ b/apps/user_migrate/admin.php
@@ -36,12 +36,18 @@ if (isset($_POST['user_import'])) {
$from = $_FILES['owncloud_import']['tmp_name'];
$to = get_temp_dir().'/'.$importname.'.zip';
if( !move_uploaded_file( $from, $to ) ){
+ $errors[] = array('error'=>'Failed to move the uploaded file','hint'=>'Try checking the permissions of the '.get_temp_dir().' dir.');
OC_Log::write( 'user_migrate', "Failed to copy the uploaded file", OC_Log::ERROR );
- exit();
+ $t = new OC_Template( '', 'error', 'user' );
+ $t->assign('errors',$errors);
+ $t->fetchPage();
}
if( !$appsstatus = OC_Migrate::import( $to, 'user' ) ){
- die( 'failed to to import' );
+ $errors[] = array('error'=>'There was an error while importing the user!','hint'=>'Please check the logs for a more detailed explaination');
+ $t = new OC_Template( '', 'error', 'user' );
+ $t->assign('errors',$errors);
+ $t->fetchPage();
} else {
// Check import status
foreach( $appsstatus as $app => $status ){
@@ -57,10 +63,20 @@ if (isset($_POST['user_import'])) {
// Any problems?
if( isset( $notsupported ) || isset( $failed ) ){
if( count( $failed ) > 0 ){
- die( 'Some apps failed to import. View the log please.' );
+ $errors[] = array('error'=>'Some app data failed to import','hint'=>'App data for: '.implode(', ', $failed).' failed to import.');
+ $t = new OC_Template( '', 'error', 'user' );
+ $t->assign('errors',$errors);
+ $t->fetchPage();
} else if( count( $notsupported ) > 0 ){
- die( 'Some apps were not found in this owncloud instance and therefore could not be installed' );
+ $errors[] = array('error'=>'Some app data could not be imported, as the apps are not installed on this instance','hint'=>'App data for: '.implode(', ', $notsupported).' failed to import as they were not found. Please install the apps and try again');
+ $t = new OC_Template( '', 'error', 'user' );
+ $t->assign('errors',$errors);
+ $t->fetchPage();
}
+ } else {
+ // Went swimmingly!
+ $tmpl = new OC_Template('user_migrate', 'admin');
+ return $tmpl->fetchPage();
}
}