2012-04-26 17:45:17 +00:00
|
|
|
<?php
|
|
|
|
|
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
|
|
|
|
2012-05-17 00:16:33 +00:00
|
|
|
$userDirectory = "/".OCP\USER::getUser()."/files";
|
2012-04-26 17:45:17 +00:00
|
|
|
|
2012-05-17 00:16:33 +00:00
|
|
|
$file = $_GET['file'];
|
|
|
|
$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{
|
2013-02-07 15:17:54 +00:00
|
|
|
$l = OC_L10N::get('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
|
|
|
}
|