本文整理汇总了PHP中newznab\db\Settings::exec方法的典型用法代码示例。如果您正苦于以下问题:PHP Settings::exec方法的具体用法?PHP Settings::exec怎么用?PHP Settings::exec使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类newznab\db\Settings
的用法示例。
在下文中一共展示了Settings::exec方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: dirname
//This script will rerun all releases against Category.php
require_once dirname(__FILE__) . '/../../www/config.php';
use newznab\db\Settings;
$db = new Settings();
$category = new Categorize();
$changedcount = 0;
$rescount = 0;
//
// [1] change for all where the regex isnt aimed at a specific category (affects most releases)
//
//$res = $db->queryDirect("select r.id as id, r.searchname as searchname, g.name as groupname, r.categoryID as rcat from releases r, releaseregex rr, groups g where r.regexid=rr.id and g.ID = r.groupID and rr.categoryid is null");
//
// [2] update for all in a category
//
//$res = $db->queryDirect("select r.id as id, r.searchname as searchname, g.name as groupname, r.categoryID as rcat from releases r inner join groups g on g.ID = r.groupID where r.categoryID in (6010, 6020, 6030, 6040)");
//
// [3] reset all flac with hashed names
//
//$res = $db->queryDirect("select releases.ID as id, searchname as searchname, groups.name as groupname, releases.categoryID as rcat from releases join groups on groups.ID = releases.groupID where length(searchname) = 40 and groups.name like 'alt.binaries.sounds.flac'");
while ($rel = $db->getAssocArray($res)) {
$rescount++;
$categoryID = $category->determineCategory($rel['groupname'], $rel['searchname']);
if ($categoryID != $rel['rcat'] && $categoryID != '7900') {
$changedcount++;
echo "Changing category for " . $rel['searchname'] . " New (" . $categoryID . ") Old (" . $rel['rcat'] . ")\n";
$db->exec(sprintf("update releases SET categoryID = %d WHERE ID = %d", $categoryID, $rel['id']));
}
}
echo $rescount . " releases \n";
echo $changedcount . " releases changed\n";
示例2: Sites
<?php
require_once "config.php";
use newznab\db\Settings;
$s = new Sites();
$site = $s->get();
$patches = $s->getUnappliedPatches($site);
if (count($patches) == 0) {
echo "Patchn : No patches required applying. At version " . $site->dbversion . "\n";
} else {
echo "Patchn : Database at version " . $site->dbversion . "\n";
foreach ($patches as $patch) {
echo "Patchn : Executing patch " . basename($patch) . "\n";
$db = new Settings();
$rows = $db->query("select * from site");
$dbData = file_get_contents($patch);
//fix to remove BOM in UTF8 files
$bom = pack("CCC", 0xef, 0xbb, 0xbf);
if (0 == strncmp($dbData, $bom, 3)) {
$dbData = substr($dbData, 3);
}
$queries = explode(";", $dbData);
$queries = array_map("trim", $queries);
foreach ($queries as $q) {
if (strlen($q) > 0) {
$db->exec($q);
}
}
}
}
示例3: dirname
<?php
/*
Filesize Fix Script
If after import you have a bunch of zero sized releases run this
Author: lordgnu <lordgnu@me.com>
*/
require_once dirname(__FILE__) . '/../../www/config.php';
use newznab\db\Settings;
$pdo = new Settings();
$nzb = new NZB();
$items = $pdo->query("SELECT ID,guid FROM releases WHERE size = 0");
$total = count($items);
$compl = 0;
echo "Updating file size for " . count($items) . " release(s)\n";
while ($item = array_pop($items)) {
$nzbpath = $nzb->getNZBPath($item['guid'], $pdo->getSetting('nzbpath'));
ob_start();
@readgzfile($nzbpath);
$nzbfile = ob_get_contents();
ob_end_clean();
$ret = $nzb->nzbFileList($nzbfile);
$filesize = '0';
foreach ($ret as $file) {
$filesize = bcadd($filesize, $file['size']);
}
$pdo->exec("UPDATE releases SET size = '{$filesize}' WHERE `ID` = '{$item['ID']}' LIMIT 1");
$compl++;
echo sprintf("[%6d / %6d] %0.2f", $compl, $total, $compl / $total * 100) . '%' . "\n";
}
示例4: dirname
<?php
require_once dirname(__FILE__) . '/../../www/config.php';
use newznab\db\Settings;
$r = new Releases();
$rv = new ReleaseExtra();
$db = new Settings();
$rels = $db->query("select releaseID, videowidth, videoheight from releasevideo where definition is null");
foreach ($rels as $rel) {
$sql = sprintf("update releasevideo set definition = %d where releaseID = %d", $rv->determineVideoResolution($rel["videowidth"], $rel["videoheight"]), $rel["releaseID"]);
$db->exec($sql);
}