本文整理汇总了PHP中Updater::update方法的典型用法代码示例。如果您正苦于以下问题:PHP Updater::update方法的具体用法?PHP Updater::update怎么用?PHP Updater::update使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Updater
的用法示例。
在下文中一共展示了Updater::update方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: main
public function main($argv)
{
Pix_Table::$_save_memory = true;
list(, $type, $year, $month) = $argv;
if (!in_array($type, array('company', 'bussiness', 'company-continue', 'bussiness-continue'))) {
return $this->wrong_argv();
}
if (in_array($type, array('company', 'bussiness'))) {
$year = intval($year);
$month = intval($month);
if (!intval($year) or !intval($month)) {
return $this->wrong_argv();
}
}
if ('company' == $type) {
$ids = Crawler::crawlerMonth($year, $month);
$ids = array_unique($ids);
file_put_contents('ids', implode("\n", $ids));
foreach ($ids as $id) {
$u = Updater::update($id);
if ($u) {
$u->updateSearch();
}
}
} elseif ('company-continue' == $type) {
$ids = explode("\n", file_get_contents('ids'));
$pos = array_search($year, $ids);
var_dump($pos);
if (false === $pos) {
return $this->wrong_argv();
}
foreach (array_slice($ids, $pos - 1) as $id) {
$u = Updater::update($id);
if ($u) {
$u->updateSearch();
}
}
} else {
$ids = Crawler::crawlerBussiness($year, $month);
$ids = array_unique($ids);
file_put_contents('ids', implode("\n", $ids));
foreach ($ids as $id) {
$u = Updater::updateBussiness($id);
if ($u) {
$u->updateSearch();
}
}
}
}
示例2: protect
/**
* Block a page if referer is found on list of blocked domains
*
* @param string $action If empty, send 403 response; if URL, redirect here; if non-empty string, print message
*/
public static function protect($action = '')
{
// Try to update the list
if (!defined('SEMALT_UNIT_TESTING')) {
Updater::update();
}
// Simply stop here if referer is not on the list
if (!self::isRefererOnBlocklist()) {
return;
}
self::doBlock($action);
// Stop execution altogether, bye bye bots
if (!defined('SEMALT_UNIT_TESTING')) {
exit;
}
}
示例3:
*/
namespace OCA_Updater;
\OCP\JSON::checkAdminUser();
// Url to download package e.g. http://download.owncloud.org/releases/owncloud-4.0.5.tar.bz2
$packageUrl = 'http://owncloud.org/releases/owncloud-latest.zip';
//Package version e.g. 4.0.4
$packageVersion = '';
$updateData = \OC_Updater::check();
if (isset($updateData['version'])) {
$packageVersion = $updateData['version'];
}
if (isset($updateData['url']) && extension_loaded('bz2')) {
$packageUrl = $updateData['url'];
}
if (!$packageVersion) {
\OCP\JSON::error(array('msg' => 'Version not found'));
exit;
}
$sourcePath = Downloader::getPackage($packageUrl, $packageVersion);
if (!$sourcePath) {
\OCP\JSON::error(array('msg' => 'Unable to fetch package'));
exit;
}
$backupPath = Backup::createBackup();
if ($backupPath) {
Updater::update($sourcePath, $backupPath);
\OCP\JSON::success(array());
} else {
\OCP\JSON::error(array('msg' => 'Failed to create backup'));
}
示例4: install
protected function install()
{
$updater = new Updater();
$updater->update();
}
示例5: renderPage
function renderPage()
{
$LINKSDB = new LinkDB($GLOBALS['config']['DATASTORE'], isLoggedIn(), $GLOBALS['config']['HIDE_PUBLIC_LINKS'], $GLOBALS['redirector'], $GLOBALS['config']['REDIRECTOR_URLENCODE']);
$updater = new Updater(read_updates_file($GLOBALS['config']['UPDATES_FILE']), $GLOBALS, $LINKSDB, isLoggedIn());
try {
$newUpdates = $updater->update();
if (!empty($newUpdates)) {
write_updates_file($GLOBALS['config']['UPDATES_FILE'], $updater->getDoneUpdates());
}
} catch (Exception $e) {
die($e->getMessage());
}
$PAGE = new PageBuilder();
$PAGE->assign('linkcount', count($LINKSDB));
$PAGE->assign('privateLinkcount', count_private($LINKSDB));
// Determine which page will be rendered.
$query = isset($_SERVER['QUERY_STRING']) ? $_SERVER['QUERY_STRING'] : '';
$targetPage = Router::findPage($query, $_GET, isLoggedIn());
// Call plugin hooks for header, footer and includes, specifying which page will be rendered.
// Then assign generated data to RainTPL.
$common_hooks = array('includes', 'header', 'footer');
$pluginManager = PluginManager::getInstance();
foreach ($common_hooks as $name) {
$plugin_data = array();
$pluginManager->executeHooks('render_' . $name, $plugin_data, array('target' => $targetPage, 'loggedin' => isLoggedIn()));
$PAGE->assign('plugins_' . $name, $plugin_data);
}
// -------- Display login form.
if ($targetPage == Router::$PAGE_LOGIN) {
if ($GLOBALS['config']['OPEN_SHAARLI']) {
header('Location: ?');
exit;
}
// No need to login for open Shaarli
$token = '';
if (ban_canLogin()) {
$token = getToken();
}
// Do not waste token generation if not useful.
$PAGE->assign('token', $token);
if (isset($_GET['username'])) {
$PAGE->assign('username', escape($_GET['username']));
}
$PAGE->assign('returnurl', isset($_SERVER['HTTP_REFERER']) ? escape($_SERVER['HTTP_REFERER']) : '');
$PAGE->renderPage('loginform');
exit;
}
// -------- User wants to logout.
if (isset($_SERVER['QUERY_STRING']) && startsWith($_SERVER['QUERY_STRING'], 'do=logout')) {
invalidateCaches($GLOBALS['config']['PAGECACHE']);
logout();
header('Location: ?');
exit;
}
// -------- Picture wall
if ($targetPage == Router::$PAGE_PICWALL) {
// Optionally filter the results:
$links = $LINKSDB->filterSearch($_GET);
$linksToDisplay = array();
// Get only links which have a thumbnail.
foreach ($links as $link) {
$permalink = '?' . escape(smallhash($link['linkdate']));
$thumb = lazyThumbnail($link['url'], $permalink);
if ($thumb != '') {
$link['thumbnail'] = $thumb;
// Thumbnail HTML code.
$linksToDisplay[] = $link;
// Add to array.
}
}
$data = array('linksToDisplay' => $linksToDisplay);
$pluginManager->executeHooks('render_picwall', $data, array('loggedin' => isLoggedIn()));
foreach ($data as $key => $value) {
$PAGE->assign($key, $value);
}
$PAGE->renderPage('picwall');
exit;
}
// -------- Tag cloud
if ($targetPage == Router::$PAGE_TAGCLOUD) {
$tags = $LINKSDB->allTags();
// We sort tags alphabetically, then choose a font size according to count.
// First, find max value.
$maxcount = 0;
foreach ($tags as $value) {
$maxcount = max($maxcount, $value);
}
// Sort tags alphabetically: case insensitive, support locale if avalaible.
uksort($tags, function ($a, $b) {
// Collator is part of PHP intl.
if (class_exists('Collator')) {
$c = new Collator(setlocale(LC_COLLATE, 0));
if (!intl_is_failure(intl_get_error_code())) {
return $c->compare($a, $b);
}
}
return strcasecmp($a, $b);
});
$tagList = array();
foreach ($tags as $key => $value) {
//.........这里部分代码省略.........
示例6: set_time_limit
<?php
/**
* ownCloud - Updater plugin
*
* @author Victor Dubiniuk
* @copyright 2013 Victor Dubiniuk victor.dubiniuk@gmail.com
*
* This file is licensed under the Affero General Public License version 3 or
* later.
*/
namespace OCA\Updater;
\OCP\JSON::checkAdminUser();
\OCP\JSON::callCheck();
set_time_limit(0);
$request = file_get_contents('php://input');
$decodedRequest = json_decode($request, true);
$packageUrl = isset($decodedRequest['url']) ? $decodedRequest['url'] : '';
$packageVersion = isset($decodedRequest['version']) ? $decodedRequest['version'] : '';
$backupPath = isset($decodedRequest['backupPath']) ? $decodedRequest['backupPath'] : '';
try {
Updater::update($packageVersion, $backupPath);
// We are done. Some cleanup
Downloader::cleanUp($packageVersion);
Updater::cleanUp();
\OCP\JSON::success();
} catch (\Exception $e) {
App::log($e->getMessage());
\OCP\JSON::error(array('message' => (string) App::$l10n->t('Update failed.') . $e->getMessage()));
}
示例7: define
<?php
define('LOCK_FILE', isset($_SERVER['argv'][1]) ? $_SERVER['argv'][1] : '/tmp/secondcrack-updater.pid');
// Ensure that no other instances are running
if (file_exists(LOCK_FILE) && ($pid = intval(trim(file_get_contents(LOCK_FILE)))) && posix_kill($pid, 0)) {
fwrite(STDERR, "Already running [pid {$pid}]\n");
exit(1);
}
if (file_put_contents(LOCK_FILE, posix_getpid())) {
register_shutdown_function(function () {
try {
unlink(LOCK_FILE);
} catch (Exception $e) {
fwrite(STDERR, "Cannot remove lock file [" . LOCK_FILE . "]: " . $e->getMessage() . "\n");
}
});
} else {
fwrite(STDERR, "Cannot write lock file: " . LOCK_FILE . "\n");
exit(1);
}
$fdir = dirname(__FILE__);
require_once $fdir . '/Post.php';
$config_file = realpath(dirname(__FILE__) . '/..') . '/config.php';
if (!file_exists($config_file)) {
fwrite(STDERR, "Missing config file [{$config_file}]\nsee [{$config_file}.default] for an example\n");
exit(1);
}
require_once $config_file;
Updater::update();
exit(Updater::$changes_were_written ? 2 : 0);
示例8: update_10
public function update_10()
{
if ($this->accessAdminPage(5)) {
require_once dirname(__FILE__) . '/resources/update.php';
$updater = new Updater($this->parent);
return $updater->update(10);
} else {
$this->parent->parent->addHeader('Location', '/admin/modules/');
return new ActionResult($this, '/admin/modules/', 1, 'You are not allowed to do that', B_T_FAIL);
}
}
示例9: checkValue
<?php
define("IN_CMS", true);
// ked uz pise text nech je spravne kodovanie ...
header("Content-Type: text/html; charset=UTF-8");
$rootPath = dirname(__FILE__);
require_once "{$rootPath}/config/config.php";
require_once "{$rootPath}/core/inflector.php";
require_once "{$rootPath}/core/auto_loadable.php";
Header("Content-Type: text/plain");
$updater = new Updater();
function checkValue($key, $value)
{
return isset($_GET[$key]) && $_GET[$key] == $value;
}
$warning = !checkValue("warning", "no");
$updateTimestamp = checkValue("timestamp", "update");
$updater->update($warning, $updateTimestamp);
示例10: dirname
<?php
require_once dirname(__FILE__) . '/Updater.php';
$paths = array('.', '../../tools/IZI Miner/');
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>SEWEBAR Dev Updater</title>
</head>
<body>
<?php
foreach ($paths as $path) {
?>
<?php
$updater = new Updater($path);
?>
Updating <i><?php
print realpath($path);
?>
</i>...<br>
<?php
print $updater->update();
?>
<br /><hr /><br />
<?php
}
?>
</body>
</html>
示例11: ReportIssue
case "report":
$reportissue = new ReportIssue();
$reportissue->report();
break;
case "reportRes":
$reportissue = new ReportIssue();
$reportissue->reportRes();
break;
case "jumpback":
$jumper = new JumpBack();
$jumper->jump();
break;
case "jumpbackRes":
$jumper = new JumpBack();
$jumper->jumpRes();
break;
case "update":
$update = new Updater();
$update->update();
break;
case "updateRes":
$update = new Updater();
$update->updateRes();
break;
default:
//$reportissue->report();
break;
}
if (getFromSessionParams('type') != "2") {
$_SESSION[SURVEY_EXECUTION_MODE] = SURVEY_EXECUTION_MODE_NORMAL;
}
示例12: Output
* This file is part of uBook - a website to buy and sell books.
* Copyright © 2010 Maikel Linke
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
require_once 'update/Updater.php';
require_once 'tools/Output.php';
require_once 'text/Template.php';
$output = new Output();
$tmpl = Template::fromFile('view/update.html');
$updater = new Updater();
if ($updater->hasWork()) {
$updater->update();
$sub = $tmpl->addSubtemplate('working');
$sub->assign('version', $updater->getNextVersion());
$output->addRefreshLink('./admin_update.php');
} else {
$tmpl->addSubtemplate('noWork');
}
$output->send($tmpl->result());
示例13: protect
public static function protect($action = '')
{
if (!defined('SEMALT_UNIT_TESTING')) {
Updater::update();
}
if (!self::isRefererOnBlocklist()) {
return;
}
self::doBlock($action);
if (!defined('SEMALT_UNIT_TESTING')) {
exit;
}
}
示例14: foreach
<?php
include __DIR__ . '/../init.inc.php';
Pix_Table::$_save_memory = true;
$ids = Updater::searchByKeyword($_SERVER['argv'][1]);
foreach ($ids as $id) {
if (Unit::find($id)) {
continue;
}
Updater::update($id);
Unit::find($id)->updateSearch();
}
$ids = Updater::searchBussinessByKeyword($_SERVER['argv'][1]);
foreach ($ids as $id) {
if (Unit::find($id)) {
continue;
}
if ($u = Updater::updateBussiness($id)) {
$u->updateSearch();
}
}