当前位置: 首页>>代码示例>>PHP>>正文


PHP SourceFactory::createInstance方法代码示例

本文整理汇总了PHP中SourceFactory::createInstance方法的典型用法代码示例。如果您正苦于以下问题:PHP SourceFactory::createInstance方法的具体用法?PHP SourceFactory::createInstance怎么用?PHP SourceFactory::createInstance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SourceFactory的用法示例。


在下文中一共展示了SourceFactory::createInstance方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: while

 if ($limit != "0") {
     $stmt->setLimit($limit);
 }
 $count = $stmt->execute();
 if ($count == 0) {
     print "";
     exit;
 }
 $cursor = $stmt->getCursor();
 $res .= "<center><table>";
 $res .= "<tr><th>Title</th><th>Starting URL</th><th>Next crawl date</th><th class='priority'>Priority</th></tr><tbody>";
 while ($cursor->hasNext()) {
     $rs = $cursor->getNext();
     $query = array('$and' => array(array("type" => "cnx"), array("id" => intval($rs["type"]))));
     mg_get_value($mg, "plugins", "class_php", $query, $class);
     $source = SourceFactory::createInstance($class, $config, $id_account_current, $mg, $aLanguages, $aCountries);
     $source->load($rs);
     $res .= "<tr>";
     $res .= "<td class='name'>";
     $res .= $rs["name"] . " (id=" . $rs["id"] . ")";
     $res .= "</td>";
     $res .= "<td class='url'>";
     $res .= getStartingUrls($source->getUrl());
     $res .= "</td>";
     $res .= "<td>";
     $timestamp = $rs["crawl_nexttime"]->sec;
     $now = time();
     if ($now > $timestamp) {
         $res .= "As soon as possible<br />(originally scheduled at " . date('Y-m-d H:i:s', $rs["crawl_nexttime"]->sec) . ")";
     } else {
         $res .= date('Y-m-d H:i:s', $rs["crawl_nexttime"]->sec);
开发者ID:ejemba,项目名称:crawl-anywhere,代码行数:31,代码来源:content.status.ajax.inc.php

示例2: require_once_all

require_once_all('sources/*.inc.php');
$db = db_connect($config, "", "", "");
$stmt = new db_stmt_select("sources");
$stmt->addColumn("*");
$s = $stmt->getStatement();
$rs = $db->Execute($s);
if (!$rs) {
    echo "Error while reading sources table !";
    exit;
}
$count = 0;
while (!$rs->EOF) {
    $id = $rs->fields["id"];
    // load
    db_get_value($db, "plugins", "class_php", "id=" . $rs->fields["type"], $class);
    $source = SourceFactory::createInstance($class, $config, $id_account_current, $db, null, null);
    $source->load($rs->GetRowAssoc());
    // delete
    $delstmt = new db_stmt_delete('sources');
    $delstmt->setWhereClause("id = '" . $id . "'");
    $s = $delstmt->getStatement();
    if (!$db->Execute($s)) {
        echo 'Error while deleting record ' . $id;
        exit;
    } else {
        // insert
        $s = $source->getSqlStmt('insert');
        if (!$db->Execute($s)) {
            echo 'Error while writing record ' . $id;
            echo '</br>Stop upgrade (' . $count . ' sources upgraded)';
            echo '</br>' . $db->ErrorMsg();
开发者ID:swapnilphalak,项目名称:crawl-anywhere,代码行数:31,代码来源:upgrade_db_v300.php


注:本文中的SourceFactory::createInstance方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。