本文整理汇总了PHP中Console::updateConsoleInfo方法的典型用法代码示例。如果您正苦于以下问题:PHP Console::updateConsoleInfo方法的具体用法?PHP Console::updateConsoleInfo怎么用?PHP Console::updateConsoleInfo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Console
的用法示例。
在下文中一共展示了Console::updateConsoleInfo方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: realpath
<?php
//This script will update all records in the consoleinfo table
define('FS_ROOT', realpath(dirname(__FILE__)));
require_once FS_ROOT . "/../../www/config.php";
require_once FS_ROOT . "/../../www/lib/framework/db.php";
require_once FS_ROOT . "/../../www/lib/console.php";
$console = new Console(true);
$db = new Db();
$res = $db->queryDirect(sprintf("SELECT searchname, ID from releases where consoleinfoID IS NULL and categoryID in ( select ID from category where parentID = %d ) ORDER BY id DESC LIMIT %d", Category::CAT_PARENT_GAME, Console::NUMTOPROCESSPERTIME));
if ($res != null) {
while ($arr = $db->getAssocArray($res)) {
$conInfo = $console->parseTitle($arr['searchname']);
if ($conInfo !== false) {
echo 'Searching ' . $conInfo['release'] . '<br />';
$con = $console->updateConsoleInfo($conInfo);
if ($con !== false) {
print_r($con);
} else {
echo 'Console not found';
}
}
}
}
示例2: dirname
<?php
//This script will update all records in the consoleinfo table
require_once dirname(__FILE__) . '/../../../www/config.php';
use nzedb\db\Settings;
$pdo = new Settings();
$console = new Console(['Echo' => true, 'Settings' => $pdo]);
$res = $pdo->queryDirect(sprintf("SELECT searchname, id FROM releases WHERE consoleinfoid IS NULL AND categoryid BETWEEN 1000 AND 1999 ORDER BY id DESC"));
if ($res instanceof Traversable) {
echo $pdo->log->header("Updating console info for " . number_format($res->rowCount()) . " releases.");
foreach ($res as $arr) {
$starttime = microtime(true);
$gameInfo = $console->parseTitle($arr['searchname']);
if ($gameInfo !== false) {
$game = $console->updateConsoleInfo($gameInfo);
if ($game === false) {
echo $pdo->log->primary($gameInfo['release'] . ' not found');
}
}
// amazon limits are 1 per 1 sec
$diff = floor((microtime(true) - $starttime) * 1000000);
if (1000000 - $diff > 0) {
echo $pdo->log->alternate("Sleeping");
usleep(1000000 - $diff);
}
}
}