2012-04-26 21:45:17 +04:00
|
|
|
<?php
|
|
|
|
|
2012-05-03 14:23:29 +04:00
|
|
|
OCP\JSON::checkAppEnabled('files_versions');
|
2012-04-26 21:45:17 +04:00
|
|
|
|
2012-05-17 04:16:33 +04:00
|
|
|
require_once('apps/files_versions/versions.php');
|
2012-04-26 21:45:17 +04:00
|
|
|
|
2012-05-17 04:16:33 +04:00
|
|
|
$userDirectory = "/".OCP\USER::getUser()."/files";
|
2012-04-26 21:45:17 +04:00
|
|
|
|
2012-05-17 04:16:33 +04:00
|
|
|
$file = $_GET['file'];
|
|
|
|
$revision=(int)$_GET['revision'];
|
2012-04-26 21:45:17 +04:00
|
|
|
|
2012-05-17 04:16:33 +04:00
|
|
|
if( OCA_Versions\Storage::isversioned( $file ) ) {
|
|
|
|
if(OCA_Versions\Storage::rollback( $file, $revision )){
|
|
|
|
OCP\JSON::success(array("data" => array( "revision" => $revision, "file" => $file )));
|
|
|
|
}else{
|
|
|
|
OCP\JSON::error(array("data" => array( "message" => "Could not revert:" . $file )));
|
|
|
|
}
|
2012-04-26 21:45:17 +04:00
|
|
|
}
|