Checks whether the games client is out of date. (revisions.check)

@param string $clientRevision The revision of the client SDK used by your application.
@param array $optParams Optional parameters.
@return RevisionCheckResponse
188645
public function check($clientRevision, $optParams = array()) {
      $params = array('clientRevision' => $clientRevision);
      $params = array_merge($params, $optParams);
      $data = $this->__call('check', array($params));
      if ($this->useObjects()) {
        return new RevisionCheckResponse($data);
      } else {
        return $data;
      }
    }
1135717
@InterfaceAudience.Private
    public void pullRemoteRevision(final RevisionInternal rev) {

        Log.d(TAG, "%s: pullRemoteRevision with rev: %s", this, rev);

        ++httpConnectionCount;

        // Construct a query. We want the revision history, and the bodies of attachments that have
        // been added since the latest revisions we have locally.
        // See: http://wiki.apache.org/couchdb/HTTP_Document_API#Getting_Attachments_With_a_Document
        StringBuilder path = new StringBuilder(encodeDocumentId(rev.getDocID()));
        path.append("?rev=").append(URIUtils.encode(rev.getRevID()));
        path.append("&revs=true");

        // TODO: CBL Java does not have implementation of _settings yet. Till then, attachments always true
        boolean attachments = true;
        if (attachments)
            path.append("&attachments=true");

        // Include atts_since with a list of possible ancestor revisions of rev. If getting attachments,
        // this allows the server to skip the bodies of attachments that have not changed since the
        // local ancestor. The server can also trim the revision history it returns, to not extend past
        // the local ancestor (not implemented yet in SG but will be soon.)
        AtomicBoolean haveBodies = new AtomicBoolean(false);
        List<String> possibleAncestors = null;
        possibleAncestors = db.getPossibleAncestorRevisionIDs(rev,
                PullerInternal.MAX_NUMBER_OF_ATTS_SINCE, attachments ? haveBodies : null, true);
        if (possibleAncestors != null) {
            path.append(haveBodies.get() ? "&atts_since=" : "&revs_from=");
            path.append(joinQuotedEscaped(possibleAncestors));
        } else {
            int maxRevTreeDepth = getLocalDatabase().getMaxRevTreeDepth();
            if (rev.getGeneration() > maxRevTreeDepth) {
                path.append("&revs_limit=");
                path.append(maxRevTreeDepth);
            }
        }

        //create a final version of this variable for the log statement inside
        //FIXME find a way to avoid this
        final String pathInside = path.toString();
        CustomFuture future = sendAsyncMultipartDownloaderRequest("GET", pathInside,
                null, db, new RemoteRequestCompletion() {

                    @Override
                    public void onCompletion(RemoteRequest remoteRequest, Response httpResponse, Object result, Throwable e) {
                        if (e != null) {
                            Log.w(TAG, "Error pulling remote revision: %s", e, this);
                            if (Utils.isDocumentError(e)) {
                                // Revision is missing or not accessible:
                                revisionFailed(rev, e);
                            } else {
                                // Request failed:
                                setError(e);
                            }
                        } else {

                            Map<String, Object> properties = (Map<String, Object>) result;
                            long size = 0;
                            if (httpResponse != null && httpResponse.body() != null)
                                size = httpResponse.body().contentLength();
                            PulledRevision gotRev = new PulledRevision(properties, size);
                            gotRev.setSequence(rev.getSequence());

                            Log.d(TAG, "%s: pullRemoteRevision add rev: %s to batcher: %s",
                                    PullerInternal.this, gotRev, downloadsToInsert);

                            // NOTE: should not/not necessary to call Body.compact()
                            // new PulledRevision(Map<string, Object>) creates Body instance only
                            // with `object`. Serializing object to json causes two unnecessary
                            // JSON serializations.

                            if (gotRev.getBody() != null)
                                queuedMemorySize.addAndGet(gotRev.getBody().getSize());

                            // Add to batcher ... eventually it will be fed to -insertRevisions:.
                            downloadsToInsert.queueObject(gotRev);

                            // if queue memory size is more than maximum, force flush the queue.
                            if (queuedMemorySize.get() > MAX_QUEUE_MEMORY_SIZE) {
                                Log.d(TAG, "Flushing  queued memory size at: " + queuedMemorySize);
                                downloadsToInsert.flushAllAndWait();
                            }
                        }

                        // Note that we've finished this task:
                        --httpConnectionCount;

                        // Start another task if there are still revisions waiting to be pulled:
                        pullRemoteRevisions();
                    }
                });
        future.setQueue(pendingFutures);
        pendingFutures.add(future);
    }
931507
@InterfaceAudience.Private
    protected void queueRemoteRevision(RevisionInternal rev) {
        if (rev.isDeleted()) {
            deletedRevsToPull.add(rev);
        } else {
            revsToPull.add(rev);
        }
    }
322601
private function getParamsFromRevision( Revision $revision ) {
		$params = [
			'undo' => $revision->getId(),
			'token' => $this->api->getToken(),
		];

		if ( !is_null( $revision->getPageIdentifier()->getId() ) ) {
			$params['pageid'] = $revision->getPageIdentifier()->getId();
		} else {
			$params['title'] = $revision->getPageIdentifier()->getTitle()->getTitle();
		}

		return $params;
	}
1238009
public function update($params, $optParams = [])
    {
        if (!$params instanceof AccessToken) {
            throw new InvalidParamException(AccessToken::class . ' is required!');
        }
        $class = get_class($params);

        return $this->sendRequest([], [
            'restAction' => 'update',
            'restId' => $params->id,
            'postParams' => $params->toArray(),
            'getParams' => $optParams,
        ], function ($response) use ($class) {
            return isset($response->data) ? new $class($response->data) : $response;
        });
    }
1260655
public function update($clientId, ClientBuilder $input, array $queryParams = [])
    {
        $response = $this->api->oauth2()->clients()->update($clientId, $input->toArray(), $queryParams);

        return new ClientResponse($response);
    }
69298
public function setRevisions(array $revisions)
    {
        $this->revisions = new ArrayCollection();

        /** @var \Rcm\Entity\Revision $revision */
        foreach ($revisions as $revision) {
            if (!$revision instanceof Revision) {
                throw new InvalidArgumentException(
                    "Invalid Revision passed in.  Unable to set array"
                );
            }

            $this->revisions->set($revision->getRevisionId(), $revision);
        }
    }
537922
public function viewRevisionAction($rev)
    {
        $revision = $this->getAuditReader()->findRevision($rev);
        if (!$revision) {
            throw $this->createNotFoundException(sprintf('Revision %s not found', $rev));
        }

        $changedEntities = $this->getAuditReader()->findEntitiesChangedAtRevision($rev);

        return $this->render('SimpleThingsEntityAuditBundle:Audit:view_revision.html.twig', array(
            'revision' => $revision,
            'changedEntities' => $changedEntities,
        ));
    }
590210
protected function passThroughRevision($revision, $key)
    {
        $action = $revision->getAttribute('action');

        // @todo what about restored???
        if (in_array($action, ['created', 'updated'])) {
            return $revision->new($key);
        }
    }
227178
public function update($params, $optParams = [])
    {
        if (!$params instanceof SuperBackup) {
            throw new InvalidParamException(SuperBackup::class.' is required!');
        }
        if(!isset($optParams['cloud'])){
            $optParams['cloud'] = [];
        }
        if ($params->task && is_string($params->task->type)) {
            $params->task = $params->task->type;
        }
        $optParams['cloud']['id'] = $params->cloud->id;
        return $this->sendRequest([], [
            'restAction' => 'update',
            'uri' => '/c/<cloud.id>',
            'restId' => $params->id,
            'postParams' => $params->toArray(),
            'getParams' => $optParams,
        ], function ($response) {
            return isset($response->data) ? new SuperBackup($response->data) : $response;
        });
    }
1206345
public function updateMultiple(Games_AchievementUpdateMultipleRequest $postBody, $optParams = array())
  {
    $params = array('postBody' => $postBody);
    $params = array_merge($params, $optParams);
    return $this->call('updateMultiple', array($params), "Games_AchievementUpdateMultipleResponse");
  }
1094135
public function deleteFromRevision( Revision $revision, array $extraParams = [] ) {
		$this->api->postRequest( new SimpleRequest(
			'delete',
			$this->getDeleteParams( $revision->getPageIdentifier(), $extraParams )
		) );
		return true;
	}
1269669
protected function getRevisionList(
        $published = false,
        $limit = 10
    ) {
        $revisions = $this->findRevisionList->__invoke(
            $this->currentSite->getSiteId(),
            $this->page->getName(),
            $this->page->getPageType(),
            $published,
            $limit
        );

        return $revisions;
    }
364524
public static function retrieveRevision($id, $personId, $params = null, $opts = null)
    {
        return self::_retrieveNestedResource($id, static::PATH_REVISIONS, $personId, $params, $opts);
    }
1040249
private RevisionInternal applyOptionsToRevision(EnumSet<TDContentOptions> options, RevisionInternal rev) {
        if (options != null && (
                options.contains(TDContentOptions.TDIncludeLocalSeq) ||
                        options.contains(TDContentOptions.TDIncludeRevs) ||
                        options.contains(TDContentOptions.TDIncludeRevsInfo) ||
                        options.contains(TDContentOptions.TDIncludeConflicts) ||
                        options.contains(TDContentOptions.TDBigAttachmentsFollow))) {

            Map<String, Object> dst = new HashMap<String, Object>();
            dst.putAll(rev.getProperties());
            if (options.contains(TDContentOptions.TDIncludeLocalSeq)) {
                dst.put("_local_seq", rev.getSequence());
                rev.setProperties(dst);
            }
            if (options.contains(TDContentOptions.TDIncludeRevs)) {
                List<RevisionInternal> revs = db.getRevisionHistory(rev);
                Map<String, Object> historyDict = RevisionUtils.makeRevisionHistoryDict(revs);
                dst.put("_revisions", historyDict);
                rev.setProperties(dst);
            }
            if (options.contains(TDContentOptions.TDIncludeRevsInfo)) {
                List<Object> revsInfo = new ArrayList<Object>();
                List<RevisionInternal> revs = db.getRevisionHistory(rev);
                for (RevisionInternal historicalRev : revs) {
                    Map<String, Object> revHistoryItem = new HashMap<String, Object>();
                    String status = "available";
                    if (historicalRev.isDeleted()) {
                        status = "deleted";
                    }
                    if (historicalRev.isMissing()) {
                        status = "missing";
                    }
                    revHistoryItem.put("rev", historicalRev.getRevID());
                    revHistoryItem.put("status", status);
                    revsInfo.add(revHistoryItem);
                }
                dst.put("_revs_info", revsInfo);
                rev.setProperties(dst);
            }
            if (options.contains(TDContentOptions.TDIncludeConflicts)) {
                RevisionList revs = db.getAllRevisions(rev.getDocID(), true);
                if (revs.size() > 1) {
                    List<String> conflicts = new ArrayList<String>();
                    for (RevisionInternal aRev : revs) {
                        if (aRev.equals(rev) || aRev.isDeleted()) {
                            // don't add in this case
                        } else {
                            conflicts.add(aRev.getRevID());
                        }
                    }
                    dst.put("_conflicts", conflicts);
                }
                rev.setProperties(dst);
            }
            if (options.contains(TDContentOptions.TDBigAttachmentsFollow)) {
                RevisionInternal nuRev = new RevisionInternal(dst);
                Status outStatus = new Status(Status.OK);
                if (!db.expandAttachments(nuRev, 0, false, getBooleanQuery("att_encoding_info"), outStatus))
                    return null;
                rev = nuRev;
            }
        }
        return rev;
    }
1068213
public function getReleasedRevisions()
    {
        if ($this->releasedRevisions === null) {
            $this->setReleasedRevisions($this->revisionRepository->getAllReleasedByEnvironment($this));
        }
        return $this->releasedRevisions;
    }
122052
public function getConfigRevisionForModel() {
        if(is_null($this->revisionEnabled)) {
            // the parameter is not set - default behaviour is to create revisions
            return true;
        }

        if($this->revisionEnabled === false) {
            return false;
        }
        return true;
    }