本文整理匯總了PHP中nzedb\db\Settings::queryExec方法的典型用法代碼示例。如果您正苦於以下問題:PHP Settings::queryExec方法的具體用法?PHP Settings::queryExec怎麽用?PHP Settings::queryExec使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類nzedb\db\Settings
的用法示例。
在下文中一共展示了Settings::queryExec方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: deleteTitle
/**
* Deletes stored AniDB entries in the database
*
* @param int $anidbID
*/
public function deleteTitle($anidbID)
{
$this->pdo->queryExec(sprintf('
DELETE at, ai, ae
FROM anidb_titles AS at
LEFT OUTER JOIN anidb_info ai USING (anidbid)
LEFT OUTER JOIN anidb_episodes ae USING (anidbid)
WHERE anidbid = %d', $anidbID));
}
示例2: getDownloadRequests
/**
* Get the count of how many NZB's the user has downloaded in the past day.
*
* @param int $userID
*
* @return int
*/
public function getDownloadRequests($userID)
{
// Clear old requests.
$this->pdo->queryExec(sprintf('DELETE FROM user_downloads WHERE user_id = %d AND timestamp < DATE_SUB(NOW(), INTERVAL 1 DAY)', $userID));
$value = $this->pdo->queryOneRow(sprintf('SELECT COUNT(id) AS num FROM user_downloads WHERE user_id = %d AND timestamp > DATE_SUB(NOW(), INTERVAL 1 DAY)', $userID));
return $value === false ? 0 : (int) $value['num'];
}
示例3: processStuckCollections
/**
* If a collection has been stuck for $this->collectionTimeout hours, delete it, it's bad.
*
* @param array $group
* @param string $where
*
* @void
* @access private
*/
private function processStuckCollections(array $group, $where)
{
$obj = $this->pdo->queryExec(sprintf("\n\t\t\t\tDELETE c, b, p FROM %s c\n\t\t\t\tLEFT JOIN %s b ON (c.id=b.collection_id)\n\t\t\t\tLEFT JOIN %s p ON (b.id=p.binaryid)\n\t\t\t\tWHERE\n\t\t\t\t\tc.added <\n\t\t\t\t\tDATE_SUB((SELECT value FROM settings WHERE setting = 'last_run_time'), INTERVAL %d HOUR)\n\t\t\t\t%s", $group['cname'], $group['bname'], $group['pname'], $this->collectionTimeout, $where));
if ($this->echoCLI && is_object($obj) && $obj->rowCount()) {
$this->pdo->log->doEcho($this->pdo->log->primary('Deleted ' . $obj->rowCount() . ' broken/stuck collections.'));
}
}
示例4: processXXXReleases
/**
* Process releases with no xxxinfo ID's.
*
*/
public function processXXXReleases()
{
// Get all releases without an IMpdo id.
$res = $this->pdo->query(sprintf("\n\t\t\t\tSELECT r.searchname, r.id\n\t\t\t\tFROM releases r\n\t\t\t\tWHERE r.nzbstatus = 1\n\t\t\t\tAND r.xxxinfo_id = 0\n\t\t\t\tAND r.categoryid BETWEEN 6000 AND 6040\n\t\t\t\tLIMIT %d", $this->movieqty));
$movieCount = count($res);
if ($movieCount > 0) {
if ($this->echooutput) {
$this->pdo->log->doEcho($this->pdo->log->header("Processing " . $movieCount . " XXX releases."));
}
// Loop over releases.
foreach ($res as $arr) {
$idcheck = -2;
// Try to get a name.
if ($this->debug && $this->echooutput) {
$this->pdo->log->doEcho("DB name: " . $arr['searchname'], true);
}
if ($this->parseXXXSearchName($arr['searchname']) !== false) {
$this->currentRelID = $arr['id'];
$movieName = $this->currentTitle;
if ($this->echooutput) {
$this->pdo->log->doEcho($this->pdo->log->primaryOver("Looking up: ") . $this->pdo->log->headerOver($movieName), true);
}
$idcheck = $this->updateXXXInfo($movieName);
} else {
$this->pdo->log->doEcho(".", true);
}
$this->pdo->queryExec(sprintf('UPDATE releases SET xxxinfo_id = %d WHERE id = %d', $idcheck, $arr['id']));
}
} elseif ($this->echooutput) {
$this->pdo->log->doEcho($this->pdo->log->header('No xxx releases to process.'));
}
}
示例5: addFull
public function addFull($id, $xml)
{
$ckid = $this->pdo->queryOneRow(sprintf('SELECT releaseid FROM releaseextrafull WHERE releaseid = %s', $id));
if (!isset($ckid['releaseid'])) {
return $this->pdo->queryExec(sprintf('INSERT INTO releaseextrafull (releaseid, mediainfo) VALUES (%d, %s)', $id, $this->pdo->escapeString($xml)));
}
}
示例6: insertNewComment
/**
* Fetch a comment and insert it.
*
* @param string $messageID Message-ID for the article.
* @param string $siteID ID of the site.
*
* @return bool
*
* @access protected
*/
protected function insertNewComment(&$messageID, &$siteID)
{
// Get the article body.
$body = $this->nntp->getMessages(self::group, $messageID);
// Check if there's an error.
if ($this->nntp->isError($body)) {
return false;
}
// Decompress the body.
$body = @gzinflate($body);
if ($body === false) {
return false;
}
// JSON Decode the body.
$body = json_decode($body, true);
if ($body === false) {
return false;
}
// Just in case.
if (!isset($body['USER']) || !isset($body['SID']) || !isset($body['RID']) || !isset($body['TIME']) | !isset($body['BODY'])) {
return false;
}
// Insert the comment.
if ($this->pdo->queryExec(sprintf('
INSERT INTO release_comments
(text, createddate, shareid, nzb_guid, siteid, username, user_id, releaseid, shared, host)
VALUES (%s, %s, %s, UNHEX(%s), %s, %s, 0, 0, 2, "")', $this->pdo->escapeString($body['BODY']), $this->pdo->from_unixtime($body['TIME'] > time() ? time() : $body['TIME']), $this->pdo->escapeString($body['SID']), $this->pdo->escapeString($body['RID']), $this->pdo->escapeString($siteID), $this->pdo->escapeString(substr($body['USER'], 0, 3) === 'sn-' ? 'SH_ANON' : 'SH_' . $body['USER'])))) {
return true;
}
return false;
}
示例7: processGamesReleases
public function processGamesReleases()
{
$res = $this->pdo->queryDirect(sprintf('
SELECT searchname, id
FROM releases
WHERE nzbstatus = 1 %s
AND gamesinfo_id = 0
AND categoryid = 4050
ORDER BY postdate DESC
LIMIT %d', $this->renamed, $this->gameQty));
if ($res instanceof \Traversable && $res->rowCount() > 0) {
if ($this->echoOutput) {
$this->pdo->log->doEcho($this->pdo->log->header("Processing " . $res->rowCount() . ' games release(s).'));
}
foreach ($res as $arr) {
// Reset maxhitrequest
$this->maxHitRequest = false;
$startTime = microtime(true);
$usedgb = false;
$gameInfo = $this->parseTitle($arr['searchname']);
if ($gameInfo !== false) {
if ($this->echoOutput) {
$this->pdo->log->doEcho($this->pdo->log->headerOver('Looking up: ') . $this->pdo->log->primary($gameInfo['title'] . ' (PC)'));
}
// Check for existing games entry.
$gameCheck = $this->getGamesInfoByName($gameInfo['title']);
if ($gameCheck === false) {
$gameId = $this->updateGamesInfo($gameInfo);
$usedgb = true;
if ($gameId === false) {
$gameId = -2;
// Leave gamesinfo_id 0 to parse again
if ($this->maxHitRequest === true) {
$gameId = 0;
}
}
} else {
$gameId = $gameCheck['id'];
}
// Update release.
$this->pdo->queryExec(sprintf('UPDATE releases SET gamesinfo_id = %d WHERE id = %d', $gameId, $arr['id']));
} else {
// Could not parse release title.
$this->pdo->queryExec(sprintf('UPDATE releases SET gamesinfo_id = %d WHERE id = %d', -2, $arr['id']));
if ($this->echoOutput) {
echo '.';
}
}
// Sleep to not flood giantbomb.
$diff = floor((microtime(true) - $startTime) * 1000000);
if ($this->sleepTime * 1000 - $diff > 0 && $usedgb === true) {
usleep($this->sleepTime * 1000 - $diff);
}
}
} else {
if ($this->echoOutput) {
$this->pdo->log->doEcho($this->pdo->log->header('No games releases to process.'));
}
}
}
示例8: startRunning
public function startRunning()
{
if (!$this->isRunning()) {
return $this->pdo->queryExec("UPDATE tmux SET value = '1' WHERE setting = 'running'");
}
return true;
}
示例9: _requestIdNotFound
/**
* No request ID was found, update the release.
*
* @param int $releaseID
* @param int $status
*/
protected function _requestIdNotFound($releaseID, $status)
{
if ($releaseID == 0) {
return;
}
$this->pdo->queryExec(sprintf('
UPDATE releases SET reqidstatus = %d WHERE id = %d', $status, $releaseID));
}
示例10: processMusicReleases
/**
* @param bool $local
*/
public function processMusicReleases($local = false)
{
$res = $this->pdo->queryDirect(sprintf('SELECT searchname, id FROM releases ' . 'WHERE musicinfoid IS NULL AND nzbstatus = 1 %s AND categoryid IN (3010, 3040, 3050) ' . 'ORDER BY postdate DESC LIMIT %d', $this->renamed, $this->musicqty));
if ($res instanceof \Traversable && $res->rowCount() > 0) {
if ($this->echooutput) {
$this->pdo->log->doEcho($this->pdo->log->header("Processing " . $res->rowCount() . ' music release(s).'));
}
foreach ($res as $arr) {
$startTime = microtime(true);
$usedAmazon = false;
$album = $this->parseArtist($arr['searchname']);
if ($album !== false) {
$newname = $album["name"] . ' (' . $album["year"] . ')';
if ($this->echooutput) {
$this->pdo->log->doEcho($this->pdo->log->headerOver('Looking up: ') . $this->pdo->log->primary($newname));
}
// Do a local lookup first
$musicCheck = $this->getMusicInfoByName('', $album["name"]);
if ($musicCheck === false && in_array($album['name'] . $album['year'], $this->failCache)) {
// Lookup recently failed, no point trying again
if ($this->echooutput) {
$this->pdo->log->doEcho($this->pdo->log->headerOver('Cached previous failure. Skipping.') . PHP_EOL);
}
$albumId = -2;
} else {
if ($musicCheck === false && $local === false) {
$albumId = $this->updateMusicInfo($album['name'], $album['year']);
$usedAmazon = true;
if ($albumId === false) {
$albumId = -2;
$this->failCache[] = $album['name'] . $album['year'];
}
} else {
$albumId = $musicCheck['id'];
}
}
// Update release.
$this->pdo->queryExec(sprintf("UPDATE releases SET musicinfoid = %d WHERE id = %d", $albumId, $arr["id"]));
} else {
$this->pdo->queryExec(sprintf("UPDATE releases SET musicinfoid = %d WHERE id = %d", -2, $arr["id"]));
echo '.';
}
// Sleep to not flood amazon.
$diff = floor((microtime(true) - $startTime) * 1000000);
if ($this->sleeptime * 1000 - $diff > 0 && $usedAmazon === true) {
usleep($this->sleeptime * 1000 - $diff);
}
}
if ($this->echooutput) {
echo "\n";
}
} else {
if ($this->echooutput) {
$this->pdo->log->doEcho($this->pdo->log->header('No music releases to process.'));
}
}
}
示例11: _updateSingleColumn
/** This function updates a single variable column in releases
* The first parameter is the column to update, the second is the value
* The final parameter is the ID of the release to update
*
* @param string $column
* @param integer $status
* @param integer $id
*/
private function _updateSingleColumn($column = '', $status = 0, $id = 0)
{
if ($column !== '' && $id !== 0) {
$this->pdo->queryExec(sprintf('
UPDATE releases
SET %s = %s
WHERE id = %d', $column, is_numeric($status) ? $status : $this->pdo->escapeString($status), $id));
}
}
示例12: parseNZB
/**
* Gets the completion from the NZB, optionally looks if there is an NFO/PAR2 file.
*
* @param string $guid
* @param int $relID
* @param int $groupID
* @param bool $nfoCheck
*
* @return array|bool
*
* @access public
*/
public function parseNZB($guid, $relID, $groupID, $nfoCheck = false)
{
$nzbFile = $this->LoadNZB($guid);
if ($nzbFile !== false) {
$messageID = $hiddenID = '';
$actualParts = $artificialParts = 0;
$foundPAR2 = $this->lookuppar2 === false ? true : false;
$foundNFO = $hiddenNFO = $nfoCheck === false ? true : false;
foreach ($nzbFile->file as $nzbcontents) {
foreach ($nzbcontents->segments->segment as $segment) {
$actualParts++;
}
$subject = (string) $nzbcontents->attributes()->subject;
if (preg_match('/(\\d+)\\)$/', $subject, $parts)) {
$artificialParts += $parts[1];
}
if ($foundNFO === false) {
if (preg_match('/\\.\\b(nfo|inf|ofn)\\b(?![ .-])/i', $subject)) {
$messageID = (string) $nzbcontents->segments->segment;
$foundNFO = true;
}
}
if ($foundNFO === false && $hiddenNFO === false) {
if (preg_match('/\\(1\\/1\\)$/i', $subject) && !preg_match('/\\.(apk|bat|bmp|cbr|cbz|cfg|css|csv|cue|db|dll|doc|epub|exe|gif|htm|ico|idx|ini' . '|jpg|lit|log|m3u|mid|mobi|mp3|nib|nzb|odt|opf|otf|par|par2|pdf|psd|pps|png|ppt|r\\d{2,4}' . '|rar|sfv|srr|sub|srt|sql|rom|rtf|tif|torrent|ttf|txt|vb|vol\\d+\\+\\d+|wps|xml|zip)/i', $subject)) {
$hiddenID = (string) $nzbcontents->segments->segment;
$hiddenNFO = true;
}
}
if ($foundPAR2 === false) {
if (preg_match('/\\.(par[2" ]|\\d{2,3}").+\\(1\\/1\\)$/i', $subject)) {
if ($this->pp->parsePAR2((string) $nzbcontents->segments->segment, $relID, $groupID, $this->nntp, 1) === true) {
$this->pdo->queryExec(sprintf('UPDATE releases SET proc_par2 = 1 WHERE id = %d', $relID));
$foundPAR2 = true;
}
}
}
}
if ($artificialParts <= 0 || $actualParts <= 0) {
$completion = 0;
} else {
$completion = $actualParts / $artificialParts * 100;
}
if ($completion > 100) {
$completion = 100;
}
$this->pdo->queryExec(sprintf('UPDATE releases SET completion = %d WHERE id = %d', $completion, $relID));
if ($foundNFO === true && strlen($messageID) > 1) {
return ['hidden' => false, 'ID' => $messageID];
} elseif ($hiddenNFO === true && strlen($hiddenID) > 1) {
return ['hidden' => true, 'ID' => $hiddenID];
}
}
return false;
}
示例13: processConsoleReleases
public function processConsoleReleases()
{
$res = $this->pdo->queryDirect(sprintf('
SELECT searchname, id
FROM releases
WHERE nzbstatus = %d %s
AND consoleinfoid IS NULL
AND categoryid BETWEEN 1000 AND 1999
ORDER BY postdate DESC
LIMIT %d', NZB::NZB_ADDED, $this->renamed, $this->gameqty));
if ($res instanceof Traversable && $res->rowCount() > 0) {
if ($this->echooutput) {
$this->pdo->log->doEcho($this->pdo->log->header("Processing " . $res->rowCount() . ' console release(s).'));
}
foreach ($res as $arr) {
$startTime = microtime(true);
$usedAmazon = false;
$gameId = self::CONS_NTFND;
$gameInfo = $this->parseTitle($arr['searchname']);
if ($gameInfo !== false) {
if ($this->echooutput) {
$this->pdo->log->doEcho($this->pdo->log->headerOver('Looking up: ') . $this->pdo->log->primary($gameInfo['title'] . ' (' . $gameInfo['platform'] . ')'));
}
// Check for existing console entry.
$gameCheck = $this->getConsoleInfoByName($gameInfo['title'], $gameInfo['platform']);
if ($gameCheck === false) {
$gameId = $this->updateConsoleInfo($gameInfo);
$usedAmazon = true;
} else {
if ($this->echooutput) {
$this->pdo->log->doEcho($this->pdo->log->headerOver("Found Local: ") . $this->pdo->log->primary("{$gameCheck['title']} - {$gameCheck['platform']}") . PHP_EOL);
}
$gameId = $gameCheck['id'];
}
} elseif ($this->echooutput) {
echo '.';
}
// Update release.
$this->pdo->queryExec(sprintf('
UPDATE releases
SET consoleinfoid = %d
WHERE id = %d', $gameId, $arr['id']));
// Sleep to not flood amazon.
$diff = floor((microtime(true) - $startTime) * 1000000);
if ($this->sleeptime * 1000 - $diff > 0 && $usedAmazon === true) {
usleep($this->sleeptime * 1000 - $diff);
}
}
} else {
if ($this->echooutput) {
$this->pdo->log->doEcho($this->pdo->log->header('No console releases to process.'));
}
}
}
示例14: isRunning
/**
* Check if Tmux is running, stop it if it is.
*
* @return bool
* @access public
*/
public function isRunning()
{
if ($this->get()->running == 1) {
$this->pdo->queryExec("UPDATE tmux SET value = '0' WHERE setting = 'RUNNING'");
$sleep = $this->get()->monitor_delay;
echo $this->pdo->log->header("Stopping tmux scripts and waiting {$sleep} seconds for all panes to shutdown");
sleep($sleep);
return true;
}
return false;
}
示例15: updateAniDBInfoEps
/**
* Updates existing anime info in anidb info/episodes tables
*
* @param array $AniDBInfoArray
*
* @return string
*/
private function updateAniDBInfoEps($AniDBInfoArray = [])
{
$this->pdo->queryExec(sprintf('
UPDATE anidb_info
SET type = %s, startdate = %s, enddate = %s, related = %s,
similar = %s, creators = %s, description = %s,
rating = %s, picture = %s, categories = %s, characters = %s,
updated = NOW()
WHERE anidbid = %d', $this->pdo->escapeString($AniDBInfoArray['type']), $this->pdo->escapeString($AniDBInfoArray['startdate']), $this->pdo->escapeString($AniDBInfoArray['enddate']), $this->pdo->escapeString($AniDBInfoArray['related']), $this->pdo->escapeString($AniDBInfoArray['similar']), $this->pdo->escapeString($AniDBInfoArray['creators']), $this->pdo->escapeString($AniDBInfoArray['description']), $this->pdo->escapeString($AniDBInfoArray['rating']), $this->pdo->escapeString($AniDBInfoArray['picture']), $this->pdo->escapeString($AniDBInfoArray['categories']), $this->pdo->escapeString($AniDBInfoArray['characters']), $this->anidbId));
$this->insertAniDBEpisodes($AniDBInfoArray['epsarr']);
return $AniDBInfoArray['picture'];
}