rollbackVersion.php 511 B

12345678910111213141516171819
  1. <?php
  2. OCP\JSON::checkAppEnabled('files_versions');
  3. require_once('apps/files_versions/versions.php');
  4. $userDirectory = "/".OCP\USER::getUser()."/files";
  5. $file = $_GET['file'];
  6. $revision=(int)$_GET['revision'];
  7. if( OCA_Versions\Storage::isversioned( $file ) ) {
  8. if(OCA_Versions\Storage::rollback( $file, $revision )){
  9. OCP\JSON::success(array("data" => array( "revision" => $revision, "file" => $file )));
  10. }else{
  11. OCP\JSON::error(array("data" => array( "message" => "Could not revert:" . $file )));
  12. }
  13. }