當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Settings::queryDirect方法代碼示例

本文整理匯總了PHP中nzedb\db\Settings::queryDirect方法的典型用法代碼示例。如果您正苦於以下問題:PHP Settings::queryDirect方法的具體用法?PHP Settings::queryDirect怎麽用?PHP Settings::queryDirect使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在nzedb\db\Settings的用法示例。


在下文中一共展示了Settings::queryDirect方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: processAnimeReleases

    /**
     * Queues anime releases for processing
     */
    public function processAnimeReleases()
    {
        $results = $this->pdo->queryDirect(sprintf('
							SELECT searchname, id
							FROM releases
							WHERE nzbstatus = %d
							AND anidbid IS NULL
							AND categoryid = %d
							ORDER BY postdate DESC
							LIMIT %d', NZB::NZB_ADDED, Category::CAT_TV_ANIME, $this->aniqty));
        if ($results instanceof \Traversable) {
            $this->doRandomSleep();
            $this->padb = new \nzedb\db\populate\AniDB(['Echo' => $this->echooutput, 'Settings' => $this->pdo]);
            foreach ($results as $release) {
                $matched = $this->matchAnimeRelease($release);
                if ($matched === false) {
                    $this->pdo->queryExec(sprintf('
									UPDATE releases
									SET anidbid = %d
									WHERE id = %d', $this->status, $release['id']));
                }
            }
        } else {
            $this->pdo->log->doEcho($this->pdo->log->info("No work to process."), true);
        }
    }
開發者ID:kaibosh,項目名稱:nZEDb,代碼行數:29,代碼來源: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:sebst3r,項目名稱:nZEDb,代碼行數:60,代碼來源:Games.php

示例3: matchComments

    /**
     * Match added comments to releases.
     *
     * @access protected
     */
    protected function matchComments()
    {
        $res = $this->pdo->query('
			SELECT r.id, r.nzb_guid
			FROM releases r
			INNER JOIN release_comments rc ON rc.nzb_guid = r.nzb_guid
			WHERE rc.releaseid = 0');
        $found = count($res);
        if ($found > 0) {
            foreach ($res as $row) {
                $this->pdo->queryExec(sprintf("UPDATE release_comments SET releaseid = %d WHERE nzb_guid = %s", $row['id'], $this->pdo->escapeString($row['nzb_guid'])));
                $this->pdo->queryExec(sprintf('UPDATE releases SET comments = comments + 1 WHERE id = %d', $row['id']));
            }
            if (nZEDb_ECHOCLI) {
                echo '(Sharing) Matched ' . $found . ' comments.' . PHP_EOL;
            }
        }
        // Update first time seen.
        $siteTimes = $this->pdo->queryDirect('SELECT createddate, siteid FROM release_comments WHERE createddate > \'2005-01-01\' GROUP BY siteid ORDER BY createddate ASC');
        if ($siteTimes instanceof \Traversable && $siteTimes->rowCount()) {
            foreach ($siteTimes as $site) {
                $this->pdo->queryExec(sprintf('UPDATE sharing_sites SET first_time = %s WHERE site_guid = %s', $this->pdo->escapeString($site['createddate']), $this->pdo->escapeString($site['siteid'])));
            }
        }
    }
開發者ID:EeGgSs,項目名稱:nZEDb,代碼行數:30,代碼來源:Sharing.php

示例4: add

 public function add($form)
 {
     $content = $this->row2Object($form);
     $content = $this->validate($content);
     if ($content->ordinal == 1) {
         $this->pdo->queryDirect("UPDATE content SET ordinal = ordinal + 1 WHERE ordinal > 0");
     }
     return $this->data_add($content);
 }
開發者ID:Jay204,項目名稱:nZEDb,代碼行數:9,代碼來源:Contents.php

示例5: 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.'));
         }
     }
 }
開發者ID:sebst3r,項目名稱:nZEDb,代碼行數:60,代碼來源:Music.php

示例6: getMovieRange

 /**
  * Get movie releases with covers for movie browse page.
  *
  * @param       $cat
  * @param       $start
  * @param       $num
  * @param       $orderBy
  * @param       $maxAge
  * @param array $excludedCats
  *
  * @return bool|\PDOStatement
  */
 public function getMovieRange($cat, $start, $num, $orderBy, $maxAge = -1, $excludedCats = [])
 {
     $catsrch = '';
     if (count($cat) > 0 && $cat[0] != -1) {
         $catsrch = (new Category(['Settings' => $this->pdo]))->getCategorySearch($cat);
     }
     $order = $this->getMovieOrder($orderBy);
     $sql = sprintf("\n\t\t\tSELECT\n\t\t\tGROUP_CONCAT(r.id ORDER BY r.postdate DESC SEPARATOR ',') AS grp_release_id,\n\t\t\tGROUP_CONCAT(r.rarinnerfilecount ORDER BY r.postdate DESC SEPARATOR ',') as grp_rarinnerfilecount,\n\t\t\tGROUP_CONCAT(r.haspreview ORDER BY r.postdate DESC SEPARATOR ',') AS grp_haspreview,\n\t\t\tGROUP_CONCAT(r.passwordstatus ORDER BY r.postdate DESC SEPARATOR ',') AS grp_release_password,\n\t\t\tGROUP_CONCAT(r.guid ORDER BY r.postdate DESC SEPARATOR ',') AS grp_release_guid,\n\t\t\tGROUP_CONCAT(rn.id ORDER BY r.postdate DESC SEPARATOR ',') AS grp_release_nfoid,\n\t\t\tGROUP_CONCAT(groups.name ORDER BY r.postdate DESC SEPARATOR ',') AS grp_release_grpname,\n\t\t\tGROUP_CONCAT(r.searchname ORDER BY r.postdate DESC SEPARATOR '#') AS grp_release_name,\n\t\t\tGROUP_CONCAT(r.postdate ORDER BY r.postdate DESC SEPARATOR ',') AS grp_release_postdate,\n\t\t\tGROUP_CONCAT(r.size ORDER BY r.postdate DESC SEPARATOR ',') AS grp_release_size,\n\t\t\tGROUP_CONCAT(r.totalpart ORDER BY r.postdate DESC SEPARATOR ',') AS grp_release_totalparts,\n\t\t\tGROUP_CONCAT(r.comments ORDER BY r.postdate DESC SEPARATOR ',') AS grp_release_comments,\n\t\t\tGROUP_CONCAT(r.grabs ORDER BY r.postdate DESC SEPARATOR ',') AS grp_release_grabs,\n\t\t\tm.*, groups.name AS group_name, rn.id as nfoid FROM releases r\n\t\t\tLEFT OUTER JOIN groups ON groups.id = r.group_id\n\t\t\tLEFT OUTER JOIN release_nfos rn ON rn.releaseid = r.id\n\t\t\tINNER JOIN movieinfo m ON m.imdbid = r.imdbid\n\t\t\tWHERE r.nzbstatus = 1 AND r.imdbid != '0000000'\n\t\t\tAND m.title != ''\n\t\t\tAND r.passwordstatus <= %d AND %s %s %s %s\n\t\t\tGROUP BY m.imdbid ORDER BY %s %s %s", $this->showPasswords, $this->getBrowseBy(), $catsrch, $maxAge > 0 ? 'AND r.postdate > NOW() - INTERVAL ' . $maxAge . 'DAY ' : '', count($excludedCats) > 0 ? ' AND r.categoryid NOT IN (' . implode(',', $excludedCats) . ')' : '', $order[0], $order[1], $start === false ? '' : ' LIMIT ' . $num . ' OFFSET ' . $start);
     return $this->pdo->queryDirect($sql);
 }
開發者ID:sebst3r,項目名稱:nZEDb,代碼行數:22,代碼來源:Movie.php

示例7: 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.'));
            }
        }
    }
開發者ID:Jay204,項目名稱:nZEDb,代碼行數:54,代碼來源:Console.php

示例8: getAnimeList

    /**
     * Retrieves a list of Anime titles, optionally filtered by starting character and title
     *
     * @param string $letter
     * @param string $animetitle
     * @return array|bool
     */
    public function getAnimeList($letter = '', $animetitle = '')
    {
        $regex = 'REGEXP';
        $rsql = '';
        if ($letter != '') {
            if ($letter == '0-9') {
                $letter = '[0-9]';
            }
            $rsql .= sprintf('AND at.title %s %s', $regex, $this->pdo->escapeString('^' . $letter));
        }
        $tsql = '';
        if ($animetitle != '') {
            $tsql .= sprintf('AND at.title %s', $this->pdo->likeString($animetitle, true, true));
        }
        return $this->pdo->queryDirect(sprintf('SELECT at.anidbid, at.title, ai.type, ai.categories, ai.rating, ai.startdate, ai.enddate
					FROM anidb_titles AS at LEFT JOIN anidb_info AS ai USING (anidbid)
					WHERE at.anidbid > 0 %s %s
					GROUP BY at.anidbid
					ORDER BY at.title ASC', $rsql, $tsql));
    }
開發者ID:EeGgSs,項目名稱:nZEDb,代碼行數:27,代碼來源:AniDB.php

示例9: purge

 /**
  * Purge a single group or all groups.
  *
  * @param int|string|bool $id The group ID. If false, purge all groups.
  */
 public function purge($id = false)
 {
     if ($id === false) {
         $this->resetall();
     } else {
         $this->reset($id);
     }
     $releaseArray = $this->pdo->queryDirect(sprintf("SELECT id, guid FROM releases %s", $id === false ? '' : 'WHERE group_id = ' . $id));
     if ($releaseArray instanceof \Traversable) {
         $releases = new Releases(['Settings' => $this->pdo, 'Groups' => $this]);
         $nzb = new NZB($this->pdo);
         $releaseImage = new ReleaseImage($this->pdo);
         foreach ($releaseArray as $release) {
             $releases->deleteSingle(['g' => $release['guid'], 'i' => $release['id']], $nzb, $releaseImage);
         }
     }
 }
開發者ID:kaibosh,項目名稱:nZEDb,代碼行數:22,代碼來源:Groups.php

示例10: writeNZBforReleaseId

    /**
     * Write an NZB to the hard drive for a single release.
     *
     * @param int    $relID   The ID of the release in the DB.
     * @param string $relGuid The guid of the release.
     * @param string $name    The name of the release.
     * @param string $cTitle  The name of the category this release is in.
     *
     * @return bool Have we successfully written the NZB to the hard drive?
     *
     * @access public
     */
    public function writeNZBforReleaseId($relID, $relGuid, $name, $cTitle)
    {
        $path = $this->buildNZBPath($relGuid, $this->nzbSplitLevel, true) . $relGuid . '.nzb.gz';
        $fp = gzopen($path, 'wb7');
        if ($fp) {
            $nzb_guid = '';
            gzwrite($fp, sprintf($this->_nzbHeadString, htmlspecialchars($cTitle, ENT_QUOTES, 'utf-8'), htmlspecialchars($name, ENT_QUOTES, 'utf-8')));
            $collections = $this->pdo->queryDirect($this->_collectionsQuery . $relID);
            if ($collections instanceof \Traversable) {
                foreach ($collections as $collection) {
                    $poster = htmlspecialchars($collection['fromname'], ENT_QUOTES, 'utf-8');
                    $binaries = $this->pdo->queryDirect(sprintf($this->_binariesQuery, $collection['id']));
                    if ($binaries instanceof \Traversable) {
                        foreach ($binaries as $binary) {
                            // Buffer segment writes, increases performance.
                            $string = '';
                            $parts = $this->pdo->queryDirect(sprintf($this->_partsQuery, $binary['id']));
                            if ($parts instanceof \Traversable) {
                                foreach ($parts as $part) {
                                    if ($nzb_guid === '') {
                                        $nzb_guid = $part['messageid'];
                                    }
                                    $string .= '  <segment bytes="' . $part['size'] . '" number="' . $part['partnumber'] . '">' . htmlspecialchars($part['messageid'], ENT_QUOTES, 'utf-8') . "</segment>\n";
                                }
                            }
                            gzwrite($fp, '<file poster="' . $poster . '" date="' . $collection['udate'] . '" subject="' . htmlspecialchars($binary['name'], ENT_QUOTES, 'utf-8') . ' (1/' . $binary['totalparts'] . ")\">\n <groups>\n  <group>" . $collection['groupname'] . "</group>\n </groups>\n <segments>\n" . $string . " </segments>\n</file>\n");
                        }
                    }
                }
            }
            gzwrite($fp, '</nzb>');
            gzclose($fp);
            if (is_file($path)) {
                // Mark release as having NZB and delete CBP.
                $this->pdo->queryExec(sprintf('
						UPDATE releases SET nzbstatus = %d %s WHERE id = %d;
						DELETE c, b, p FROM %s c JOIN %s b ON(c.id=b.collection_id) STRAIGHT_JOIN %s p ON(b.id=p.binaryid) WHERE c.releaseid = %d', NZB::NZB_ADDED, $nzb_guid === '' ? '' : ', nzb_guid = UNHEX( ' . $this->pdo->escapestring(md5($nzb_guid)) . ' )', $relID, $this->_tableNames['cName'], $this->_tableNames['bName'], $this->_tableNames['pName'], $relID));
                // Chmod to fix issues some users have with file permissions.
                chmod($path, 0777);
                return true;
            } else {
                echo "ERROR: {$path} does not exist.\n";
            }
        }
        return false;
    }
開發者ID:kaibosh,項目名稱:nZEDb,代碼行數:58,代碼來源:NZB.php

示例11: getPreFileNames

    public function getPreFileNames($args = [])
    {
        $timestart = time();
        $counter = $counted = 0;
        $limit = $orderby = '';
        $show = isset($args[2]) && $args[2] === 'show' ? 1 : 0;
        if (isset($args[1]) && is_numeric($args[1])) {
            $orderby = "ORDER BY r.id DESC";
            $limit = "LIMIT " . $args[1];
        }
        echo $this->pdo->log->header("\nMatch PreFiles ({$args[1]}) Started at " . date('g:i:s'));
        echo $this->pdo->log->primary("Matching predb filename to cleaned release_files.name.\n");
        $query = $this->pdo->queryDirect(sprintf('
							SELECT r.id AS releaseid, r.name, r.searchname,
								r.group_id, r.categoryid,
								rf.name AS filename
							FROM releases r
							INNER JOIN release_files rf ON r.id = rf.releaseid
							AND rf.name IS NOT NULL
							WHERE r.preid = 0
							GROUP BY r.id
							%s %s', $orderby, $limit));
        if ($query !== false) {
            $total = $query->rowCount();
            if ($total > 0 && $query instanceof \Traversable) {
                echo $this->pdo->log->header("\n" . number_format($total) . ' releases to process.');
                foreach ($query as $row) {
                    $success = $this->matchPredbFiles($row, 1, 1, true, $show);
                    if ($success === 1) {
                        $counted++;
                    }
                    if ($show === 0) {
                        $this->consoletools->overWritePrimary("Renamed Releases: [" . number_format($counted) . "] " . $this->consoletools->percentString(++$counter, $total));
                    }
                }
                echo $this->pdo->log->header("\nRenamed " . number_format($counted) . " releases in " . $this->consoletools->convertTime(TIME() - $timestart) . ".");
            } else {
                echo $this->pdo->log->info("\nNothing to do.");
            }
        }
    }
開發者ID:Atmos01,項目名稱:nZEDb,代碼行數:41,代碼來源:NameFixer.php

示例12: postComment

    /**
     * @note  Post comment for the release if that release has no comment for failure.
     *        Only one user is allowed to post comment for that release, rest will just
     *        update the failed count in dnzb_failures table
     *
     * @param $relid
     * @param $uid
     */
    public function postComment($relid, $uid)
    {
        $dupe = 0;
        $text = 'This release has failed to download properly. It might fail for other users too.
		This comment is automatically generated.';
        $check = $this->pdo->queryDirect(sprintf('
				SELECT text
				FROM release_comments
				WHERE releaseid = %d', $relid));
        if ($check instanceof \Traversable) {
            foreach ($check as $dbl) {
                if ($dbl['text'] == $text) {
                    $dupe = 1;
                    break;
                }
            }
        }
        if ($dupe === 0) {
            $this->rc->addComment($relid, $text, $uid, '');
        }
    }
開發者ID:zetas,項目名稱:nZEDb,代碼行數:29,代碼來源:DnzbFailures.php

示例13: processBookReleases

    /**
     * Process book releases, 1 category at a time.
     */
    public function processBookReleases()
    {
        $bookids = [];
        if (preg_match('/^\\d+$/', $this->bookreqids)) {
            $bookids[] = $this->bookreqids;
        } else {
            $bookids = explode(', ', $this->bookreqids);
        }
        $total = count($bookids);
        if ($total > 0) {
            for ($i = 0; $i < $total; $i++) {
                $this->processBookReleasesHelper($this->pdo->queryDirect(sprintf('
						SELECT searchname, id, categoryid
						FROM releases
						WHERE nzbstatus = 1 %s
						AND bookinfoid IS NULL
						AND categoryid in (%s)
						ORDER BY postdate
						DESC LIMIT %d', $this->renamed, $bookids[$i], $this->bookqty)), $bookids[$i]);
            }
        }
    }
開發者ID:egandt,項目名稱:nZEDb,代碼行數:25,代碼來源:Books.php

示例14: exit

    exit($pdo->log->error("This script is not intended to be run manually, it is called from groupfixrelnames_threaded.py."));
} else {
    if (isset($argv[1])) {
        $namefixer = new NameFixer(['Settings' => $pdo]);
        $pieces = explode(' ', $argv[1]);
        $guidChar = $pieces[1];
        $maxperrun = $pieces[2];
        $thread = $pieces[3];
        switch (true) {
            case $pieces[0] === 'nfo' && isset($guidChar) && isset($maxperrun) && is_numeric($maxperrun):
                $releases = $pdo->queryDirect(sprintf('
								SELECT r.id AS releaseid, r.guid, r.group_id, r.categoryid, r.name, r.searchname,
									uncompress(nfo) AS textstring
								FROM releases r
								INNER JOIN release_nfos rn ON r.id = rn.releaseid
								WHERE r.guid %s
								AND r.nzbstatus = 1
								AND r.proc_nfo = 0
								AND r.nfostatus = 1
								AND r.preid = 0
								ORDER BY r.postdate DESC
								LIMIT %s', $pdo->likeString($guidChar, false, true), $maxperrun));
                if ($releases instanceof \Traversable) {
                    foreach ($releases as $release) {
                        if (preg_match('/^=newz\\[NZB\\]=\\w+/', $release['textstring'])) {
                            $namefixer->done = $namefixer->matched = false;
                            $pdo->queryDirect(sprintf('UPDATE releases SET proc_nfo = 1 WHERE id = %d', $release['releaseid']));
                            $namefixer->checked++;
                            echo '.';
                        } else {
                            $namefixer->done = $namefixer->matched = false;
                            if ($namefixer->checkName($release, true, 'NFO, ', 1, 1) !== true) {
開發者ID:kaibosh,項目名稱:nZEDb,代碼行數:32,代碼來源:groupfixrelnames.php

示例15: exit

    exit($pdo->log->error("\nThis script will check all images in covers/xxx and compare to db->xxxinfo.\nTo run:\nphp {$argv['0']} true\n"));
}
$row = $pdo->queryOneRow("SELECT value FROM settings WHERE setting = 'coverspath'");
if ($row !== false) {
    \nzedb\utility\Utility::setCoversConstant($row['value']);
} else {
    die("Unable to set Covers' constant!\n");
}
$path2covers = nZEDb_COVERS . 'xxx' . DS;
$dirItr = new RecursiveDirectoryIterator($path2covers);
$itr = new RecursiveIteratorIterator($dirItr, RecursiveIteratorIterator::LEAVES_ONLY);
foreach ($itr as $filePath) {
    if (is_file($filePath) && preg_match('/-cover\\.jpg/', $filePath)) {
        preg_match('/(\\d+)-cover\\.jpg/', basename($filePath), $match);
        if (isset($match[1])) {
            $run = $pdo->queryDirect("UPDATE xxxinfo SET cover = 1 WHERE cover = 0 AND id = " . $match[1]);
            if ($run->rowCount() >= 1) {
                $covers++;
            } else {
                $run = $pdo->queryDirect("SELECT id FROM xxxinfo WHERE id = " . $match[1]);
                if ($run->rowCount() == 0) {
                    echo $pdo->log->info($filePath . " not found in db.");
                }
            }
        }
    }
    if (is_file($filePath) && preg_match('/-backdrop\\.jpg/', $filePath)) {
        preg_match('/(\\d+)-backdrop\\.jpg/', basename($filePath), $match1);
        if (isset($match1[1])) {
            $run = $pdo->queryDirect("UPDATE xxxinfo SET backdrop = 1 WHERE backdrop = 0 AND id = " . $match1[1]);
            if ($run->rowCount() >= 1) {
開發者ID:Jay204,項目名稱:nZEDb,代碼行數:31,代碼來源:updateXXXImages.php


注:本文中的nzedb\db\Settings::queryDirect方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。