Exemplo n.º 1
0
 public function canPullRef(DoorkeeperObjectRef $ref)
 {
     if ($ref->getApplicationType() != self::APPTYPE_JIRA) {
         return false;
     }
     $types = array(self::OBJTYPE_ISSUE => true);
     return isset($types[$ref->getObjectType()]);
 }
 public function canPullRef(DoorkeeperObjectRef $ref)
 {
     if ($ref->getApplicationType() != self::APPTYPE_GITHUB) {
         return false;
     }
     if ($ref->getApplicationDomain() != self::APPDOMAIN_GITHUB) {
         return false;
     }
     return true;
 }
 public function canPullRef(DoorkeeperObjectRef $ref)
 {
     if ($ref->getApplicationType() != self::APPTYPE_ASANA) {
         return false;
     }
     if ($ref->getApplicationDomain() != self::APPDOMAIN_ASANA) {
         return false;
     }
     $types = array(self::OBJTYPE_TASK => true);
     return isset($types[$ref->getObjectType()]);
 }
Exemplo n.º 4
0
 protected final function saveExternalObject(DoorkeeperObjectRef $ref, DoorkeeperExternalObject $obj)
 {
     $unguarded = AphrontWriteGuard::beginScopedUnguardedWrites();
     try {
         $obj->save();
     } catch (AphrontDuplicateKeyQueryException $ex) {
         // In various cases, we may race another process importing the same
         // data. If we do, we'll collide on the object key. Load the object
         // the other process created and use that.
         $obj = id(new DoorkeeperExternalObjectQuery())->setViewer($this->getViewer())->withObjectKeys(array($ref->getObjectKey()))->executeOne();
         if (!$obj) {
             throw new PhutilProxyException(pht('Failed to load external object after collision.'), $ex);
         }
         $ref->attachExternalObject($obj);
     }
     unset($unguarded);
 }