本文整理汇总了PHP中Update::check方法的典型用法代码示例。如果您正苦于以下问题:PHP Update::check方法的具体用法?PHP Update::check怎么用?PHP Update::check使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Update
的用法示例。
在下文中一共展示了Update::check方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: cron
/**
* Endpoint for the update-check cronjob.
* Loads beacons, checks for updates from hp.o, and saves any updates to the DB.
*
* @param null $cronjob Unused. The CronJob object being executed when being run as cron.
* @return boolean True on successful check, false on any failure (so cron runs again).
*/
public static function cron($cronjob = null)
{
// register the beacons
self::register_beacons();
// save the list of beacons we are using to check with
Options::set('updates_beacons', self::instance()->beacons);
try {
// run the check
$updates = Update::check();
// save the list of updates
Options::set('updates_available', $updates);
EventLog::log(_t('Updates check CronJob completed successfully.'), 'info', 'update', 'habari');
// return true, we succeeded
return true;
} catch (\Exception $e) {
// catch any exceptions generated by RemoteRequest or XML parsing
EventLog::log(_t('Updates check CronJob failed!'), 'err', 'update', 'habari', $e->getMessage());
// tell cron the check failed
return false;
}
}
示例2: get_themes
/**
* Handles GET requests for the theme listing
*/
public function get_themes()
{
$all_themes = Themes::get_all_data();
foreach ($all_themes as $name => $theme) {
if (isset($all_themes[$name]['info']->update) && $all_themes[$name]['info']->update != '' && isset($all_themes[$name]['info']->version) && $all_themes[$name]['info']->version != '') {
Update::add($name, $all_themes[$name]['info']->update, $all_themes[$name]['info']->version);
}
}
$updates = Update::check();
foreach ($all_themes as $name => $theme) {
if (isset($all_themes[$name]['info']->update) && isset($updates[$all_themes[$name]['info']->update])) {
$all_themes[$name]['info']->update = $updates[$all_themes[$name]['info']->update]['latest_version'];
} else {
$all_themes[$name]['info']->update = '';
}
}
$this->theme->all_themes = $all_themes;
$this->theme->active_theme = Themes::get_active_data(true);
$this->theme->active_theme_dir = $this->theme->active_theme['path'];
// If the active theme is configurable, allow it to configure
$this->theme->active_theme_name = $this->theme->active_theme['info']->name;
$this->theme->configurable = Plugins::filter('theme_config', false, $this->active_theme);
$this->theme->assign('configure', Controller::get_var('configure'));
$activedata = Themes::get_active_data(true);
$areas = array();
if (isset($activedata['info']->areas->area)) {
foreach ($activedata['info']->areas->area as $area) {
$areas[] = (string) $area;
}
}
$this->theme->areas = $areas;
$this->theme->previewed = Themes::get_theme_dir(false);
$this->theme->blocks = Plugins::filter('block_list', array());
$this->theme->block_instances = DB::get_results('SELECT b.* FROM {blocks} b ORDER BY b.title ASC', array(), 'Block');
$blocks_areas_t = DB::get_results('SELECT b.*, ba.scope_id, ba.area, ba.display_order FROM {blocks} b INNER JOIN {blocks_areas} ba ON ba.block_id = b.id ORDER BY ba.scope_id ASC, ba.area ASC, ba.display_order ASC', array());
$blocks_areas = array();
foreach ($blocks_areas_t as $block) {
if (!isset($blocks_areas[$block->scope_id])) {
$blocks_areas[$block->scope_id] = array();
}
$blocks_areas[$block->scope_id][$block->area][$block->display_order] = $block;
}
$this->theme->blocks_areas = $blocks_areas;
$this->theme->scopes = DB::get_results('SELECT * FROM {scopes} ORDER BY id ASC;');
$this->theme->theme_loader = Plugins::filter('theme_loader', '', $this->theme);
$this->theme->display('themes');
}
示例3: get_themes
/**
* Handles GET requests for the theme listing
*/
public function get_themes()
{
$all_themes = Themes::get_all_data();
foreach ($all_themes as $name => $theme) {
if (isset($all_themes[$name]['info']->update) && $all_themes[$name]['info']->update != '' && isset($all_themes[$name]['info']->version) && $all_themes[$name]['info']->version != '') {
Update::add($name, $all_themes[$name]['info']->update, $all_themes[$name]['info']->version);
}
}
$updates = Update::check();
foreach ($all_themes as $name => $theme) {
if (isset($all_themes[$name]['info']->update) && isset($updates[$all_themes[$name]['info']->update])) {
$all_themes[$name]['info']->update = $updates[$all_themes[$name]['info']->update]['latest_version'];
} else {
$all_themes[$name]['info']->update = '';
}
}
$this->theme->all_themes = $all_themes;
$this->theme->active_theme = Themes::get_active_data();
$this->theme->active_theme_dir = $this->theme->active_theme['path'];
// If the active theme is configurable, allow it to configure
$this->theme->active_theme_name = $this->theme->active_theme['info']->name;
$this->theme->configurable = Plugins::filter('theme_config', false, $this->active_theme);
$this->theme->assign('configure', Controller::get_var('configure'));
$this->theme->display('themes');
}