You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

rollbackVersion.php 1.5KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. <?php
  2. /**
  3. * @copyright Copyright (c) 2016, ownCloud, Inc.
  4. *
  5. * @author Bart Visscher <bartv@thisnet.nl>
  6. * @author Björn Schießle <bjoern@schiessle.org>
  7. * @author Frank Karlitschek <frank@karlitschek.de>
  8. * @author Lukas Reschke <lukas@statuscode.ch>
  9. * @author Robin Appelman <robin@icewind.nl>
  10. * @author Sam Tuke <mail@samtuke.com>
  11. * @author Thomas Müller <thomas.mueller@tmit.eu>
  12. * @author Thomas Tanghus <thomas@tanghus.net>
  13. *
  14. * @license AGPL-3.0
  15. *
  16. * This code is free software: you can redistribute it and/or modify
  17. * it under the terms of the GNU Affero General Public License, version 3,
  18. * as published by the Free Software Foundation.
  19. *
  20. * This program is distributed in the hope that it will be useful,
  21. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  22. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  23. * GNU Affero General Public License for more details.
  24. *
  25. * You should have received a copy of the GNU Affero General Public License, version 3,
  26. * along with this program. If not, see <http://www.gnu.org/licenses/>
  27. *
  28. */
  29. OCP\JSON::checkLoggedIn();
  30. OCP\JSON::checkAppEnabled('files_versions');
  31. OCP\JSON::callCheck();
  32. $file = (string)$_GET['file'];
  33. $revision=(int)$_GET['revision'];
  34. if(OCA\Files_Versions\Storage::rollback( $file, $revision )) {
  35. OCP\JSON::success(array("data" => array( "revision" => $revision, "file" => $file )));
  36. }else{
  37. $l = \OC::$server->getL10N('files_versions');
  38. OCP\JSON::error(array("data" => array( "message" => $l->t("Could not revert: %s", array($file) ))));
  39. }