本文整理汇总了PHP中nzedb\utility\Misc::setCoversConstant方法的典型用法代码示例。如果您正苦于以下问题:PHP Misc::setCoversConstant方法的具体用法?PHP Misc::setCoversConstant怎么用?PHP Misc::setCoversConstant使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类nzedb\utility\Misc
的用法示例。
在下文中一共展示了Misc::setCoversConstant方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: realpath
<?php
require_once realpath(dirname(dirname(dirname(__DIR__))) . DIRECTORY_SEPARATOR . 'indexer.php');
use nzedb\db\Settings;
use nzedb\utility\Misc;
$pdo = new Settings();
$covers = $updated = $deleted = 0;
if ($argc == 1 || $argv[1] != 'true') {
exit($pdo->log->error("\nThis script will check all images in covers/games and compare to db->gamesinfo.\nTo run:\nphp {$argv['0']} true\n"));
}
$row = $pdo->queryOneRow("SELECT value FROM settings WHERE setting = 'coverspath'");
if ($row !== false) {
Misc::setCoversConstant($row['value']);
} else {
die("Unable to set Covers' constant!\n");
}
$path2covers = nZEDb_COVERS . 'games' . DS;
$dirItr = new \RecursiveDirectoryIterator($path2covers);
$itr = new \RecursiveIteratorIterator($dirItr, \RecursiveIteratorIterator::LEAVES_ONLY);
foreach ($itr as $filePath) {
if (is_file($filePath) && preg_match('/\\d+\\.jpg/', $filePath)) {
preg_match('/(\\d+)\\.jpg/', basename($filePath), $match);
if (isset($match[1])) {
$run = $pdo->queryDirect("UPDATE gamesinfo SET cover = 1 WHERE cover = 0 AND id = " . $match[1]);
if ($run !== false) {
if ($run->rowCount() >= 1) {
$covers++;
} else {
$run = $pdo->queryDirect("SELECT id FROM gamesinfo WHERE id = " . $match[1]);
if ($run !== false && $run->rowCount() == 0) {
echo $pdo->log->info($filePath . " not found in db.");
示例2: setCovers
public function setCovers()
{
$path = $this->getSetting(['section' => 'site', 'subsection' => 'main', 'name' => 'coverspath', 'setting' => 'coverspath']);
Misc::setCoversConstant($path);
}