Пример #1
0
 /**
  * Restore all or specified deleted revisions to the given file.
  * Permissions and logging are left to the caller.
  *
  * May throw database exceptions on error.
  *
  * @param array $versions set of record ids of deleted items to restore,
  *   or empty to restore all revisions.
  * @param bool $unsuppress
  * @return FileRepoStatus
  */
 function restore($versions = array(), $unsuppress = false)
 {
     if ($this->getRepo()->getReadOnlyReason() !== false) {
         return $this->readOnlyFatalStatus();
     }
     $batch = new LocalFileRestoreBatch($this, $unsuppress);
     $this->lock();
     // begin
     if (!$versions) {
         $batch->addAll();
     } else {
         $batch->addIds($versions);
     }
     $status = $batch->execute();
     if ($status->isGood()) {
         $cleanupStatus = $batch->cleanup();
         $cleanupStatus->successCount = 0;
         $cleanupStatus->failCount = 0;
         $status->merge($cleanupStatus);
     }
     $this->unlock();
     // done
     return $status;
 }
Пример #2
0
 /**
  * Restore all or specified deleted revisions to the given file.
  * Permissions and logging are left to the caller.
  *
  * May throw database exceptions on error.
  *
  * @param $versions set of record ids of deleted items to restore,
  *                    or empty to restore all revisions.
  * @param $unsuppress Boolean
  * @return FileRepoStatus
  */
 function restore($versions = array(), $unsuppress = false)
 {
     $batch = new LocalFileRestoreBatch($this, $unsuppress);
     if (!$versions) {
         $batch->addAll();
     } else {
         $batch->addIds($versions);
     }
     $status = $batch->execute();
     if (!$status->isGood()) {
         return $status;
     }
     $cleanupStatus = $batch->cleanup();
     $cleanupStatus->successCount = 0;
     $cleanupStatus->failCount = 0;
     $status->merge($cleanupStatus);
     return $status;
 }