Check for updates

@return array|bool Either the update data or false in case of failure.
512247
function check_for_update() {
		$update_data = get_transient( $this->product_key );

		if ( false === $update_data ) {
			$failed      = false;
			$update_data = $this->get_version_data();
			if ( empty( $update_data ) ) {
				$failed = true;
			}
			// If the response failed, try again in 30 minutes.
			if ( $failed ) {
				$data              = new \stdClass();
				$data->new_version = $this->product->get_version();
				set_transient( $this->product_key, $data, 30 * MINUTE_IN_SECONDS );

				return false;
			}
			$update_data->sections = maybe_unserialize( $update_data->sections );

			set_transient( $this->product_key, $update_data, 12 * HOUR_IN_SECONDS );
		}
		if ( ! isset( $update_data->new_version ) ) {
			return false;
		}
		if ( version_compare( $this->product->get_version(), $update_data->new_version, '>=' ) ) {
			return false;
		}

		return (array) $update_data;
	}
917795
public function update()
    {
        $conditions = $this->infosMergeds['fields_and_values'];

        $this->sql = new PhiberQueryWriter("update", [
            "table"  => $this->table,
            "fields" => $this->fields,
            "values" => $this->fieldsValues,
            "where"  => isset($this->infosMergeds['where']) ?
                $this->infosMergeds['where'] :
                null,
            "limit"  => isset($this->infosMergeds['limit']) ?
                $this->infosMergeds['limit'] :
                null,
            "offset"  => isset($this->infosMergeds['offset']) ?
                $this->infosMergeds['offset'] :
                null
        ]);

        if ($this->phiberConfig->verifyExecuteQueries()) {

            $this->PDO = $this->PDO->prepare($this->sql);
            for ($i = 0; $i < count($this->fields); $i++) {
                if (!empty($this->fieldsValues[$i])) {
                    $this->PDO->bindValue($this->fields[$i], $this->fieldsValues[$i]);
                }
            }

            while (current($conditions)) {
                $this->PDO->bindValue(
                    "condition_" . key($conditions), 
                    $conditions[key($conditions)]
                );
                
                next($conditions);
            }

            if ($this->PDO->execute()) {
                return true;
            }
        }

        return false;
    }
631787
public function check()
    {
        $this->loadDatabase();

        $current = $this->getCurrentUptime();

        $this->persist($current);

        $rebooted =
            ($cs = $this->uptimeInSeconds($current)) <
            ($ss = $this->uptimeInSeconds($this->database));

        return $this->makeResult(
            ! $rebooted,
            $this->makeMessage($current, $this->database)
        );
    }
551110
public function update()
    {
        $inputs = Input::all();
        $s      = $this->request->session();
        $route  = uri();

        $session = $s->get($route, []);
        if (empty($session)) {
            return false;
        }
        if (is_null($column = array_get($inputs, 'column'))) {
            return false;
        }
        if (!isset($session[$column]['values'])) {
            return false;
        }

        $old        = !is_null($serialized = array_get($inputs, 'serialized')) ? unserialize($serialized) : array_get($inputs, 'old');
        $new        = array_get($inputs, 'new');
        $index      = array_search($old, $session[$column]['values']);
        if ($index !== false) {
            unset($session[$column]['values'][$index]);
        }
        $session[$column]['values'][] = $new;

        $sidebars = $this->adapter->getDeleteSidebarItem($column, $session[$column], $new);
        if (!empty($sidebars)) {
            $s->put($route, [$column => $session[$column]]);
            $s->save();
            return response(implode('', $sidebars), 200);
        }
    }
805273
public function countUpdates()
    {
        $count = 0;

        $count += count($this->getUpdatablePlugins());
        $count += count($this->getUpdatableThemes());

        return $count;
    }
829422
def _check_if_all_updated(self):
        """"""
        for g in self.toc.toc:
            if g not in self.values:
                return False
            for n in self.toc.toc[g]:
                if n not in self.values[g]:
                    return False

        return True
361420
public function check()
	{
		// Is data valid?
		if (!$this->_tbl->check())
		{
			$this->_errors = $this->_tbl->getErrors();
			return false;
		}
		return true;
	}
1254054
public function touch(): bool
	{
		if($this->isPersisted)
		{
			$this->columns[$this->getUpdatedAtColumn()] = null;

			return $this->save();
		}

		return false;
	}
726711
public function update_version()
    {
        $option = $this->slug . '_version';
        $old_version = get_option( $option );

        if ( false === $old_version ||
            version_compare( $old_version, $this->version, '<' ) ) {
            return update_option( $option, $this->version );
        }

        return true;
    }
732812
protected function _check() {
		$result = true;
		$this->out(__d('cake_installer', 'Checking PHP version'));
		$this->hr();
		$phpVesion = $this->InstallerCheck->checkPHPversion();
		if ($phpVesion !== null) {
			if ($phpVesion) {
				$state = '<success>' . __d('cake_installer', 'Ok') . '</success>';
			} else {
				$state = '<error>' . __d('cake_installer', 'Bad') . '</error>';
				$result = false;
			}
			$state = '[' . $state . ']';

			$message = ' * ' . __d('cake_installer', 'Current PHP version: %s', PHP_VERSION);
			$formattedMessage = $this->state->getState($message, $state, $this->maxWidth - 1);
		} else {
			$formattedMessage = __d('cake_installer', 'Ok');
		}
		$this->out($formattedMessage, 1);
		$this->hr();
		$this->nl(1);

		$this->out(__d('cake_installer', 'Checking PHP extensions'));
		$this->hr();
		$phpModules = $this->InstallerCheck->checkPhpExtensions();
		if ($phpModules !== null) {
			$result = true;
			$messages = [];
			$this->waiting->animateMessage();
			foreach ($phpModules as $moduleName => $moduleState) {
				switch ($moduleState) {
					case 2:
						$state = '<success>' . __d('cake_installer', 'Ok') . '</success>';
						break;
					case 1:
						$state = '<warning>' . __d('cake_installer', 'Ok') . '</warning>';
						break;
					default:
						$state = '<error>' . __d('cake_installer', 'Bad') . '</error>';
						$result = false;
				}
				$state = '[' . $state . ']';
				$message = ' * ' . __d('cake_installer', 'Checking module is loaded: \'%s\'', $moduleName);
				$messages[] = $this->state->getState($message, $state, $this->maxWidth - 1);
				$this->waiting->animateMessage();
			}
			$this->waiting->hideMessage();
		} else {
			$messages = __d('cake_installer', 'Ok');
		}
		$this->out($messages, 1);
		$this->hr();
		$this->nl(1);
		if ($result) {
			$this->out('<success>' . __d('cake_installer', 'Check completed successfully.') . '</success>');
		} else {
			$this->out('<error>' . __d('cake_installer', 'Check completed unsuccessfully.') . '</error>');
		}

		return $result;
	}
656950
public function update()
    {
        if ($this->newVersionAvailable === false
        || (!is_bool($this->newVersionAvailable) && !$this->hasUpdate())) {
            return false;
        }
        $this->backupPhar();
        $this->downloadPhar();
        $this->replacePhar();
        return true;
    }
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;
	}
24947
public function actionUpdate()
    {
        $result = ['error' => Yii::t('podium/view', 'Error')];

        if (Yii::$app->request->isPost) {
            $result = (new Update())->nextStep();
        }
        return Json::encode($result);
    }
800279
public function getUpdate()
    {
        $update = [];

        foreach ($this->update as $field => $data) {
            list($type, $value) = $data;

            if (! isset($update[$type])) {
                $update[$type] = [];
            }

            $update[$type][$field] = $value;
        }

        if ($this->atomic) {
            $update['$atomic'] = 1;
        }

        return $update;
    }
854649
protected function _canUpdate()
    {
        $myConfig = \OxidEsales\Eshop\Core\Registry::getConfig();

        $blIsMallAdmin = \OxidEsales\Eshop\Core\Registry::getSession()->getVariable('malladmin');
        if (!$blIsMallAdmin) {
            return false;
        }

        if ($myConfig->isDemoShop()) {
            return false;
        }

        return true;
    }
991462
public function check($force = false)
    {
        /*
         * Already know about updates, never retry.
         */
        $oldCount = Parameter::get('system::update.count');
        if ($oldCount > 0) {
            return $oldCount;
        }

        /*
         * Retry period not passed, skipping.
         */
        if (!$force
            && ($retryTimestamp = Parameter::get('system::update.retry'))
            && Carbon::createFromTimeStamp($retryTimestamp)->isFuture()
        ) {
            return $oldCount;
        }

        try {
            $result = $this->requestUpdateList();
            $newCount = array_get($result, 'update', 0);
        }
        catch (Exception $ex) {
            $newCount = 0;
        }

        /*
         * Remember update count, set retry date
         */
        Parameter::set('system::update.count', $newCount);
        Parameter::set('system::update.retry', Carbon::now()->addHours(24)->timestamp);

        return $newCount;
    }
831433
public function checkHas() {
        /* @var $model Record */
        $model = get_called_class();
        $model = $model::get($this->getPk());
        if ($model) {
            $this->isUpdate(true);
            return true;
        }
        return false;
    }