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


PHP Misc::setCoversConstant方法代碼示例

本文整理匯總了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.");
開發者ID:kaibosh,項目名稱:nZEDb,代碼行數:31,代碼來源:updateGamesImages.php

示例2: setCovers

 public function setCovers()
 {
     $path = $this->getSetting(['section' => 'site', 'subsection' => 'main', 'name' => 'coverspath', 'setting' => 'coverspath']);
     Misc::setCoversConstant($path);
 }
開發者ID:kaibosh,項目名稱:nZEDb,代碼行數:5,代碼來源:Settings.php


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