本文整理汇总了PHP中Updater::updateAvailable方法的典型用法代码示例。如果您正苦于以下问题:PHP Updater::updateAvailable方法的具体用法?PHP Updater::updateAvailable怎么用?PHP Updater::updateAvailable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Updater
的用法示例。
在下文中一共展示了Updater::updateAvailable方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: do_upgrade
public function do_upgrade()
{
$request = $this->getRequest();
if ($request->isPost()) {
$updater = new Updater();
if ($updater->updateAvailable()) {
$image_data = $updater->downloadLatest();
if (!$updater->validateSignature($image_data)) {
die('INVALID SIGNATURE');
}
if ($updater->performUpdate($image_data)) {
die('Upgrading, please wait for the device to reboot.');
} else {
die('FAILED');
}
}
}
}
示例2: do_upgrade
public function do_upgrade()
{
$request = $this->getRequest();
if ($request->isPost()) {
$updater = new Updater();
if ($updater->updateAvailable()) {
if (!$updater->validateSignature()) {
$updater->deleteImage();
die('INVALID SIGNATURE');
}
//die('SUCCESS'); # ENABLE TO DEBUG!
if ($updater->performUpdate()) {
die('SUCCESS');
} else {
die('FAILURE');
}
}
}
}
示例3: Request
<?php
require_once '/nak/webapp/bootstrap.php';
if (!session_id()) {
session_start();
}
$cur_stage = NetAidManager::get_stage();
$request = new Request($_GET['query']);
$dispatcher = new Dispatcher();
$controller = $request->getController();
$action = $request->getAction();
$updater = new Updater();
if ($cur_stage >= STAGE_ONLINE && $_SESSION['logged_in'] == 1 && $updater->updateAvailable()) {
if ($controller != 'update') {
$request->setController('update');
$request->setAction('index');
}
} else {
if ($cur_stage != STAGE_ONLINE && $_SERVER['SERVER_NAME'] != '192.168.101.1') {
header('Location: http://192.168.101.1/' . $controller . '/' . $action);
die;
}
}
$page_html = '';
try {
$page_html = $dispatcher->run($request);
} catch (NotFoundException $e) {
if ($cur_stage != STAGE_ONLINE) {
header('Location: http://192.168.101.1/index/index');
die;
}