You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

getVersions.php 668B

123456789101112131415161718192021222324
  1. <?php
  2. OCP\JSON::checkAppEnabled('files_versions');
  3. $source = $_GET['source'];
  4. $start = $_GET['start'];
  5. list ($uid, $filename) = OCA\Files_Versions\Storage::getUidAndFilename($source);
  6. $count = 5; //show the newest revisions
  7. $versions = OCA\Files_Versions\Storage::getVersions($uid, $filename, $source);
  8. if( $versions ) {
  9. $endReached = false;
  10. if (count($versions) <= $start+$count) {
  11. $endReached = true;
  12. }
  13. $versions = array_slice($versions, $start, $count);
  14. \OCP\JSON::success(array('data' => array('versions' => $versions, 'endReached' => $endReached)));
  15. } else {
  16. \OCP\JSON::success(array('data' => array('versions' => false, 'endReached' => true)));
  17. }