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


PHP waModel::ping方法代碼示例

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


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

示例1: getSourceModel

 /**
  * @return waModel
  * @throws waException
  */
 private function getSourceModel()
 {
     if (!$this->source) {
         $this->source_path = $this->option('path');
         if (substr($this->source_path, -1) != '/') {
             $this->source_path .= '/';
         }
         if (!file_exists($this->source_path)) {
             throw new waException(sprintf(_wp('Invalid PATH %s; %s'), $this->source_path, _wp('directory not exists')));
         }
         if (!file_exists($this->source_path . 'kernel/wbs.xml')) {
             throw new waException(sprintf(_wp('Invalid PATH %s; %s'), $this->source_path, _wp('file kernel/wbs.xml not found')));
         }
         /**
          *
          * @var SimpleXMLElement $wbs
          */
         $wbs = simplexml_load_file($this->source_path . 'kernel/wbs.xml');
         $this->dbkey = (string) $wbs->FRONTEND['dbkey'];
         $dkey_path = $this->source_path . 'dblist/' . $this->dbkey . '.xml';
         if (empty($this->dbkey) || !file_exists($dkey_path)) {
             throw new waException(sprintf(_wp('Invalid PATH %s; %s'), $this->source_path, sprintf(_wp('invalid file %s'), 'dblist/' . $this->dbkey . '.xml')));
         }
         /**
          *
          * @var SimpleXMLElement $dblist
          */
         $dblist = simplexml_load_file($dkey_path);
         $host_name = (string) $dblist->DBSETTINGS['SQLSERVER'];
         $host = $wbs->xPath('/WBS/SQLSERVERS/SQLSERVER[@NAME="' . htmlentities($host_name, ENT_QUOTES, 'utf-8') . '"]');
         if (!count($host)) {
             throw new waException(_wp('Invalid SQL server name'));
         }
         $host = $host[0];
         $port = (string) $host['PORT'];
         $this->sql_options = array('host' => (string) $host['HOST'] . ($port ? ':' . $port : ''), 'user' => (string) $dblist->DBSETTINGS['DB_USER'], 'password' => (string) $dblist->DBSETTINGS['DB_PASSWORD'], 'database' => (string) $dblist->DBSETTINGS['DB_NAME'], 'type' => function_exists('mysqli_connect') ? 'mysqli' : 'mysql');
         $this->source = new waModel($this->sql_options);
     } else {
         $this->source->ping();
     }
     return $this->source;
 }
開發者ID:cjmaximal,項目名稱:webasyst-framework,代碼行數:46,代碼來源:blogImportPluginWebasystSameTransport.class.php

示例2: getContactByEmail

    protected function getContactByEmail($emails = array())
    {
        static $model;
        $sql = <<<SQL
SELECT
    wa_contact.id AS id,
    LOWER(wa_contact_emails.email) AS email
FROM
    wa_contact
JOIN
    wa_contact_emails
ON
    (wa_contact_emails.contact_id = wa_contact.id)
WHERE
    (wa_contact.is_user = 1)
AND
    (LOWER(wa_contact_emails.email) IN (s:emails))
SQL;
        if (!isset($model)) {
            $model = new waModel();
        }
        $model->ping();
        $contacts = array();
        if ($emails && ($contacts = $model->query($sql, array('emails' => $emails))->fetchAll('id', true))) {
            foreach ($contacts as $id => $email) {
                $contacts[$email] = $id;
            }
        }
        return $contacts;
    }
開發者ID:cjmaximal,項目名稱:webasyst-framework,代碼行數:30,代碼來源:blogImportPluginTransport.class.php


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