本文整理汇总了PHP中logger::err方法的典型用法代码示例。如果您正苦于以下问题:PHP logger::err方法的具体用法?PHP logger::err怎么用?PHP logger::err使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类logger
的用法示例。
在下文中一共展示了logger::err方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: onHeader
function onHeader($event, $data)
{
if (config::get('ganalytics.account') == NULL) {
logger::err("No Google Analytics account key set in configuration");
return;
}
printf("<script type=\"text/javascript\">");
printf("var _gaq = _gaq || [];");
printf("_gaq.push(['_setAccount', '%s']);", config::get('ganalytics.account'));
printf("_gaq.push(['_setDomainName', '%s']);", request::getDomain());
printf("_gaq.push(['_trackPageview']);");
printf("</script>");
printf("<script type=\"text/javascript\"> (function() { var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); })(); </script>");
}
示例2: addAction
public function addAction()
{
$question = $this->_getParam('question');
$question = Zend_Filter::filterStatic($question, 'StripTags');
$question = Zend_Filter::filterStatic($question, 'StringTrim');
if (!empty($question)) {
$poll = new Poll_Question();
$poll->setTitle($question);
$poll->save();
$this->_helper->json(array("success" => true, 'id' => $poll->getId()));
} else {
logger::err("Poll_Plugin: Could not create poll, question must be defined");
$this->_helper->json(array("success" => false));
}
}
示例3: maintenance
/**
* Hook called when maintenance script is called
*/
public function maintenance()
{
if (self::isInstalled()) {
$currentHour = date("H", time());
$configArray = self::getSearchConfigArray();
//Frontend recrawl
$lastStarted = $configArray['search']['frontend']['crawler']['started'];
$lastFinished = $configArray['search']['frontend']['crawler']['finished'];
$running = $configArray['search']['frontend']['crawler']['running'];
$aDayAgo = time() - 24 * 60 * 60;
$forceStart = $configArray['search']['frontend']['crawler']['forceStart'];
if ($configArray['search']['frontend']['enabled'] and (!$running and $lastStarted <= $aDayAgo and $currentHour > 1 and $currentHour < 3 or $forceStart)) {
logger::debug("starting frontend recrawl...");
$this->frontendCrawl($configArray);
SearchPhp_Tool::generateSitemap();
} else {
if ($running and $lastFinished <= $aDayAgo) {
//there seems to be a problem
if ($lastFinished <= $aDayAgo) {
logger::err("Search_PluginPhp: There seems to be a problem with the search crawler! Trying to stop it.");
}
$this->stopFrontendCrawler(false, false);
}
}
} else {
logger::debug("SearchPhp Plugin is not installed - no maintaince to do for this plugin.");
}
}
示例4: runIndexer
public static function runIndexer($index_name = null)
{
if (is_null($index_name)) {
$index_name = "--all";
}
$lockfile = SPHINX_VAR . DIRECTORY_SEPARATOR . "lock.txt";
$output = array();
try {
$indexer = SphinxSearch_Config_Plugin::getValue("path", "indexer");
} catch (Exception $e) {
$indexer = "/usr/bin/indexer";
}
if (!(is_file($indexer) && is_executable($indexer))) {
$message = "SphinxSearch Indexer could not be executed at " . $indexer;
logger::err($message);
$output[] = $message;
$return_var = 1;
} else {
$fp = @fopen($lockfile, "a+");
if ($fp === false) {
$message = "SphinxSearch Indexer could open lockfile " . $lockfile;
logger::err($message);
$output[] = $message;
$return_var = 1;
} else {
if (flock($fp, LOCK_EX | LOCK_NB)) {
logger::debug("SphinxSearch Indexer locked with " . $lockfile);
ftruncate($fp, 0);
fwrite($fp, getmypid());
fflush($fp);
$return_var = null;
exec("{$indexer} --config " . SPHINX_VAR . DIRECTORY_SEPARATOR . "sphinx.conf " . $index_name . (self::isSearchdRunning() ? " --rotate " : ""), $output, $return_var);
if ($return_var == 0) {
SphinxSearch_Config_Plugin::setValue("indexer", "lastrun", time());
}
flock($fp, LOCK_UN);
// release the lock
logger::debug("SphinxSearch Indexer unlocked" . $lockfile);
} else {
$message = "SphinxSearch Indexer is not executed: locked with " . $lockfile;
logger::err($message);
$output[] = $message;
$return_var = 1;
}
fclose($fp);
}
}
return array("output" => implode("\n", $output), "return_var" => $return_var);
}