Upgrade module

@param string $module
@param string $version
@param array $options
@throws \Exception
5731
public function upgrade($module, $version, array $options = null){
    
        /**
         * Fetch previous version for module
         */
        $oldVersion = $this->getModuleVersion($module);
        $oldVersion = new SoftwareVersion($oldVersion);
    
        if($oldVersion->isLt($version)){
            throw new \Exception('Unable to upgrade to '.$version.' (version '.$oldVersion.' is already installed)');
        }
    
        return $this->install($module, $version, $options);
    }
18648
private function execute($version = null, $message = null, $up = true)
    {
        $files = $this->migrationFiles->get($version, $up);
        if (null === $files) {
            return 0;
        }
        $this->schemaManipulation->execute('BEGIN');
        try {
            foreach ($files as $file) {

                require_once $file->getPath();

                $definition = $this->createMigrationApiInstance($file->getClassName());

                if ($message) {
                    $message($file->getName(), $file->getVersion());
                }
                if ($up) {
                    $definition->up();
                } else {
                    $definition->down();
                }
                foreach ($definition->getActions() as $action) {
                    if (!is_callable($action)) {
                        throw new \InvalidArgumentException('Migration must be callable');
                    }
                    $action = call_user_func_array($action, array());
                    if ($action instanceof MigrationApi) {
                        $action->execute();
                    }
                }
                $this->schemaTable->migrateToVersion($file->getVersion(), $up);
            }
            $this->schemaManipulation->execute('COMMIT');
        } catch (\Exception $e) {
            $this->schemaManipulation->execute('ROLLBACK');
            throw $e;
        }

        return count($files);
    }
1124902
public function update($filter, $update, array $options = [])
    {
        $this->ensureAllowedMethodCall(__METHOD__);

        if (isset($options['collation']) && !$this->server->supportsCollation()) {
            throw new UnsupportedException(
                'Option "collation" is not supported by the server.'
            );
        }

        if (null !== $this->listener) {
            $this->listener->beforeUpdate($filter, $update, $options);
        }

        $this->getWrappedBulk()->update($filter, $update, $options);
        $this->currentPosition += 1;
    }
93604
public function updateTransformation($transformation, $updates = array(), $options=array())
    {
        return $this->getApi()->update_transformation($transformation, $updates, $options);
    }
1118288
public function createVersion($project_key, $version, array $options = array())
	{
		$options = array_merge(
			array(
				'name' => $version,
				'description' => '',
				'project' => $project_key,
				// 'userReleaseDate' => '',
				// 'releaseDate' => '',
				'released' => false,
				'archived' => false,
			),
			$options
		);

		return $this->api(self::REQUEST_POST, '/rest/api/2/version', $options);
	}
1325710
public function addModule($module, array $options = NULL) {
		$this->add_to_list($module, new $module($this->server, $this, $options));
    }
172223
public function isPrestashopVersionSupported($version)
    {
        if (version_compare($version, self::PS_COMPATIBLE_VERSION_MIN, '>=') === false ||
            version_compare($version, self::PS_COMPATIBLE_VERSION_MAX, '<=') === false
        ) {
            $exception = 'This library is not compatible with this version of PrestaShop. ';
            $exception.= 'Please upgrade/downgrade this library';
            throw new PrestashopWebServiceException($exception);
        }
    }
928014
public static function parse($version, $options = array())
    {
        $options = array_merge(array(
            'removeWildcard' => true
        ), $options);

        // extract meta data
        $vers = explode('+', $version, 2);
        $metadata = '';
        if (count($vers) > 1) {
            $metadata = $vers[1];
        }
        $version = $vers[0];

        // extract secondary version
        $allVersions = preg_split('/(-|:)([0-9]+|\*)($|\.|-)/', $version, 2, PREG_SPLIT_DELIM_CAPTURE);
        $version = $allVersions[0];
        if (count($allVersions) > 1 && $allVersions[1] != '') {
            if ($allVersions[2] == '*' && $options['removeWildcard']) {
                $secondaryVersion = null;
                $secondaryVersionSeparator = '-';
            }
            else {
                $secondaryVersion = self::parse($allVersions[2].$allVersions[3].$allVersions[4], $options);
                $secondaryVersionSeparator = $allVersions[1];
            }
        }
        else {
            $secondaryVersion = null;
            $secondaryVersionSeparator = '-';
        }

        // extract stability part
        $vers = explode('-', $version, 2);
        $stabilityVersion = array();
        if (count($vers) > 1) {
            $stabilityVersion = explode('.', $vers[1]);
        }

        // extract version parts
        $vers = explode('.', $vers[0]);
        foreach ($vers as $k => $number) {
            if (!is_numeric($number)) {
                if (preg_match('/^([0-9]+)(.*)$/', $number, $m)) {
                    $vers[$k] = $m[1];
                    $stabilityVersion = array_merge(
                                            array($m[2]),
                                            array_slice($vers, $k + 1),
                                            $stabilityVersion
                                        );
                    $vers = array_slice($vers, 0, $k + 1);
                    break;
                } elseif ($number == '*') {
                    $vers = array_slice($vers, 0, $k);
                    if (!$options['removeWildcard']) {
                        $vers[$k] = '*';
                    }
                    break;
                } else {
                    throw new \Exception('Bad version syntax');
                }
            } else {
                $vers[$k] = intval($number);
            }
        }

        $stab = array();
        foreach ($stabilityVersion as $k => $part) {
            if (preg_match('/^[a-z]+$/', $part)) {
                $stab[] = self::normalizeStability($part);
            } elseif (preg_match('/^[0-9]+$/', $part)) {
                $stab[] = $part;
            } else {
                $m = preg_split('/([0-9]+)/', $part, -1, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE);
                foreach ($m as $p) {
                    $stab[] = self::normalizeStability($p);
                }
            }
        }

        if (count($stab) == 0 && $secondaryVersion && !$options['removeWildcard']) {
            if ($secondaryVersion->getMajor() == '*' && $secondaryVersionSeparator == '-') {
                $secondaryVersion = null;
                $stab = array('*');
            }
        }

        return new Version($vers, $stab, $metadata, $secondaryVersion, $secondaryVersionSeparator);
    }
439960
public function update(PluginBundleInterface $plugin, $currentVersion, $targetVersion)
    {
        $this->checkInstallationStatus($plugin, true);

        $this->baseInstaller->update($plugin, $currentVersion, $targetVersion);

        // updates plugin version
        $this->versionManager->setLogger($this->logger);
        $version = $this->versionManager->register($plugin);
        $this->versionManager->execute($version);
    }
138170
public function update(array $options = array())
    {
        $module = $this->utils()->whichModule($this);
        return $this->utils()->update($module, $options);
    }
369789
public function update($module)
    {
        $module = $this->module->findOrFail($module);

        chdir(base_path());

        $this->installRequires($module);
        $this->installDevRequires($module);
        $this->copyScriptsToMainComposerJson($module);
    }
1365191
public function updateVersion($version_id, array $params = array())
	{
		return $this->api(self::REQUEST_PUT, sprintf('/rest/api/2/version/%d', $version_id), $params);
	}
771772
public void upgradeTo(String version) throws Exception
    {
    	String installedVersion = systemInfo.getGpVersion();
    	if(!installedVersion.equals(version))
    	{
    		ServerVersionUpgrader upgrader = versionUpgrader(installedVersion, version);
    		upgrader.upgrade(sessionService);
    		
    		String newInstalledVersion = upgrader.upgradedTo() != null ? upgrader.upgradedTo() : version;
    		systemInfo.setGpVersion(newInstalledVersion);
			upgradeTo(version);
    	}
    	
		systDao.store(systemInfo);
    }
389336
public static function can_upgrade_assignment($type, $version) {
        $assignment = new assign(null, null, null);
        return $assignment->can_upgrade($type, $version);
    }
1218397
protected function setVersion($version) {
    if ($version == self::V3 || $version == self::V4 || $version == self::V5) {
      $this->version = $version;
    }
    else {
      throw new Exception('An invalid UUID version was specified.');
    }
  }
1357718
public function run(string $module, array $options = []) : int
    {
        $mc = new ModuleConfig(ConfigType::MENUS(), $module, null, ['cacheSkip' => true]);

        $schema = $mc->createSchema(['lint' => true]);
        $mc->setParser(new Parser($schema, ['lint' => true, 'validate' => true]));

        try {
            $mc->parse();
        } catch (InvalidArgumentException $e) {
            // We need errors and warnings irrelevant of the exception
            $this->errors = array_merge($this->errors, $mc->getErrors());
        }
        $this->warnings = array_merge($this->warnings, $mc->getWarnings());

        return count($this->errors);
    }
1355852
public function update($module)
    {
        $module = $this->module->findOrFail($module);

        $packages = $module->get('require', []);

        chdir(base_path());

        foreach ($packages as $name => $version) {
            $package = "\"{$name}:{$version}\"";

            $this->run("composer require {$package}");
        }
    }