Attempts to update Composer.

Returns true if Composer was updated, false if not.

@return bool
@throws ComposerException
333433
public function selfUpdate()
    {
        $beforeVersion = $this->getVersion();

        $process = $this->getProcess();
        $processCommand = trim($this->findComposer() . ' self-update');
        $process->setCommandLine($processCommand);
        $this->log->info('Running Composer command', ['command' => $processCommand]);
        $process->run();

        if ($process->isSuccessful() == false) {
            $composerError = remove_ansi($process->getErrorOutput());
            $this->log->error('Composer self update process failure', ['composer' => $composerError]);
            throw new ComposerException('There was an error updating Composer');
        }

        $afterVersion = $this->getVersion();

        if ($beforeVersion == $afterVersion) {
            return false;
        }

        return true;
    }
1170607
private function updateVersionNumber()
    {
        $dados = json_decode(file_get_contents(PATH_HOME . "_config/config.json"), true);
        $dados['version'] += 0.01;
        Config::createConfig($dados);

        Helper::createFolderIfNoExist(PATH_HOME . "_config/updates");
        $f = fopen(PATH_HOME . "_config/updates/version.txt", "w+");
        fwrite($f, file_get_contents(PATH_HOME . "composer.lock"));
        fclose($f);
    }
663451
public function is_installed_and_upgraded() {
        if (!$this->rootdir) {
            return false;
        }
        if ($this->versiondb === null and $this->versiondisk === null) {
            // There is no version.php or version info inside it.
            return false;
        }

        return ((float)$this->versiondb === (float)$this->versiondisk);
    }
878087
function () {
  var composerLockPath = path.resolve(process.cwd(), 'composer.lock');
  var composerJsonPath = path.resolve(process.cwd(), 'composer.json');

  if (isUsingComposerLock === null) {
    if (fs.existsSync(composerLockPath)) {
      logger.logInfo('[composer] using composer.lock instead of composer.json');
      isUsingComposerLock = true;
    }  else {
      isUsingComposerLock = false;
    }
  }

  return isUsingComposerLock ? composerLockPath : composerJsonPath;
}
1210761
protected function is_updated() {

		if ( $this->is_active() && isset( $this->plugin[ $this->slug ]['last-update'] ) ) {

			$interval    = Plugin::WP_Plugin_Info()->getOption( 'interval' );
			$last_update = $this->plugin[ $this->slug ]['last-update'];

			if ( ( time() - $last_update ) < $interval ) {
				return true;
			}
		}

		return false;
	}
1031179
def did_composer_install(dir):
    '''
    
    '''
    lockFile = "{0}/vendor".format(dir)
    if os.path.exists(lockFile):
        return True
    return False
561534
protected function performUpdate()
    {
        $params = $this->setKeysForSave();

        // If the updating event returns false, we will cancel the update operation so
        // developers can hook Validation systems into their models and cancel this
        // operation if the model does not pass validation. Otherwise, we update.
        if ($this->fireModelEvent('updating') === false) {
            return false;
        }

        // Send updates
        $results = $this->makeRequest($this->getEndpoint(), 'update', [
            $this->getKey(),
            $params
        ]);

        if ($results) {
            // Update model with new data
            $this->fill($results);

            $this->fireModelEvent('updated', false);
        }

        return true;
    }
1058
public static function isUpgradeAvailable()
    {
        if (self::isInstallerAvailable()) {
            $migration_version = self::getMigrationVersion();
            $current_version = Symphony::Configuration()->get('version', 'symphony');

            return version_compare($current_version, $migration_version, '<');
        }

        return false;
    }
961132
public function update()
    {
        /** @var \Bolt\Filesystem\Handler\JsonFile $jsonFile */
        $jsonFile = $this->app['filesystem']->get('extensions://composer.json', new JsonFile());

        if (!$jsonFile->exists()) {
            try {
                $this->init('extensions://composer.json');
            } catch (IOException $e) {
                $this->messages[] = Trans::__('page.extend.error-composer-json-not-readable');

                $this->app['extend.writeable'] = false;
                $this->app['extend.online'] = false;

                return null;
            }
        }

        $json = $jsonOrig = $jsonFile->parse();

        // Workaround Bolt 2.0 installs with "require": []
        if (isset($json['require']) && empty($json['require'])) {
            unset($json['require']);
        }

        $json = $this->setJsonDefaults($json);

        // Write out the file, but only if it's actually changed, and if it's writable.
        if ($json != $jsonOrig) {
            try {
                $jsonFile->dump($json);
            } catch (IOException $e) {
                $this->messages[] = Trans::__('page.extend.error-composer-json-not-writable');
            }
        }

        return $json;
    }
435324
public function update(\Composer\Repository\InstalledRepositoryInterface $repo, \Composer\Package\PackageInterface $initial, 
			\Composer\Package\PackageInterface $target) {
		if (!$this->needsUpdate($initial)) {
			//add the new version of the module to the composer.lock
			$repo->removePackage($initial);
			if (!$repo->hasPackage($target)) {
				$repo->addPackage(clone $target);
			}
			return;
		}
				
    	$this->moveBackResources($initial);
				
		parent::update($repo, $initial, $target);
		
		$this->removeResources($target);
		$this->installResources($target);
	}
352474
function () {
  var version = 'UnknownComposer';
  var versionString = shell.exec('composer --version', {silent: true}).output;
  // Example below:
  //    Composer version 1.0.0-alpha9 2014-12-07 17:15:20
  var versionRegex = /Composer version (\S+)/;
  var result = versionRegex.exec(versionString);
  if (result !== null) {
    version = result[1];
  } else {
    logger.logInfo('Could not find composer version from version string: ' + versionString);
  }
  return version;
}
1301259
protected function prepareExecute()
    {
        if (class_exists(ComposerInformation::class)) {
            $this->version = ComposerInformation::getInstalledVersion('windwalker/core');
        }

        if ($this->getRootCommand()->getOption('n')) {
            IOFactory::getIO()->setInput(new NullInput());
        }
    }
261655
public function updatePackageDependencies($options = [])
    {
        $process = $this->getProcess();

        $processCommand = trim($this->findComposer() . ' update ' .
                               $this->prepareOptions($options, ['--no-progress', '--no-ansi']));

        $process->setCommandLine($processCommand);

        chdir($this->workingPath);
        $this->log->info('Changing working directory for Composer update', ['directory' => $this->workingPath]);
        $this->log->info('Running Composer command', ['command' => $processCommand]);
        $process->run();

        if ($process->isSuccessful() == false) {
            $this->restoreWorkingDirectory();
            $composerError = $process->getErrorOutput();

            $this->log->error('Composer update process failure', ['composer' => $composerError]);

            throw new PackageInstallationException($process->getErrorOutput(),
                "There was an error updating the dependencies." . PHP_EOL .
                'Composer is reporting the following error(s):' . PHP_EOL . '--> ' . $composerError);
        }

        $this->restoreWorkingDirectory();
        $this->log->info('Package template dependencies updated', ['directory' => $this->workingPath]);
        return true;
    }
1022125
public function isValid(SignatureComposer $composer)
    {
        // Constant Time String Comparison @see http://php.net/hash_equals
        if (!function_exists('hash_equals')) {
            // Polyfill for PHP < 5.6
            return Security::hashEquals($composer->compose($this->parameters), $this->signature);
        } else {
            return hash_equals($composer->compose($this->parameters), $this->signature);
        }
    }
991974
public function update()
	{
		$db = \App::get('db');

		if (empty($db))
		{
			return false;
		}

		if (!is_numeric($this->gidNumber))
		{
			return false;
		}

		if (empty($this->_updatedkeys))
		{
			return true;
		}

		$query = "UPDATE `#__xgroups` SET ";

		$classvars = get_class_vars(__CLASS__);

		$first = true;
		$affected = 0;

		foreach ($classvars as $property => $value)
		{
			if (($property{0} == '_') || in_array($property, self::$_list_keys))
			{
				continue;
			}

			if (!in_array($property, $this->_updatedkeys))
			{
				continue;
			}

			if (!$first)
			{
				$query .= ',';
			}
			else
			{
				$first = false;
			}

			$value = $this->$property;

			if ($value === null)
			{
				$query .= "`$property`=NULL";
			}
			else
			{
				$query .= "`$property`=" . $db->quote($value);
			}
		}

		$query .= " WHERE `gidNumber`=" . $db->quote($this->gidNumber) . ";";

		if (($first != true) && !empty($query))
		{
			$db->setQuery($query);

			$result = $db->query();

			if ($result === false)
			{
				return false;
			}

			$affected = $db->getAffectedRows();
		}

		$aNewUserGroupEnrollments = array();

		foreach (self::$_list_keys as $property)
		{
			if (!in_array($property, $this->_updatedkeys))
			{
				continue;
			}

			$aux_table = "#__xgroups_" . $property;

			$list = $this->$property;

			if (!is_null($list) && !is_array($list))
			{
				$list = array($list);
			}

			$ulist = null;
			$tlist = null;

			foreach ($list as $value)
			{
				if (!is_null($ulist))
				{
					$ulist .= ',';
					$tlist .= ',';
				}

				$ulist .= $db->quote($value);
				$tlist .= '(' . $db->quote($this->gidNumber) . ',' . $db->quote($value) . ')';
			}

			// @FIXME: I don't have a better solution yet. But the next refactoring of this class
			// should eliminate the ability to read the entire member table due to problems with
			// scale on a large (thousands of members) groups. The add function should track the members
			// being added to a group, but would need to be verified to handle adding members
			// already in group. *njk*

			// @FIXME: Not neat, but because all group membership is resaved every time even for single additions
			// there is no nice way to detect only *new* additions without this check. I don't want to
			// fire off an 'onUserGroupEnrollment' event for users unless they are really being enrolled. *drb*

			if (in_array($property, array('members', 'managers')))
			{
				$query = "SELECT uidNumber FROM `#__xgroups_members` WHERE gidNumber=" . $this->gidNumber;
				$db->setQuery($query);

				// compile current list of members in this group
				$aExistingUserMembership = array();

				if (($results = $db->loadAssoc()))
				{
					foreach ($results as $uid)
					{
						$aExistingUserMembership[] = $uid;
					}
				}

				// see who is new, merge with previous additions so we have a complete list after we are done
				$aNewUserGroupEnrollments = array_merge($aNewUserGroupEnrollments, array_diff($list, $aExistingUserMembership));

			}

			if (is_array($list) && count($list) > 0)
			{
				if (in_array($property, array('members', 'managers', 'applicants', 'invitees')))
				{
					$query = "REPLACE INTO $aux_table (gidNumber,uidNumber) VALUES $tlist;";
				}

				$db->setQuery($query);

				if ($db->query())
				{
					$affected += $db->getAffectedRows();
				}
			}

			if (!is_array($list) || count($list) == 0)
			{
				if (in_array($property, array('members', 'managers', 'applicants', 'invitees')))
				{
					$query = "DELETE FROM $aux_table WHERE gidNumber=" . $db->quote($this->gidNumber) . ";";
				}
			}
			else
			{
				if (in_array($property, array('members', 'managers', 'applicants', 'invitees')))
				{
					$query = "DELETE m FROM `#__xgroups_$property` AS m WHERE " . " m.gidNumber=" .
						$db->quote($this->gidNumber) . " AND m.uidNumber NOT IN (" . $ulist . ");";
				}
			}

			$db->setQuery($query);

			if ($db->query())
			{
				$affected += $db->getAffectedRows();
			}
		}

		// After SQL is done and has no errors, fire off onGroupUserEnrolledEvents
		// for every user added to this group
		foreach ($aNewUserGroupEnrollments as $userid)
		{
			\Event::trigger('groups.onGroupUserEnrollment', array($this->gidNumber, $userid));
		}

		if ($affected > 0)
		{
			\Event::trigger('user.onAfterStoreGroup', array($this));
		}

		return true;
	}
1142736
private function checkComposer()
    {
        $composerJsonDetected = false;
        $composerLockDetected = false;
        foreach (GitUtils::extractCommitedFiles() as $file) {
            if ($file === 'composer.json') {
                $composerJsonDetected = true;
            }
            if ($file === 'composer.lock') {
                $composerLockDetected = true;
            }
        }
        if ($composerJsonDetected && !$composerLockDetected) {
            $this->output->writeln(
                '<bg=yellow;fg=black>
                 composer.lock must be commited if composer.json is modified!
                 </bg=yellow;fg=black>'
            );
        }
    }
1025476
public function updateFromComposerInfo()
    {
        $this->launchPreInstallActions();
        $operations = $this->operationExecutor->buildOperationList();
        $this->operationExecutor->execute($operations);
    }