nextcloud/apps/files_versions/ajax/rollbackVersion.php

18 lines
484 B
PHP
Raw Normal View History

<?php
2012-05-03 14:23:29 +04:00
OCP\JSON::checkAppEnabled('files_versions');
OCP\JSON::callCheck();
$userDirectory = "/".OCP\USER::getUser()."/files";
$file = $_GET['file'];
$revision=(int)$_GET['revision'];
if( OCA_Versions\Storage::isversioned( $file ) ) {
2012-09-07 17:22:01 +04:00
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 )));
}
}