本文整理汇总了PHP中EventLog::log方法的典型用法代码示例。如果您正苦于以下问题:PHP EventLog::log方法的具体用法?PHP EventLog::log怎么用?PHP EventLog::log使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类EventLog
的用法示例。
在下文中一共展示了EventLog::log方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: filter_default_rewrite_rules
public function filter_default_rewrite_rules($rules)
{
if ($this->current_load() > self::KILL_LOAD) {
foreach ($rules as $key => $rule) {
if (strpos($rule['build_str'], 'admin') !== false) {
$rules[$key]['handler'] = 'UserThemeHandler';
$rules[$key]['action'] = 'display_throttle';
}
}
if (Options::get('throttle') == '') {
EventLog::log(sprintf(_t('Kill - Load is %s'), $this->current_load()));
Options::set('throttle', 'kill');
}
} elseif ($this->current_load() > self::MAX_LOAD) {
foreach ($rules as $key => $rule) {
if ($rule['name'] == 'search') {
unset($rules[$key]);
}
}
$rules[] = array('name' => 'search', 'parse_regex' => '%^search(?:/(?P<criteria>[^/]+))?(?:/page/(?P<page>\\d+))?/?$%i', 'build_str' => 'search(/{$criteria})(/page/{$page})', 'handler' => 'UserThemeHandler', 'action' => 'display_throttle', 'priority' => 8, 'description' => 'Searches posts');
if (Options::get('throttle') == '') {
EventLog::log(sprintf(_t('Restrict - Load is %s'), $this->current_load()));
Options::set('throttle', 'restrict');
}
} else {
if (Options::get('throttle') != '') {
EventLog::log(sprintf(_t('Normal - Load is %s'), $this->current_load()));
Options::set('throttle', '');
}
}
return $rules;
}
示例2: filter_optimize_database
public function filter_optimize_database($result, $paramarray)
{
$space_saved = 0;
$tables = 0;
switch (DB::get_driver_name()) {
case 'mysql':
$q = 'SHOW TABLE STATUS WHERE data_free > 0';
$tables = DB::get_results($q);
if (count($tables) > 0) {
foreach ($tables as $table) {
$q2 = 'OPTIMIZE TABLE ' . $table->Name;
if (DB::query($q2)) {
$space_saved += $table->Data_free;
$tables++;
}
}
EventLog::log('Database Tables Optimized. ' . Utils::human_size($space_saved) . ' reclaimed from ' . HabariLocale::_n('table', 'tables', $tables) . '.');
}
$result = true;
break;
case 'sqlite':
if (DB::exec('VACUUM')) {
$result = true;
EventLog::log('SQLite database VACUUM\'ed successfully.');
} else {
$result = false;
}
break;
default:
$result = false;
break;
}
return $result;
}
示例3: __static
/**
* Constructor for RenderCache
*
* Sets up paths and gets the list of groups from file
*/
public static function __static()
{
//Define the cache path and url
self::$cache_path = HABARI_PATH . '/' . self::$rel_cache_path;
self::$cache_url = Site::get_url('habari') . '/' . self::$rel_cache_path;
//If the cache directory doesn't exist, make it
if (!is_dir(self::$cache_path)) {
mkdir(self::$cache_path, 0755);
}
//Enable only if the cache directory now exists and is writable
self::$enabled = is_dir(self::$cache_path) && is_writeable(self::$cache_path);
//Give an error if the cache directory is not writable
if (!self::$enabled) {
Session::error(sprintf(_t("The cache directory '%s' is not writable - the cache is disabled. The user, or group, which your web server is running as, needs to have read, write, and execute permissions on this directory."), self::$cache_path), 'RenderCache');
EventLog::log(sprintf(_t("The cache directory '%s' is not writable - the cache is disabled."), self::$cache_path), 'notice', 'RenderCache', 'habari');
return;
}
//Get the list of group names
$group_file = self::get_group_list_file();
if (file_exists($group_file)) {
self::$group_list = unserialize(file_get_contents($group_file));
} else {
self::$group_list = array();
}
}
示例4: filter_linkit_fetch
public function filter_linkit_fetch($success)
{
$stats = $this->api_getstats();
EventLog::log(_t('Running dashboard fetch for 123LinkIt', 'linkit'), 'info', null, null, $stats);
Options::set('linkit__stats', $stats);
return $success;
}
示例5: filter_rssblocks_update
public function filter_rssblocks_update($success, $force = false)
{
EventLog::log('Running rrsblocks update');
$blocks = DB::get_results('SELECT b.* FROM {blocks} b WHERE b.type = ?', array('rssblock'), 'Block');
Plugins::act('get_blocks', $blocks);
$success = true;
foreach ($blocks as $block) {
$cachename = array('rssblock', md5($block->feed_url));
if ($force || Cache::expired($cachename)) {
$r = new RemoteRequest($block->feed_url);
$r->set_timeout(10);
$r->execute();
$feed = $r->get_response_body();
try {
if (is_string($feed)) {
new SimpleXMLElement($feed);
// This throws an exception if the feed isn't valid
Cache::set($cachename, $feed, 3600, true);
}
} catch (Exception $e) {
$success = false;
}
}
}
Session::notice('ran rssblocks update');
return $success;
}
示例6: action_admin_moderate_comments
function action_admin_moderate_comments($action, $comments, $handler)
{
if ($action == 'approve' || $action == 'approved') {
foreach ($comments as $c) {
$this->update_post_modified($c->post_id);
EventLog::log('bumped post ' . $c->post_id . ', by admin approval', 'info', 'default', 'bumping');
}
}
}
示例7: action_comment_insert_before
function action_comment_insert_before($comment)
{
// This plugin ignores non-comments and comments already marked as spam
if ($comment->type == Comment::COMMENT && $comment->status != Comment::STATUS_SPAM) {
$comment->status = Comment::STATUS_APPROVED;
EventLog::log('Comment by ' . $comment->name . ' automatically approved.', 'info', 'autoapprove', 'autoapprove');
}
return $comment;
}
示例8: __construct
/**
* Constructor for APCCache
*/
public function __construct()
{
$this->prefix = Options::get('private-GUID');
$this->enabled = extension_loaded('apc');
if (!$this->enabled) {
Session::error(_t("The APC Cache PHP module is not loaded - the cache is disabled.", "apccache"), 'filecache');
EventLog::log(_t("The APC Cache PHP module is not loaded - the cache is disabled.", "apccache"), 'notice', 'cache', 'apccache');
}
}
示例9: validate_captcha
/**
* Reject form submission (and repopulate the form) if the captcha fails.
* ...
* @return array Message to return upon failure
**/
public function validate_captcha($unused, $control, $form)
{
$solvemedia_response = solvemedia_check_answer(Options::get('solvemedia__vkey'), $_SERVER["REMOTE_ADDR"], $_POST["adcopy_challenge"], $_POST["adcopy_response"], Options::get('solvemedia__hkey'));
if ($solvemedia_response->is_valid) {
EventLog::log(_t('Comment by %s approved by SolveMedia captcha.', array($comment->name), 'solvemedia'), 'info', 'comment', 'SolveMedia');
} else {
return array(_t('Your CAPTCHA attempt did not succeed: %s', array($solvemedia_response->error), 'solvemedia'));
}
}
示例10: action_comment_insert_before
public function action_comment_insert_before($comment)
{
if ($comment->type == Comment::COMMENT && $comment->status != Comment::STATUS_SPAM) {
if ($this->check_comment($comment) === false) {
$comment->status = Comment::STATUS_SPAM;
EventLog::log(sprintf(_t("Comment by %s automatically marked as spam", 'simpleblacklist'), $comment->name), 'info', 'Simple Blacklist', 'plugin');
}
}
return $comment;
}
示例11: filter_activate_plugin
public function filter_activate_plugin($ok, $file)
{
// Don't bother loading if the gd library isn't active
if (!function_exists('imagecreatefromjpeg')) {
EventLog::log(_t("S3 Silo activation failed. PHP has not loaded the gd imaging library."), 'warning', 'plugin');
Session::error(_t("S3 Silo activation failed. PHP has not loaded the gd imaging library."));
$ok = false;
}
return $ok;
}
示例12: action_comment_insert_before
function action_comment_insert_before($comment)
{
// This plugin ignores non-comments and comments already marked as spam
if ($comment->type == Comment::COMMENT && $comment->status != Comment::STATUS_SPAM) {
if (Comments::get(array('email' => $comment->email, 'name' => $comment->name, 'url' => $comment->url, 'status' => Comment::STATUS_APPROVED))->count >= Options::get('preapproved__approved_count')) {
$comment->status = Comment::STATUS_APPROVED;
EventLog::log('Comment by ' . $comment->name . ' automatically approved.', 'info', 'PreApproved', 'PreApproved');
}
}
return $comment;
}
示例13: __construct
/**
* Constructor for MemcacheCache
*
* Sets up paths etc. and reads cache index, if it exists.
*/
public function __construct()
{
$this->prefix = Options::get('GUID');
$this->enabled = extension_loaded('memcache');
if ($this->enabled) {
$this->memcache = new Memcache();
$this->memcache->connect(Config::get('memcache_host', 'localhost'), Config::get('memcache_port', 11211));
$this->cache_index = $this->memcache->get('habari:cache:index');
} else {
Session::error(_t("The Memcache PHP module is not loaded - the cache is disabled.", "memcache"), 'memcachecache');
EventLog::log(_t("The Memcache PHP module is not loaded - the cache is disabled.", "memcache"), 'notice', 'cache', 'memcachecache');
}
}
示例14: action_init
public function action_init()
{
//$this->add_template('event.single', dirname(__FILE__) . '/event.single.php');
Post::add_new_type('imageset', false);
Post::add_new_type('image', false);
Post::add_new_type('gallery', false);
CpgDb::registerTables();
//Utils::debug('tables registered!');
if (CpgDb::DB_VERSION > CpgOptions::getDbVersion()) {
CpgDb::install();
EventLog::log('Updated CPG.');
CpgOptions::setDbVersion(CpgDb::DB_VERSION);
}
}
示例15: display
/**
* Helper function which automatically assigns all handler_vars
* into the theme and displays a theme template
*
* @param template_name Name of template to display ( note: not the filename )
*/
protected function display($template_name)
{
/*
* Assign internal variables into the theme ( and therefore into the theme's template
* engine. See Theme::assign().
*/
foreach ($this->handler_vars as $key => $value) {
$this->theme->assign($key, $value);
}
try {
$this->theme->display($template_name);
} catch (Error $e) {
EventLog::log($e->humane_error(), 'error', 'theme', 'habari', print_r($e, 1));
}
}