2012-04-26 17:45:17 +00:00
|
|
|
<?php
|
2015-02-23 10:28:53 +00:00
|
|
|
/**
|
|
|
|
* @author Bart Visscher <bartv@thisnet.nl>
|
|
|
|
* @author Björn Schießle <schiessle@owncloud.com>
|
|
|
|
* @author Frank Karlitschek <frank@owncloud.org>
|
|
|
|
* @author Lukas Reschke <lukas@owncloud.com>
|
|
|
|
* @author Robin Appelman <icewind@owncloud.com>
|
|
|
|
* @author Sam Tuke <mail@samtuke.com>
|
|
|
|
* @author Thomas Müller <thomas.mueller@tmit.eu>
|
|
|
|
* @author Thomas Tanghus <thomas@tanghus.net>
|
|
|
|
*
|
|
|
|
* @copyright Copyright (c) 2015, ownCloud, Inc.
|
|
|
|
* @license AGPL-3.0
|
|
|
|
*
|
|
|
|
* This code is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU Affero General Public License, version 3,
|
|
|
|
* as published by the Free Software Foundation.
|
|
|
|
*
|
|
|
|
* This program 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, version 3,
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
|
|
|
*
|
|
|
|
*/
|
2015-01-09 10:50:17 +00:00
|
|
|
OCP\JSON::checkLoggedIn();
|
2012-05-03 10:23:29 +00:00
|
|
|
OCP\JSON::checkAppEnabled('files_versions');
|
2012-07-17 09:57:38 +00:00
|
|
|
OCP\JSON::callCheck();
|
2012-04-26 17:45:17 +00:00
|
|
|
|
2015-02-13 12:33:20 +00:00
|
|
|
$file = (string)$_GET['file'];
|
2012-05-17 00:16:33 +00:00
|
|
|
$revision=(int)$_GET['revision'];
|
2012-04-26 17:45:17 +00:00
|
|
|
|
2012-09-19 18:59:57 +00:00
|
|
|
if(OCA\Files_Versions\Storage::rollback( $file, $revision )) {
|
2013-01-11 13:23:28 +00:00
|
|
|
OCP\JSON::success(array("data" => array( "revision" => $revision, "file" => $file )));
|
|
|
|
}else{
|
2014-08-31 08:05:59 +00:00
|
|
|
$l = \OC::$server->getL10N('files_versions');
|
2013-02-07 15:34:57 +00:00
|
|
|
OCP\JSON::error(array("data" => array( "message" => $l->t("Could not revert: %s", array($file) ))));
|
2012-04-26 17:45:17 +00:00
|
|
|
}
|