. * */ OCP\User::checkAdminUser(); OCP\App::checkAppEnabled('admin_migrate'); // Export? if (isset($_POST['admin_export'])) { // Create the export zip $response = json_decode( OC_Migrate::export( null, $_POST['export_type'] ) ); if( !$response->success ){ // Error die('error'); } else { $path = $response->data; // Download it header("Content-Type: application/zip"); header("Content-Disposition: attachment; filename=" . basename($path)); header("Content-Length: " . filesize($path)); @ob_end_clean(); readfile( $path ); unlink( $path ); } // Import? } else if( isset($_POST['admin_import']) ){ $from = $_FILES['owncloud_import']['tmp_name']; if( !OC_Migrate::import( $from, 'instance' ) ){ die('failed'); } } else { // fill template $tmpl = new OCP\Template('admin_migrate', 'settings'); return $tmpl->fetchPage(); }