Updater

@param string $initialVersion
@return string $versionUpdatedTo
495086
public function update($initialVersion)
    {

        $this->runExtensionScript(RegisterPicFilesystem::class);

        $this->skip('0.1','0.2.4');

		if ($this->isVersion('0.2.4')) {
			$setupPortableElementFileStorage = new SetupPortableElementFileStorage();
			$setupPortableElementFileStorage->setServiceLocator($this->getServiceManager());
			$setupPortableElementFileStorage([]);

			$registerPicModel = new RegisterPicModel();
			$registerPicModel->setServiceLocator($this->getServiceManager());
			$registerPicModel([]);

			$setQtiCreatorConfig = new SetQtiCreatorConfig();
			$setQtiCreatorConfig([]);

			$registerClientProvider = new RegisterClientProvider();
			$registerClientProvider([]);

            // Grants access on PciLoader for TestManager role.
            AclProxy::applyRule(new AccessRule(
                AccessRule::GRANT,
                'http://www.tao.lu/Ontologies/TAOItem.rdf#ItemsManagerRole',
                ['ext' => 'qtiItemPic' , 'mod' => 'PciLoader']
            ));

            // Grants access on PciLoader for QTIManager role.
            AclProxy::applyRule(new AccessRule(
                AccessRule::GRANT,
                'http://www.tao.lu/Ontologies/TAOItem.rdf#QTIManagerRole',
                ['ext' => 'qtiItemPic' , 'mod' => 'PciLoader']
            ));

            // Grants access on PciLoader for TestTaker role.
            AclProxy::applyRule(new AccessRule(
                AccessRule::GRANT,
				TaoOntology::PROPERTY_INSTANCE_ROLE_DELIVERY,
                ['ext' => 'qtiItemPic' , 'mod' => 'PciLoader']
            ));

			HookRegistry::getRegistry()->remove('picCreator');

			$this->setVersion('1.0.0');
		}

		$this->skip('1.0.0', '1.1.0');

		if ($this->isVersion('1.1.0')) {
			call_user_func(new RegisterPicStudentToolbar(), ['0.2.0']);
			call_user_func(new RegisterPicStudentToolSample(), ['0.2.0']);
			$this->setVersion('1.2.0');
		}

        $this->skip('1.2.0', '2.0.1');


        if($this->isVersion('2.0.1')){
            $this->runExtensionScript(RegisterPicFilesystem::class);

            $model = new PicModel();
            $registry = PicRegistry::getRegistry();
            $registry->setServiceLocator($this->getServiceManager());
            $registry->setModel($model);

            /** @var \common_ext_ExtensionsManager $extensionManager */
            $extensionManager = $this->getServiceManager()->get(\common_ext_ExtensionsManager::SERVICE_ID);
            $map = $extensionManager->getExtensionById(PicRegistry::REGISTRY_EXTENSION)->getConfig(PicRegistry::REGISTRY_ID);

            foreach ($map as $key => $value){
                uksort($value, function($a, $b) {
                    return version_compare($a, $b, '<');
                });
                $portableElementObject = $model->createDataObject(reset($value));
                //set it the new way
                $registry->update($portableElementObject);
            }

            $extensionManager->getExtensionById(PicRegistry::REGISTRY_EXTENSION)->unsetConfig(PicRegistry::REGISTRY_ID);
            $this->setVersion('3.0.0');
        }

        $this->skip('3.0.0', '3.0.1');

        if($this->isVersion('3.0.1')) {
            //automatically enable all current installed portable elements
            $model = PortableModelRegistry::getRegistry()->getModel(PicModel::PIC_IDENTIFIER);
            $portableElementRegistry = $model->getRegistry();
            $registeredPortableElements = array_keys($portableElementRegistry->getLatestRuntimes());
            foreach($registeredPortableElements as $typeIdentifier){
                $portableElement = $portableElementRegistry->fetch($typeIdentifier);
                if (! $portableElement->hasEnabled()) {
                    $portableElement->enable();
                    $portableElementRegistry->update($portableElement);
                }
            }
            $this->setVersion('3.0.2');
        }

        $this->skip('3.0.2', '4.0.0');

        if($this->isVersion('4.0.0')) {
            call_user_func(new RegisterPicStudentToolbar(), ['0.4.0']);
            call_user_func(new RegisterPicStudentToolSample(), ['0.4.0']);
            $this->setVersion('4.1.0');
        }

        $this->skip('4.1.0', '5.0.0');

          if($this->isVersion('5.0.0')) {
            call_user_func(new RegisterPicStudentToolSample(), ['0.4.1']);
            $this->setVersion('5.0.1');
        }

        $this->skip('5.0.1', '5.3.0');
    }
1355288
public function withProtocolVersion($version)
    {
        Validator::checkProtocolVersion($version);
        $instance = clone $this;
        $instance->protocol = $version;

        return $instance;
    }
531511
private function getRemoteVersionInfo(Updater $updater)
    {
        $version = $this->getCurrentRemoteVersion($updater);
        if ($version === false) {
            throw new \RuntimeException('No remote versions found');
        }
        $versionInfo = $this->getAvailableVersions();
        if (!isset($versionInfo[$version])) {
            throw new \RuntimeException(sprintf('Failed to find manifest item for version %s', $version));
        }

        return $versionInfo[$version];
    }
1352948
public function updateVersion($contentId, $versionNo, UpdateStruct $struct)
    {
        try {
            return $this->innerGateway->updateVersion($contentId, $versionNo, $struct);
        } catch (DBALException $e) {
            throw new RuntimeException('Database error', 0, $e);
        } catch (PDOException $e) {
            throw new RuntimeException('Database error', 0, $e);
        }
    }
57710
public function set(string $version): VersionInterface
    {
        $matches = [];
        $numbers = [];

        if (preg_match($this->regex, $version, $matches)) {
            $numbers = $this->mapMatches($matches);
        }

        if (empty($numbers)) {
            return new Version('0');
        }

        $major = (array_key_exists('major', $numbers) ? $numbers['major'] : '0');
        $minor = (array_key_exists('minor', $numbers) ? $numbers['minor'] : '0');

        if (array_key_exists('micro', $numbers)) {
            $micro      = $numbers['micro'];
            $patch      = (array_key_exists('patch', $numbers) ? $numbers['patch'] : null);
            $micropatch = (array_key_exists('micropatch', $numbers) ? $numbers['micropatch'] : null);
        } else {
            $micro      = '0';
            $patch      = null;
            $micropatch = null;
        }

        $stability = (array_key_exists('stability', $numbers)) ? $numbers['stability'] : null;

        if (null === $stability || 0 === mb_strlen($stability)) {
            $stability = 'stable';
        }

        $stability = mb_strtolower($stability);
        switch ($stability) {
            case 'rc':
                $stability = 'RC';

                break;
            case 'patch':
            case 'pl':
            case 'p':
                $stability = 'patch';

                break;
            case 'beta':
            case 'b':
                $stability = 'beta';

                break;
            case 'alpha':
            case 'a':
                $stability = 'alpha';

                break;
            case 'dev':
            case 'd':
                $stability = 'dev';

                break;
        }

        $build = (array_key_exists('build', $numbers)) ? $numbers['build'] : null;

        return new Version($major, $minor, $micro, $patch, $micropatch, $stability, $build);
    }
45848
public function getOneVersion($versionNumber, $con = null)
    {
        return ChildDealerProductVersionQuery::create()
            ->filterByDealerProduct($this)
            ->filterByVersion($versionNumber)
            ->findOne($con);
    }
919070
public function update($initialVersion)
    {
        if ($this->isBetween('0.0.0', '1.1.3')) {
            throw new \common_exception_NotImplemented('Updates from versions prior to Tao 3.1 are not longer supported, please update to Tao 3.1 first');
        }

        $this->skip('1.1.3', '1.6.2');

        if ($this->isVersion('1.6.2')) {
            AclProxy::applyRule(new AccessRule('grant', TaoRoles::ANONYMOUS,
                ['ext'=>'taoCe', 'mod' => 'Main', 'act' => 'rootEntry']));

            $this->setVersion('1.7.0');
        }
        $this->skip('1.7.0', '1.7.1');

        // add guest login
        if ($this->isVersion('1.7.1')) {

            $entryPointService = $this->getServiceManager()->get(EntryPointService::SERVICE_ID);
            $entryPointService->addEntryPoint(new GuestAccess(), EntryPointService::OPTION_PRELOGIN);
            $this->getServiceManager()->register(EntryPointService::SERVICE_ID, $entryPointService);

            $this->setVersion('1.8.0');
        }

        $this->skip('1.8.0', '5.6.0');
    }
889429
public function getCurrentRemoteVersion(Updater $updater)
    {
        $releasesUrl = sprintf(
            self::URL_RELEASES,
            urlencode($this->repositoryOwner),
            urlencode($this->repositoryName)
        );
        $releasesJson = $this->getJsonResource($releasesUrl);
        $releases = json_decode($releasesJson, true);

        if (null === $releases || json_last_error() !== JSON_ERROR_NONE) {
            throw new JsonParsingException(sprintf('Error parsing JSON release data: %s', json_last_error_msg()));
        }

        $indexedReleases = array_combine(array_column($releases, 'tag_name'), $releases);
        $indexedPharReleases = array_filter(
            $indexedReleases,
            function (array $release) {
                if ($release['draft']) {
                    return false;
                }

                $pharAssets = array_filter(
                    $release['assets'],
                    function (array $asset) {
                        return $asset['name'] === $this->releasePharName;
                    }
                );
                $hasPharAsset = count($pharAssets) > 0;

                return $hasPharAsset;
            }
        );

        if (count($indexedPharReleases) === 0) {
            return false;
        }

        $tagNames = array_keys($indexedPharReleases);
        $versionParser = new VersionParser($tagNames);

        if ($this->allowUnstable) {
            $this->remoteVersion = $versionParser->getMostRecentAll();
        } else {
            $this->remoteVersion = $versionParser->getMostRecentStable();
        }

        if (!$this->remoteVersion) {
            return $this->remoteVersion;
        }

        $release = $indexedPharReleases[$this->remoteVersion];
        $pharAssets = array_filter(
            $release['assets'],
            function (array $asset) {
                return $asset['name'] === $this->releasePharName;
            }
        );

        $this->remoteUrl = $pharAssets[0]['url'];

        return $this->remoteVersion;
    }
1349691
public function getOneVersion($versionNumber, $con = null)
    {
        return ChildDealerContactVersionQuery::create()
            ->filterByDealerContact($this)
            ->filterByVersion($versionNumber)
            ->findOne($con);
    }
2050
public function updateLocationsContentVersionNo($contentId, $versionNo)
    {
        $query = $this->handler->createUpdateQuery();
        $query->update(
            $this->handler->quoteTable('ezcontentobject_tree')
        )->set(
            $this->handler->quoteColumn('contentobject_version'),
            $query->bindValue($versionNo, null, \PDO::PARAM_INT)
        )->where(
            $query->expr->eq(
                $this->handler->quoteColumn('contentobject_id'),
                $contentId
            )
        );
        $query->prepare()->execute();
    }
449431
public function getVersionToModify()
    {
        $u = new User();
        $vObj = $this->getVersionObject();
        if ($this->isMasterCollection() || ($vObj->isNew())) {
            return $this;
        } else {
            $nc = $this->cloneVersion(null);

            return $nc;
        }
    }
1103502
public function withVersion(int $version): self
    {
        $obj = clone $this;
        $obj->_version = $version;
        return $obj;
    }
946322
public function update(PluginBundleInterface $plugin, $currentVersion, $targetVersion)
    {
        $this->checkInstallationStatus($plugin, true);
        $this->validator->activeUpdateMode();
        $this->validatePlugin($plugin);
        $this->validator->deactivateUpdateMode();
        $this->log('Updating plugin configuration...');
        $this->baseInstaller->update($plugin, $currentVersion, $targetVersion);
        $this->recorder->update($plugin, $this->validator->getPluginConfiguration());
    }
577621
public function update($version = '', $forceFetching = true) : bool
    {
        $version = $version ?: $this->getVersionAvailable();

        if ($forceFetching) {
            $this->fetch($version);
        }

        $this->preUpdateArtisanCommands();
        $updateStatus = $this->sourceRepository->update($version);
        $this->postUpdateArtisanCommands();

        return $updateStatus;
    }
1052830
protected function setVersion($version) {
		$this->version = $version;

		$numbers = explode('.', $version);

		// Update Mayor and Minor-Version-Numbers
		$this->setMayor((int) $numbers[0]);
		$this->setMinor((int) $numbers[1]);
	}
1100248
public function getMigrationVersion($version)
    {
        if ($this->isVersionAvailable($version)) {
            if ($this->isVersionLoaded($version)) {
                $configuration = $this->loadedVersions[$version];
            } else {
                $configuration = $this->loadConfiguration($version);
                $this->loadedVersions[$version] = $configuration;
            }
            return $configuration;
        }
        throw new MigrationException('Specified version is not available.', 1345821746);
    }
547702
public function getOneVersion($versionNumber, $con = null)
    {
        return ChildSkillVersionQuery::create()
            ->filterBySkill($this)
            ->filterByVersion($versionNumber)
            ->findOne($con);
    }