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


PHP Sites::getUnappliedPatches方法代碼示例

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


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

示例1: 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);
            }
        }
    }
}
開發者ID:RickDB,項目名稱:newznab-tmux,代碼行數:30,代碼來源:update_database_version.php

示例2: addmsg

}
if ($page->site->rawretentiondays > 10) {
    $statusmsgs[] = addmsg("Binary header retention is set at " . $page->site->rawretentiondays . ". Having this value any higher than 2 can cause the database to grow very large.", "site-edit.php");
}
if ($page->site->newznabID == "") {
    $statusmsgs[] = addmsg("Newznab ID missing. You have not entered a newznab ID, and will not be using the latest matching regex's.", "http://www.newznab.com/chat.html", "exclamation");
}
//
// database patches uptodate
//
$s = new Sites();
if (!property_exists($page->site, "dbversion")) {
    $db = new DB();
    $db->queryInsert('INSERT INTO site (setting, value, updateddate ) VALUES (\'dbversion\', \'$Rev: 2248 $\', now())');
    $page->site = $s->get();
}
if (!preg_match("/\\d+/", $page->site->dbversion, $matches)) {
    $statusmsgs[] = addmsg("Bad database version. " . $page->site->dbversion . " cannot be parsed.", "http://newznab.readthedocs.org/en/latest/install/#updating", "exclamation");
}
$patches = $s->getUnappliedPatches($page->site);
$patches = array_map("basename", $patches);
if (count($patches) > 0) {
    $statusmsgs[] = addmsg("Database out of date. Ensure all database patches in /db/patch/0.2.3/ are ran by using the script misc/update_scripts/update_database_version.php<br/><small>" . implode("<br/>", $patches) . "</small>", "http://newznab.readthedocs.org/en/latest/install/#updating", "exclamation");
}
$page->smarty->assign('statusmsgs', $statusmsgs);
$page->content = $page->smarty->fetch('index.tpl');
$page->render();
function addmsg($msg, $url = "", $icon = "")
{
    return array('msg' => $msg, 'url' => $url, 'icon' => $icon == "" ? "information" : $icon);
}
開發者ID:scriptzteam,項目名稱:newzNZB-premium-indexer,代碼行數:31,代碼來源:index.php


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