syncRef method

@param               $ref
@param               $type
@param \Closure|null $progress
488229
public function syncRef($ref, $type, Closure $progress = null)
    {
        $this->fire('start', [ $ref, $type ]);
        $owner      = $this->setting('owner');
        $repo       = $this->setting('repository');
        $remote     = $this->client($connection = $this->setting('connection'));
        $downloader = $this->setting('downloader');
        $config     = $this->git->getConfig($connection);
        $driver     = $config[ 'driver' ];

        if($driver === 'github'){
            // Downloading large files with the git downloader fails.
            // The Github api can get 1MB max blob size.
            // So for github drive, we hard define zip as downloader
            $downloader = 'zip';
        }

        $this->createDownloader($downloader)->download($owner, $repo, $ref);

        if ( $type === 'branch' )
        {
            $branch = $remote->getBranch($this->setting('repository'), $ref, $this->setting('owner'));
            $this->cache->forever(md5($this->project->getName() . $branch[ 'name' ]), $branch[ 'sha' ]);
        }
        $this->fire('finish', [ $ref, $type ]);
    }
468607
public function invoke($type, $parameters = null)
    {
        $class = $this->getClass($type);
        $name  = $this->normalizeType($type);

        $params = func_get_args();
        array_shift($params);

        $reflector = new \ReflectionClass($class);
        $instance  = $reflector->newInstanceArgs($params);

        if (empty($params)) {
            parent::__set($name, $instance);
        }

        return (clone $instance);
    }
1190294
public function registerUrlFromStatus(\Vatsimphp\Sync\StatusSync $sync, $type)
    {
        $urls = $sync->loadData()->get($type)->toArray();
        if (empty($urls)) {
            throw new RuntimeException(
                'Error loading urls from StatusSync'
            );
        }
        $this->registerUrl($urls, true);

        return true;
    }
200268
public function nullRef(string $type): Reference
	{
		foreach ($this->backends as $b => $backend) {
			$m = $backend->getMachine($this, $type);
			if ($m !== null) {
				$ref = $m->nullRef();

				// Emit events
				if ($this->debug_logger) {
					$this->debug_logger->afterReferenceCreated($backend, $ref);
				}
				if ($this->after_reference_created) {
					$this->after_reference_created->emit($ref);
				}

				return $ref;
			}
		}
		throw new RuntimeException('Cannot create machine: '.$type);
	}
579153
public static function countLogData($syncid, $type = 'all')
	{
		$db = Factory::getDBO();

		$query = $db->getQuery(true)
			->select('COUNT(*)')
			->from('#__jfusion_sync_details')
			->where('syncid = ' . $db->quote($syncid));

		if ($type != 'all') {
			$query->where('action = ' . $db->quote($type));
		}
		$db->setQuery($query);
		return (int)$db->loadResult();
	}
520565
public function addReference(&$data, $type)
    {
        if (!$this->validate($data)) {
            return false;
        }

        $this->store[$type][] =& $data;
        return $data;
    }
596825
public int refreshToCurrent(int iChangeType, boolean bWarningIfChanged)
    {
        int iErrorCode = DBConstants.NORMAL_RETURN;
    	try {
	        int iHandleType = DBConstants.BOOKMARK_HANDLE;
	
	        if ((this.getEditMode() == Constants.EDIT_CURRENT)
	            || (this.getEditMode() == Constants.EDIT_IN_PROGRESS))
	        {
	            Object bookmark = this.getHandle(iHandleType);
	            if (bookmark != null)
	            {
	                Object[] rgobjEnabledFields = this.setEnableFieldListeners(false);
	                boolean[] rgbEnabled = this.setEnableListeners(false);
	                int iOldOpenMode = this.getOpenMode();
	                this.setOpenMode(DBConstants.OPEN_DONT_CHANGE_CURRENT_LOCK_TYPE | (iOldOpenMode & DBConstants.LOCK_TYPE_MASK));	// Straight read - no cache (keep lock settings)
                    
                    // First step - backup the current data
                    int iFieldsTypes = BaseBuffer.ALL_FIELDS;
                    BaseBuffer buffer = new VectorBuffer(null, iFieldsTypes);
                    buffer.fieldsToBuffer(this, iFieldsTypes);

                    boolean rgbModified[] = null;
                    if ((iChangeType != DBConstants.AFTER_DELETE_TYPE)
	                    && (this.isModified()))
	                {
                        boolean bLockRecord = this.getEditMode() == DBConstants.EDIT_IN_PROGRESS;
                        // Second step, save which fields have been modified.
                        rgbModified = this.getModified();
                        // Third step - refresh the record
                        this.addNew();
                        Record newRecord = this.setHandle(bookmark, iHandleType);
                        // Forth step - Move my changed fields to the refreshed record
                        if (newRecord == null)
                            this.addNew();
                        else
                        {
                            if (bLockRecord)
                                this.edit();    // If I haven't changed any data, just refresh it.
                            buffer.resetPosition();
                            for (int iFieldSeq = 0; iFieldSeq < this.getFieldCount(); iFieldSeq++)
                            {
                                Object dataScreen = buffer.getNextData();
                                if (rgbModified[iFieldSeq])
                                {   // If I modified it
                                    BaseField field = this.getField(iFieldSeq);
                                    if ((field.isVirtual()) && (field.isModified()))
                                        continue;   // Special case - some field change modified a virtual field, leave it alone
                                    Object dataUpdated = field.getData();
                                    if (((dataUpdated != null) && (!dataUpdated.equals(dataScreen)))
                                        || ((dataUpdated == null) && (dataScreen != dataUpdated)))
                                    {   // And it is different from the current data, merge data
                                        field.mergeData(dataScreen);    // This will set field modified to true
                                        if (field.isVirtual())
                                            field.setData(dataScreen);  // This will set just modified to false
                                        if (bWarningIfChanged)
                                            iErrorCode = DBConstants.RECORD_CHANGED;
                                    }
                                }
                            }
                        }
	                }
	                else
	                {
	                    this.addNew();    // Clear current bookmark
	                    if (iChangeType != DBConstants.AFTER_DELETE_TYPE)
	                        this.setHandle(bookmark, iHandleType);
	                }
	                this.setEnableListeners(rgbEnabled);
	                this.setEnableFieldListeners(rgobjEnabledFields);
                    // Fifth step: If what is currently on the screen is different from the new merged data, re-call the handleFieldChanged (SCREEN_MOVE)
	                int iDBMasterSlave = 0;
	                if ((this.getMasterSlave() & RecordOwner.MASTER) == 0)
	                {
                        iDBMasterSlave = this.getTable().getCurrentTable().getDatabase().getMasterSlave();
                        this.getTable().getCurrentTable().getDatabase().setMasterSlave(RecordOwner.MASTER | RecordOwner.SLAVE);
	                }
	                boolean bAnyChanged = this.checkAndHandleFieldChanges(buffer, rgbModified, true);
	                if (iDBMasterSlave != 0)
	                	this.getTable().getCurrentTable().getDatabase().setMasterSlave(iDBMasterSlave);
                    this.setOpenMode(iOldOpenMode);     // Some field listeners need to know I'm refreshing, so I wait until checkAndHandleFieldChanges is done.
                    if (bWarningIfChanged)
                        if (bAnyChanged)
                            iErrorCode = DBConstants.RECORD_CHANGED;
	            }
	        }
    	} catch (DBException ex) {
    		ex.printStackTrace();
    	}
		return iErrorCode;
    }
562438
public static function syncRiverObjectAccess($event, $type, $entity) {
		if (!$entity instanceof \ElggObject) {
			// keep user and group entries as is
			return;
		}

		// need to override access in case comments ended up with ACCESS_PRIVATE
		// and to ensure write permissions
		$ia = elgg_set_ignore_access(true);
		$options = array(
			'type' => 'object',
			'subtype' => RiverObject::class,
			'container_guid' => $entity->guid,
			'wheres' => array(
				"e.access_id != {$entity->access_id}"
			),
			'limit' => 0,
		);

		$batch = new ElggBatch('elgg_get_entities', $options, null, 25, false);
		foreach ($batch as $river_object) {
			// Update comment access_id
			$river_object->access_id = $entity->access_id;
			$river_object->save();
		}

		elgg_set_ignore_access($ia);
	}
116643
public function getCollectionByContentAction($type, $uid, $start, $count)
    {
        $content = $this->findOneByTypeAndUid($type, $uid);
        $this->granted('VIEW', $content);

        $revisions = $this->getEntityManager()
                ->getRepository('BackBee\ClassContent\Revision')
                ->getRevisions($content, [Revision::STATE_COMMITTED], $start, $count);

        $result = [];
        foreach ($revisions as $revision) {
            $result[] = $revision->jsonSerialize(Revision::JSON_REVISION_FORMAT);
        }

        $response = $this->createJsonResponse();
        $response->setData($result);

        if ($revisions instanceof Paginator) {
            $response->headers->set('Content-Range', sprintf('%d-%d/%d', $start, $start +
                            count($result) - 1, count($revisions)));
        }

        return $response;
    }
1090510
@SdkInternalApi
    void updatePersistableTransfer(Integer lastFullyDownloadedPartNumber) {
        synchronized (this) {
            this.lastFullyDownloadedPartNumber = lastFullyDownloadedPartNumber;
        }

        persistableDownload = captureDownloadState(getObjectRequest, file);
        S3ProgressPublisher.publishTransferPersistable(progressListenerChain, persistableDownload);
    }
1081930
def update_distant_reference(self, ref):
        
        self.validate_reference_data(ref["data"])
        self._zotero_lib.update_item(ref)
862156
public function getByReference($reference, $type)
    {
        if (!isset($this->store[$type])) {
            return false;
        }

        $count = count($this->store[$type]);

        if ($reference >= $count) {
            throw new DeserializationException('Invalid ' . $type . ' reference: ' . $reference);
        }

        if (!$count) {
            return false;
        }

        return $this->store[$type][$reference];
    }
1057315
public function update($type, $productId, $linkedProductId, $data, $identifierType = null)
    {
        return $this->__createAction('catalog_product_link.update', func_get_args());
    }
1272269
public function processFile(string $type)
    {
        $this->alert(strtoupper($type) . ' PROCESS');
        foreach ($this->tables as $key => $table) {
            if ($table->relationTable === true && $type !== 'pivot') {
                continue;
            }

            if ($table->relationTable !== true && $type === 'pivot') {
                continue;
            }

            if (trim($this->option('table')) !== 'all') {
                $tableKey = $this->option('table');
                if ((int) $tableKey !== (int) $key) {
                    continue;
                }
            }

            $table->arqs = [
                $type => $this->getTemplate($type),
            ];

            foreach ($this->marks()[$type] as $mark){
                $table->arqs[$type] = str_replace('{{{' . $mark . '}}}',
                                                        trim($table->marks[$mark]),
                                                        $table->arqs[$type]);
            }

            //$this->info($table->arqs[$type]);
            $this->createFile($type, $table);
        }
    }
844294
protected function getReferencesValues($versionInfo, array $references, $step)
    {
        $refs = array();

        foreach ($references as $reference) {
            switch ($reference['attribute']) {
                case 'version_no':
                    $value = $versionInfo->versionNo;
                    break;
                case 'version_status':
                    $value = $this->versionStatusToHash($versionInfo->status);
                    break;
                default:
                    // NB: this will generate an error if the user tries to seta  ref to a field value
                    $value = reset(parent::getReferencesValues($versionInfo, array($references), $step));
            }

            $refs[$reference['identifier']] = $value;
        }

        return $refs;
    }
1147604
def add_ref(self, reftype, data):
        """"""
        ref = (reftype, data)
        try:
            index = self.refs.index(ref)
        except ValueError:
            self.refs.append(ref)
            index = len(self.refs) - 1
        return str(index)
808821
@Reference(service = LocalTransactionCurrent.class)
    protected void setLocalTransactionCurrent(ServiceReference<LocalTransactionCurrent> ref) {
        localTranCurrentRef.setReference(ref);
    }