本文整理匯總了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;
}