本文整理汇总了PHP中EventLog类的典型用法代码示例。如果您正苦于以下问题:PHP EventLog类的具体用法?PHP EventLog怎么用?PHP EventLog使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了EventLog类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: save
function save()
{
$rValue = false;
if ($this->name != "" && $this->project_id != "" && $this->version != "") {
global $dbh;
if ($this->file_id == 0) {
$this->file_id = $this->getFileID($this->name, $this->project_id, $this->version);
}
$sql = "INSERT INTO";
$where = "";
if ($this->file_id > 0) {
$sql = "UPDATE";
$where = " WHERE file_id = " . sqlSanitize($this->file_id, $dbh);
}
$Event = new EventLog("files", "file_id", $this->file_id, $sql);
$sql .= " files \n\t\t\t\t\t\tSET file_id \t= " . sqlSanitize($this->file_id, $dbh) . ",\n\t\t\t\t\t\t\tproject_id\t= " . returnQuotedString(sqlSanitize($this->project_id, $dbh)) . ", \n\t\t\t\t\t\t\tversion\t\t= " . returnQuotedString(sqlSanitize($this->version, $dbh)) . ", \n\t\t\t\t\t\t\tname\t\t= " . returnQuotedString(sqlSanitize($this->name, $dbh)) . ",\n\t\t\t\t\t\t\tplugin_id\t= " . returnQuotedString(sqlSanitize($this->plugin_id, $dbh)) . ",\n\t\t\t\t\t\t\tis_active\t= " . $this->is_active . $where;
if (mysql_query($sql, $dbh)) {
if ($this->file_id == 0) {
$this->file_id = mysql_insert_id($dbh);
$Event->key_value = $this->file_id;
}
$rValue = true;
$Event->add();
} else {
echo $sql . "\n";
$GLOBALS['g_ERRSTRS'][1] = mysql_error();
}
} else {
echo "ERROR: One missing:Name: " . $this->name . "Project: " . $this->project_id . "Version: " . $this->version;
}
return $rValue;
}
示例2: relayAction
public function relayAction($request)
{
if (!isset($this->settings['short' . $request->area])) {
return null;
}
$db = JFactory::getDBO();
$rewriting = array('short', 'tags', 'text', 'params');
foreach ($rewriting as $rw_name) {
$this->settings[$rw_name . $request->area] = AECToolbox::rewriteEngineRQ($this->settings[$rw_name . $request->area], $request);
}
$log_entry = new EventLog();
$log_entry->issue($this->settings['short' . $request->area], $this->settings['tags' . $request->area], $this->settings['text' . $request->area], $this->settings['level' . $request->area], $this->settings['params' . $request->area], $this->settings['force_notify' . $request->area], $this->settings['force_email' . $request->area]);
}
示例3: execute
/**
* Executes the cronjob.
*
* @param mixed $last_result What the last execution of this cronjob
* returned.
* @param Array $parameters Parameters for this cronjob instance which
* were defined during scheduling.
*/
public function execute($last_result, $parameters = array())
{
$event_log = new EventLog();
$event_log->cleanup_log_events();
if (!empty($parameters['cronjobs'])) {
$delete = function ($l) {
$l->delete();
};
if ($parameters['cronjobs-error'] > 0) {
CronjobLog::findEachBySql($delete, "exception != 'N;' AND executed + ? < UNIX_TIMESTAMP()", array($parameters['cronjobs-error'] * 24 * 60 * 60));
}
if ($parameters['cronjobs-success'] > 0) {
CronjobLog::findEachBySql($delete, "exception = 'N;' AND executed + ? < UNIX_TIMESTAMP()", array($parameters['cronjobs-success'] * 24 * 60 * 60));
}
}
}
示例4: filter_dash_module_latest_log_activity
/**
* filter_dash_module_latest_log_activity
* Sets theme variables and handles logic for the
* dashboard's log history module.
* @param string $module_id
* @return string The contents of the module
*/
public function filter_dash_module_latest_log_activity( $module, $module_id, $theme )
{
if ( false === ( $num_logs = Modules::get_option( $module_id, 'logs_number_display' ) ) ) {
$num_logs = 8;
}
$params = array(
'where' => array(
'user_id' => User::identify()->id
),
'orderby' => 'id DESC', /* Otherwise, exactly same timestamp values muck it up... Plus, this is more efficient to sort on the primary key... */
'limit' => $num_logs,
);
$theme->logs = EventLog::get( $params );
// Create options form
/* Commented out until fully implemented or it's decided to drop completely. See https://trac.habariproject.org/habari/ticket/1233
$form = new FormUI( 'dash_logs' );
$form->append( 'text', 'logs_number_display', 'option:' . Modules::storage_name( $module_id, 'logs_number_display' ), _t('Number of items') );
$form->append( 'submit', 'submit', _t('Submit') );
$form->properties['onsubmit'] = "dashboard.updateModule({$module_id}); return false;";
*/
$module['title'] = ( User::identify()->can( 'manage_logs' ) ? '<a href="' . Site::get_url('admin') . '/logs">' . _t('Latest Log Activity') . '</a>' : _t('Latest Log Activity') );
//$module['options'] = $form->get();
$module['content'] = $theme->fetch( 'dash_logs' );
return $module;
}
示例5: 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;
}
示例6: action_block_content_latest_log_activity
/**
* Produce the content for the latest log activity block
* @param Block $block The block object
* @param Theme $theme The theme that the block will be output with
*/
public function action_block_content_latest_log_activity($block, $theme)
{
$params = array('where' => array('user_id' => User::identify()->id), 'orderby' => 'id DESC', 'limit' => isset($block->logs_number_display) ? $block->logs_number_display : 8);
$block->logs = EventLog::get($params);
$block->link = URL::get('admin', array('page' => 'logs'));
$block->has_options = true;
}
示例7: __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();
}
}
示例8: 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;
}
示例9: 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;
}
示例10: migrate
function migrate()
{
global $conn;
$sql = getMigrateQueryHeader();
$sql .= Customer::getSchemaSQL();
$sql .= CustomerCar::getSchemaSQL();
$sql .= EventLog::getSchemaSQL();
$sql .= GreaseRatEvent::getSchemaSQL();
$sql .= RepairPost::getSchemaSQL();
$sql .= RepairType::getSchemaSQL();
$sql .= User::getSchemaSQL();
if ($conn->multi_query($sql)) {
do {
if ($result = $conn->store_result()) {
while ($row = $result->fetch_row()) {
printf("%s\n", $row[0]);
}
$result->free();
}
if ($conn->more_results()) {
printf("-----------------\n");
}
} while ($conn->next_result());
}
$conn->close();
}
示例11: 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;
}
示例12: load
function load($email, $password)
{
if ($email != "" && $password != "") {
if (eregi('^[a-zA-Z0-9._-]+@[a-zA-Z0-9._-]+\\.[a-zA-Z.]{2,5}$', $email)) {
global $addon;
$addon->callHook('user_authentication', array(&$this, $email, $password));
}
}
if ($this->userid > 0) {
$Event = new EventLog("users", "userid", $this->userid, "__auth_success");
$Event->add();
} else {
$Event = new EventLog("users", "userid", $_SERVER['REMOTE_ADDR'] . ":" . $email, "__auth_failure");
$Event->add();
}
return $this->userid;
}
示例13: 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;
}
示例14: 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');
}
}
}
示例15: action_auth_ajax_extendedlog
function action_auth_ajax_extendedlog($handler)
{
$log = EventLog::get(array('fetch_fn' => 'get_row', 'id' => $handler->handler_vars['log_id'], 'return_data' => true));
if (trim($log->data) == '') {
$log->data = 'No additional data was logged.';
}
echo $log->message . "<hr>\n";
echo $log->data;
}