本文整理汇总了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;
}