Checks if an update is available and applicable for the current installation.

@since Symphony 2.3.1
@return boolean
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;
    }
289371
public function isEnabled()
    {
        $isEnabled = (bool) Config::getInstance()->General['enable_update_communication'];

        if($isEnabled === true && SettingsPiwik::isInternetEnabled() === true){
            return true;
        }
        
        return false;
    }
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;
	}
989300
public static function check_composer_updates() {
	$composer_json  = file_get_contents(ROOT_DIR.'/composer.json');
	$composer_json = json_decode($composer_json, true);
	if (empty($composer_json['require'])) {
		$exception = bootstrap::get_library('exception');
		throw new $exception('there are no required packages to check');
	}
	
	$composer_lock = file_get_contents(ROOT_DIR.'/composer.lock');
	$composer_lock = json_decode($composer_lock, true);
	if (empty($composer_lock['packages'])) {
		$exception = bootstrap::get_library('exception');
		throw new $exception('lock file is missing its packages');
	}
	
	$composer_executable = 'composer';
	if (file_exists(ROOT_DIR.'composer.phar')) {
		$composer_executable = 'php composer.phar';
	}
	
	$required_packages  = $composer_json['require'];
	$installed_packages = $composer_lock['packages'];
	$update_packages    = [];
	
	foreach ($installed_packages as $installed_package) {
		$package_name      = $installed_package['name'];
		$installed_version = preg_replace('/v([0-9].*)/', '$1', $installed_package['version']);
		$version_regex     = '/versions\s*:.+v?([0-9]+\.[0-9]+(\.[0-9]+)?)(,|$)/U';
		
		// skip dependencies of dependencies
		if (empty($required_packages[$package_name])) {
			continue;
		}
		
		// check commit hash for dev-* versions
		if (strpos($installed_version, 'dev-') === 0) {
			$installed_version = $installed_package['source']['reference'];
			$version_regex     = '/source\s*:.+ ([a-f0-9]{40})$/m';
		}
		
		// find out the newest release
		$package_info = shell_exec($composer_executable.' show -a '.escapeshellarg($package_name));
		preg_match($version_regex, $package_info, $possible_version);
		if (empty($possible_version)) {
			$exception = bootstrap::get_library('exception');
			throw new $exception('can not find out newest release for '.$package_name);
		}
		
		if (ENVIRONMENT == 'development') {
			echo 'installed '.$package_name.' at '.$installed_version.', possible version is '.$possible_version[1].PHP_EOL;
		}
		
		if ($possible_version[1] == $installed_version) {
			continue;
		}
		
		$update_packages[$package_name] = [
			'required'  => $required_packages[$package_name],
			'installed' => $installed_version,
			'possible'  => $possible_version[1],
		];
	}
	
	return $update_packages;
}
1054508
public function checkExtensionsForUpdates()
    {
        $extensions = Symphony::ExtensionManager()->listInstalledHandles();

        if (is_array($extensions) && !empty($extensions)) {
            foreach ($extensions as $name) {
                $about = Symphony::ExtensionManager()->about($name);

                if (array_key_exists('status', $about) && in_array(EXTENSION_REQUIRES_UPDATE, $about['status'])) {
                    $this->Page->pageAlert(
                        __('An extension requires updating.') . ' <a href="' . SYMPHONY_URL . '/system/extensions/">' . __('View extensions') . '</a>'
                    );
                    break;
                }
            }
        }
    }
1256017
private function hasUnmigratedVersions()
    {
        $needsToRun = false;

        foreach ($this->availableVersions as $migration) {
            $isTargetMigrated = in_array($migration->getVersion(), $this->migratedVersions);

            if ($isTargetMigrated) {
                continue;
            }

            $needsToRun = true;
            break;
        }

        return $needsToRun;
    }
1197613
public static function canBeEnabled()
    {
        $isEnabled = (bool) Config::getInstance()->General['enable_update_communication'];
        if($isEnabled === true && Marketplace::isMarketplaceEnabled() === true && SettingsPiwik::isInternetEnabled() === true){
            return true;
        }
        
        return false;
    }
1087344
public function getAvailable()
    {
        if (!$this->getAvailableFrom() && !$this->getAvailableTill()) {
            return false;
        } elseif ($this->validateDate() && $this->validateAvailability()) {
            return true;
        }

        return false;
    }
809494
public static function isEnabled()
    {
        $app = Facade::getFacadeApplication();
        $cache = $app->make('cache/request');
        $item = $cache->getItem('multilingual/enabled');
        if (!$item->isMiss()) {
            return $item->get();
        }

        $item->lock();
        $result = false;
        if ($app->isInstalled()) {
            $site = $app->make('site')->getSite();
            if (count($site->getLocales()) > 1) {
                $result = true;
            }
        }

        $cache->save($item->set($result));

        return $result;
    }
172411
public function canAccess()
    {
        if (!$this->app->make('config')->get('concrete.updates.enable_permissions_protection')) {
            return true; // we have turned this off temporarily which means anyone even non-logged-in users can run update.
        }

        $p = new Checker();

        return $p->canUpgrade();
    }
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;
    }
1322064
public boolean needUpdate() {

        String pool = "default";

        double currentVersion = 8.5;
        m_detectedVersion = 8.5;

        CmsSetupDb setupDb = new CmsSetupDb(null);

        try {
            setupDb.setConnection(
                getDbDriver(pool),
                getDbUrl(pool),
                getDbParams(pool),
                getDbUser(pool),
                m_dbPools.get(pool).get("pwd"));

            if (!setupDb.hasTableOrColumn("CMS_USERS", "USER_OU")) {
                m_detectedVersion = 6;
            } else if (!setupDb.hasTableOrColumn("CMS_ONLINE_URLNAME_MAPPINGS", null)) {
                m_detectedVersion = 7;
            } else if (!setupDb.hasTableOrColumn("CMS_USER_PUBLISH_LIST", null)) {
                m_detectedVersion = 8;
            }
        } finally {
            setupDb.closeConnection();
        }

        return currentVersion != m_detectedVersion;
    }
1015767
public function hasManifest()
    {
        $server = $this->releasesManager->getCurrentReleasePath($this->manifest);
        $server = $this->bash->fileExists($server);

        $local = $this->getManifestPath();
        $local = $this->files->has($local);

        return $local || $server;
    }
358852
public function isAvailable()
    {
        return \file_exists($this->cacheDir) && \is_dir($this->cacheDir) && \is_writable($this->cacheDir);
    }
1156090
private function mayInstall()
    {
        $destinationDir = $this->file->get(self::SETTING_DESTINATION_DIR) . DIRECTORY_SEPARATOR;

        return !(file_exists($destinationDir . 'composer.json'));
    }
36585
public function isApprovable() {

		return $this->status == IApproval::STATUS_SUBMITTED || $this->status == IApproval::STATUS_FROJEN ||
			$this->status == IApproval::STATUS_UPLIFT_FREEZE || $this->status == IApproval::STATUS_BLOCKED ||
			$this->status == IApproval::STATUS_UPLIFT_BLOCK;
	}
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);
    }