当前位置: 首页>>代码示例>>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;未经允许,请勿转载。