当前位置: 首页>>代码示例>>PHP>>正文


PHP Settings::queryExec方法代码示例

本文整理汇总了PHP中newznab\db\Settings::queryExec方法的典型用法代码示例。如果您正苦于以下问题:PHP Settings::queryExec方法的具体用法?PHP Settings::queryExec怎么用?PHP Settings::queryExec使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在newznab\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));
    }
开发者ID:RickDB,项目名称:newznab-tmux,代码行数:14,代码来源:AniDB.php

示例2: 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.'));
            }
        }
    }
开发者ID:engine9-,项目名称:newznab-tmux,代码行数:60,代码来源:Games.php

示例3: releases_rt

function releases_rt()
{
    $pdo = new Settings();
    $rows = $pdo->queryExec('SELECT id, guid, name, searchname, fromname FROM releases');
    if ($rows !== false && $rows->rowCount()) {
        $sphinx = new \SphinxSearch();
        $total = $rows->rowCount();
        $string = 'REPLACE INTO releases_rt (id, guid, name, searchname, fromname) VALUES ';
        $tempString = '';
        $i = 0;
        echo '[Starting to populate sphinx RT indexes with ' . $total . ' releases.] ';
        foreach ($rows as $row) {
            $i++;
            $tempString .= sprintf('(%d, %s, %s, %s, %s),', $row['id'], $sphinx->sphinxQL->escapeString($row['guid']), $sphinx->sphinxQL->escapeString($row['name']), $sphinx->sphinxQL->escapeString($row['searchname']), $sphinx->sphinxQL->escapeString($row['fromname']));
            if ($i === 1000 || $i >= $total) {
                $sphinx->sphinxQL->queryExec($string . rtrim($tempString, ','));
                $tempString = '';
                $total -= $i;
                $i = 0;
                echo '.';
            }
        }
        echo ' [Done.]' . PHP_EOL;
    } else {
        echo 'No releases in your DB or an error occurred. This will need to be resolved before you can use the search.' . PHP_EOL;
    }
}
开发者ID:engine9-,项目名称:newznab-tmux,代码行数:27,代码来源:populate_rt_indexes.php

示例4: updateMovie

 public function updateMovie($uid, $imdbid, $catid = array())
 {
     $db = new Settings();
     $catid = !empty($catid) ? $db->escapeString(implode('|', $catid)) : "null";
     $sql = sprintf("update usermovies set categoryid = %s where userid = %d and imdbid = %d", $catid, $uid, $imdbid);
     $db->queryExec($sql);
 }
开发者ID:engine9-,项目名称:newznab-tmux,代码行数:7,代码来源:UserMovies.php

示例5: categorizeRelease

function categorizeRelease($update = true, $where, $echooutput = false)
{
    $pdo = new Settings();
    $cat = new Categorize();
    $consoletools = new consoleTools();
    $relcount = $chgcount = 0;
    $c = new ColorCLI();
    echo $c->primary("SELECT id, searchname, groupid, categoryid FROM releases " . $where);
    $resrel = $pdo->queryDirect("SELECT id, searchname, groupid, categoryid FROM releases " . $where);
    $total = $resrel->rowCount();
    if ($total > 0) {
        foreach ($resrel as $rowrel) {
            $catId = $cat->determineCategory($rowrel['groupid'], $rowrel['searchname']);
            if ($rowrel['categoryid'] != $catId) {
                if ($update === true) {
                    $pdo->queryExec(sprintf("\n\t\t\t\t\t\t\tUPDATE releases\n\t\t\t\t\t\t\tSET iscategorized = 1,\n\t\t\t\t\t\t\t\trageid = -1,\n\t\t\t\t\t\t\t\tseriesfull = NULL,\n\t\t\t\t\t\t\t\tseason = NULL,\n\t\t\t\t\t\t\t\tepisode = NULL,\n\t\t\t\t\t\t\t\ttvtitle = NULL,\n\t\t\t\t\t\t\t\ttvairdate = NULL,\n\t\t\t\t\t\t\t\timdbid = NULL,\n\t\t\t\t\t\t\t\tmusicinfoid = NULL,\n\t\t\t\t\t\t\t\tconsoleinfoid = NULL,\n\t\t\t\t\t\t\t\tgamesinfo_id = 0,\n\t\t\t\t\t\t\t\txxxinfo_id = 0,\n\t\t\t\t\t\t\t\tbookinfoid = NULL,\n\t\t\t\t\t\t\t\tanidbid = NULL,\n\t\t\t\t\t\t\t\tcategoryid = %d\n\t\t\t\t\t\t\tWHERE id = %d", $catId, $rowrel['id']));
                }
                $chgcount++;
            }
            $relcount++;
            if ($echooutput) {
                $consoletools->overWritePrimary("Re-Categorized: [" . number_format($chgcount) . "] " . $consoletools->percentString($relcount, $total));
            }
        }
    }
    if ($echooutput !== false && $relcount > 0) {
        echo "\n";
    }
    return $chgcount;
}
开发者ID:engine9-,项目名称:newznab-tmux,代码行数:30,代码来源:recategorize.php

示例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
     */
    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;
        }
        $cid = md5($body['SID'] . $body['USER'] . $body['TIME'] . $siteID);
        // Insert the comment.
        if ($this->pdo->queryExec(sprintf('
				INSERT IGNORE INTO releasecomment
				(text, createddate, issynced, shareid, cid, gid, nzb_guid, siteid, username, userid, releaseid, shared, host, sourceID)
				VALUES (%s, %s, 1, %s, %s, %s, %s, %s, %s, 0, 0, 2, "", 999)', $this->pdo->escapeString($body['BODY']), $this->pdo->from_unixtime($body['TIME'] > time() ? time() : $body['TIME']), $this->pdo->escapeString($body['SID']), $this->pdo->escapeString($cid), $this->pdo->escapeString($body['RID']), $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;
    }
开发者ID:engine9-,项目名称:newznab-tmux,代码行数:40,代码来源:Sharing.php

示例7: _updatePre

 /**
  * Updates PRE data in the DB.
  *
  * @access protected
  */
 protected function _updatePre()
 {
     if (empty($this->_curPre['title'])) {
         return;
     }
     $query = 'UPDATE prehash SET ';
     $query .= !empty($this->_curPre['size']) ? 'size = ' . $this->_pdo->escapeString($this->_curPre['size']) . ', ' : '';
     $query .= !empty($this->_curPre['source']) ? 'source = ' . $this->_pdo->escapeString($this->_curPre['source']) . ', ' : '';
     $query .= !empty($this->_curPre['files']) ? 'files = ' . $this->_pdo->escapeString($this->_curPre['files']) . ', ' : '';
     $query .= !empty($this->_curPre['reason']) ? 'nukereason = ' . $this->_pdo->escapeString($this->_curPre['reason']) . ', ' : '';
     $query .= !empty($this->_curPre['reqid']) ? 'requestid = ' . $this->_curPre['reqid'] . ', ' : '';
     $query .= !empty($this->_curPre['group_id']) ? 'groupid = ' . $this->_curPre['group_id'] . ', ' : '';
     $query .= !empty($this->_curPre['predate']) ? 'predate = ' . $this->_curPre['predate'] . ', ' : '';
     $query .= !empty($this->_curPre['nuked']) ? 'nuked = ' . $this->_curPre['nuked'] . ', ' : '';
     $query .= !empty($this->_curPre['filename']) ? 'filename = ' . $this->_pdo->escapeString($this->_curPre['filename']) . ', ' : '';
     $query .= empty($this->_oldPre['category']) && !empty($this->_curPre['category']) ? 'category = ' . $this->_pdo->escapeString($this->_curPre['category']) . ', ' : '';
     if ($query === 'UPDATE prehash SET ') {
         return;
     }
     $query .= 'title = ' . $this->_pdo->escapeString($this->_curPre['title']);
     $query .= ' WHERE title = ' . $this->_pdo->escapeString($this->_curPre['title']);
     $this->_pdo->ping(true);
     $this->_pdo->queryExec($query);
     $this->_doEcho(false);
 }
开发者ID:RickDB,项目名称:newznab-tmux,代码行数:30,代码来源:IRCScraper.php

示例8: startRunning

 public function startRunning()
 {
     if (!$this->isRunning()) {
         return $this->pdo->queryExec("UPDATE tmux SET value = '1' WHERE setting = 'running'");
     }
     return true;
 }
开发者ID:RickDB,项目名称:newznab-tmux,代码行数:7,代码来源:Tmux.php

示例9: processMovieReleases

 /**
  * Process all untagged movies to link them to a movieinfo row.
  */
 public function processMovieReleases()
 {
     $ret = 0;
     $nfo = new Nfo();
     $res = $this->pdo->queryDirect(sprintf("SELECT searchname, id from releases where imdbid IS NULL and categoryid in ( select id from category where parentid = %d ) ORDER BY postdate DESC LIMIT 100", Category::CAT_PARENT_MOVIE));
     if ($this->pdo->getNumRows($res) > 0) {
         if ($this->echooutput) {
             echo "MovProc : Processing " . $this->pdo->getNumRows($res) . " movie releases\n";
         }
         while ($arr = $this->pdo->getAssocArray($res)) {
             $imdbID = false;
             /* Preliminary IMDB id Detection from NFO file */
             $rawnfo = '';
             if ($nfo->getNfo($arr['id'], $rawnfo)) {
                 $imdbID = $this->parseImdbFromNfo($rawnfo);
             }
             if ($imdbID !== false) {
                 // Set IMDB (if found in nfo) and move along
                 $this->pdo->queryExec(sprintf("update releases set imdbid = %s where id = %d", $this->pdo->escapeString($imdbID), $arr["id"]));
                 //check for existing movie entry
                 $movCheck = $this->getMovieInfo($imdbID);
                 if ($movCheck === false || isset($movCheck['updateddate']) && time() - strtotime($movCheck['updateddate']) > 2592000) {
                     $movieId = $this->updateMovieInfo($imdbID);
                 }
                 continue;
             }
             $moviename = $this->parseMovieName($arr['searchname']);
             if ($moviename !== false) {
                 if ($this->echooutput) {
                     echo 'MovProc : ' . $moviename . ' [' . $arr['searchname'] . ']' . "\n";
                 }
                 //$buffer = getUrl("https://www.google.com/search?source=ig&hl=en&rlz=&btnG=Google+Search&aq=f&oq=&q=".urlencode($moviename.' site:imdb.com'));
                 $buffer = Utility::getUrl(['url' => 'http://www.bing.com/search?&q=' . urlencode($moviename . ' site:imdb.com')]);
                 // make sure we got some data
                 if ($buffer !== false && strlen($buffer)) {
                     $imdbId = $this->parseImdbFromNfo($buffer);
                     if ($imdbId !== false) {
                         //update release with imdb id
                         $this->pdo->queryExec(sprintf("update releases SET imdbid = %s WHERE id = %d", $this->pdo->escapeString($imdbId), $arr["id"]));
                         //check for existing movie entry
                         $movCheck = $this->getMovieInfo($imdbId);
                         if ($movCheck === false || isset($movCheck['updateddate']) && time() - strtotime($movCheck['updateddate']) > 2592000) {
                             $movieId = $this->updateMovieInfo($imdbId);
                         }
                     } else {
                         //no imdb id found, set to all zeros so we dont process again
                         $this->pdo->queryExec(sprintf("update releases SET imdbid = %d WHERE id = %d", 0, $arr["id"]));
                     }
                 } else {
                     //url fetch failed, will try next run
                 }
             } else {
                 //no valid movie name found, set to all zeros so we dont process again
                 $this->pdo->queryExec(sprintf("update releases SET imdbid = %d WHERE id = %d", 0, $arr["id"]));
             }
         }
     }
 }
开发者ID:engine9-,项目名称:newznab-tmux,代码行数:61,代码来源:Movie.php

示例10: processMusicReleases

 /**
  *
  */
 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.'));
         }
     }
 }
开发者ID:engine9-,项目名称:newznab-tmux,代码行数:60,代码来源:Musik.php

示例11: updateName

 /**
  * update a release name
  *
  * @param Settings $pdo
  * @param    $id
  * @param    $oldname
  * @param    $newname
  */
 private function updateName(Settings $pdo, $id, $oldname, $newname)
 {
     if ($this->verbose) {
         echo sprintf("OLD : %s\nNEW : %s\n\n", $oldname, $newname);
     }
     if (!$this->echoonly) {
         $this->pdo->queryExec(sprintf("update releases set name=%s, searchname = %s WHERE id = %d", $this->pdo->escapeString($newname), $this->pdo->escapeString($newname), $id));
     }
 }
开发者ID:engine9-,项目名称:newznab-tmux,代码行数:17,代码来源:Parsing.php

示例12: _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 string|int $status
     * @param int $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));
        }
    }
开发者ID:RickDB,项目名称:newznab-tmux,代码行数:17,代码来源:NameFixer.php

示例13: setRageNotFound

    private function setRageNotFound($Id)
    {
        if ($Id) {
            $this->pdo->queryExec(sprintf('
						UPDATE releases
						SET rageid = -2
						WHERE %s
						AND id = %d', $this->catWhere, $Id));
        }
    }
开发者ID:RickDB,项目名称:newznab-tmux,代码行数:10,代码来源:TvRage.php

示例14: updateAniDBInfoEps

    /**
     * Updates existing anime info in anidb info/episodes tables
     *
     * @param array $AniDBInfoArray
     *
     * @return string
     */
    private function updateAniDBInfoEps($AniDBInfoArray = array())
    {
        $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'];
    }
开发者ID:RickDB,项目名称:newznab-tmux,代码行数:19,代码来源:AniDB.php

示例15: checkPre

    /**
     * Attempts to match PreDB titles to releases.
     *
     * @param $dateLimit
     */
    public function checkPre($dateLimit = false)
    {
        $this->dateLimit = $dateLimit;
        $consoleTools = new ConsoleTools(['ColorCLI' => $this->pdo->log]);
        $updated = 0;
        $datesql = '';
        if ($this->echooutput) {
            echo $this->pdo->log->header('Querying DB for release search names not matched with PreDB titles.');
        }
        if ($this->dateLimit !== false && is_numeric($this->dateLimit)) {
            $datesql = sprintf('AND DATEDIFF(NOW(), adddate) <= %d', $this->dateLimit);
        }
        $res = $this->pdo->queryDirect(sprintf('
							SELECT p.id AS prehashid, r.id AS releaseid
							FROM prehash p
							INNER JOIN releases r ON p.title = r.searchname
							WHERE r.prehashid < 1 %s', $datesql));
        if ($res !== false) {
            $total = $res->rowCount();
            echo $this->pdo->log->primary(number_format($total) . ' releases to match.');
            if ($res instanceof Traversable) {
                foreach ($res as $row) {
                    $this->pdo->queryExec(sprintf('UPDATE releases SET prehashid = %d WHERE id = %d', $row['prehashid'], $row['releaseid']));
                    if ($this->echooutput) {
                        $consoleTools->overWritePrimary('Matching up preDB titles with release searchnames: ' . $consoleTools->percentString(++$updated, $total));
                    }
                }
                if ($this->echooutput) {
                    echo PHP_EOL;
                }
            }
            if ($this->echooutput) {
                echo $this->pdo->log->header('Matched ' . number_format($updated > 0 ? $updated : 0) . ' PreDB titles to release search names.');
            }
        }
    }
开发者ID:engine9-,项目名称:newznab-tmux,代码行数:41,代码来源:PreHash.php


注:本文中的newznab\db\Settings::queryExec方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。