diff options
author | Tom Needham <needham.thomas@gmail.com> | 2012-04-07 17:23:25 +0000 |
---|---|---|
committer | Tom Needham <needham.thomas@gmail.com> | 2012-04-07 17:23:25 +0000 |
commit | 00449cdf3781e9cbd1e7ab6e42cbeebf1fdb2f35 (patch) | |
tree | 068943d60df8b7d3d8d5080891af46cc7ac890d0 /apps/admin_migrate | |
parent | 23d39f7ef0362d27c6a840585f878bc54c438409 (diff) | |
download | nextcloud-server-00449cdf3781e9cbd1e7ab6e42cbeebf1fdb2f35.tar.gz nextcloud-server-00449cdf3781e9cbd1e7ab6e42cbeebf1fdb2f35.zip |
rename admin_export -> admin_migrate
Diffstat (limited to 'apps/admin_migrate')
-rw-r--r-- | apps/admin_migrate/appinfo/app.php | 33 | ||||
-rw-r--r-- | apps/admin_migrate/appinfo/info.xml | 11 | ||||
-rw-r--r-- | apps/admin_migrate/settings.php | 55 | ||||
-rw-r--r-- | apps/admin_migrate/templates/settings.php | 24 |
4 files changed, 123 insertions, 0 deletions
diff --git a/apps/admin_migrate/appinfo/app.php b/apps/admin_migrate/appinfo/app.php new file mode 100644 index 00000000000..e45d3f6a529 --- /dev/null +++ b/apps/admin_migrate/appinfo/app.php @@ -0,0 +1,33 @@ +<?php + +/** +* ownCloud - admin_migrate +* +* @author Tom Needham +* @copyright 2012 Tom Needham tom@owncloud.com +* +* This library is free software; you can redistribute it and/or +* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE +* License as published by the Free Software Foundation; either +* version 3 of the License, or any later version. +* +* This library is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU AFFERO GENERAL PUBLIC LICENSE for more details. +* +* You should have received a copy of the GNU Affero General Public +* License along with this library. If not, see <http://www.gnu.org/licenses/>. +* +*/ + + +OC_APP::registerAdmin('admin_migrate','settings'); + +// add settings page to navigation +$entry = array( + 'id' => "admin_migrate_settings", + 'order'=>1, + 'href' => OC_Helper::linkTo( "admin_migrate", "settings.php" ), + 'name' => 'Export' +); diff --git a/apps/admin_migrate/appinfo/info.xml b/apps/admin_migrate/appinfo/info.xml new file mode 100644 index 00000000000..67fc3f9c5a0 --- /dev/null +++ b/apps/admin_migrate/appinfo/info.xml @@ -0,0 +1,11 @@ +<?xml version="1.0"?> +<info> + <id>admin_migrate</id> + <name>ownCloud Instance Migration</name> + <description>Import/Export your owncloud instance</description> + <version>0.1</version> + <licence>AGPL</licence> + <author>Thomas Schmidt and Tom Needham</author> + <require>2</require> + <default_enable/> +</info> diff --git a/apps/admin_migrate/settings.php b/apps/admin_migrate/settings.php new file mode 100644 index 00000000000..981d5f4ca63 --- /dev/null +++ b/apps/admin_migrate/settings.php @@ -0,0 +1,55 @@ +<?php + +/** + * ownCloud - admin_migrate + * + * @author Thomas Schmidt + * @copyright 2011 Thomas Schmidt tom@opensuse.org + * @author Tom Needham + * @copyright 2012 Tom Needham tom@owncloud.com + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE + * License as published by the Free Software Foundation; either + * version 3 of the License, or any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU AFFERO GENERAL PUBLIC LICENSE for more details. + * + * You should have received a copy of the GNU Affero General Public + * License along with this library. If not, see <http://www.gnu.org/licenses/>. + * + */ +OC_Util::checkAdminUser(); +OC_Util::checkAppEnabled('admin_migrate'); + +// Export? +if (isset($_POST['admin_export'])) { + // Create the export zip + if( !$path = OC_Migrate::export( null, $_POST['export_type'] ) ){ + // Error + die('error'); + } else { + // 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 OC_Template('admin_migrate', 'settings'); + return $tmpl->fetchPage(); +}
\ No newline at end of file diff --git a/apps/admin_migrate/templates/settings.php b/apps/admin_migrate/templates/settings.php new file mode 100644 index 00000000000..36eec84d489 --- /dev/null +++ b/apps/admin_migrate/templates/settings.php @@ -0,0 +1,24 @@ +<form id="export" action="#" method="post"> + <fieldset class="personalblock"> + <legend><strong><?php echo $l->t('Export this ownCloud instance');?></strong></legend> + <p><?php echo $l->t('This will create a compressed file that contains the data of this owncloud instance. + Please choose the export type:');?> + </p> + <h3>What would you like to export?</h3> + <p> + <input type="radio" name="export_type" value="instance" /> ownCloud instance ( suitable for import )<br /> + <input type="radio" name="export_type" value="system" /> ownCloud system files<br /> + <input type="radio" name="export_type" value="userfiles" /> Just user files<br /> + <input type="submit" name="admin_export" value="<?php echo $l->t('Export'); ?>" /> + </fieldset> +</form> +<form id="import" action="#" method="post" enctype="multipart/form-data"> + <fieldset class="personalblock"> + <legend><strong><?php echo $l->t('Import an ownCloud instance. THIS WILL DELETE ALL CURRENT OWNCLOUD DATA');?></strong></legend> + <p><?php echo $l->t('All current ownCloud data will be replaced by the ownCloud instance that is uploaded.');?> + </p> + <p><input type="file" id="owncloud_import" name="owncloud_import"><label for="owncloud_import"><?php echo $l->t('ownCloud Export Zip File');?></label> + </p> + <input type="submit" name="admin_import" value="<?php echo $l->t('Import'); ?>" /> + </fieldset> +</form> |