public function addUpdateCheck()
{
if (c('Garden.NoUpdateCheck')) {
return;
}
// Check to see if the application needs to phone-home for updates. Doing
// this here because this method is always called when admin pages are
// loaded regardless of the application loading them.
$UpdateCheckDate = Gdn::config('Garden.UpdateCheckDate', '');
if ($UpdateCheckDate == '' || !IsTimestamp($UpdateCheckDate) || $UpdateCheckDate < strtotime("-1 day")) {
$UpdateData = array();
// Grab all of the available addons & versions.
foreach ([Addon::TYPE_ADDON, Addon::TYPE_THEME] as $type) {
$addons = Gdn::addonManager()->lookupAllByType($type);
/* @var Addon $addon */
foreach ($addons as $addon) {
$UpdateData[] = ['Name' => $addon->getRawKey(), 'Version' => $addon->getVersion(), 'Type' => $addon->getSpecial('oldType', $type)];
}
}
// Dump the entire set of information into the definition list. The client will ping the server for updates.
$this->addDefinition('UpdateChecks', $UpdateData);
}
}