class UltimateCronCacheLogger in Ultimate Cron 7.2
Class for using cache as storage for logs.
Hierarchy
- class \UltimateCronPlugin
- class \UltimateCronLogger
- class \UltimateCronCacheLogger
- class \UltimateCronLogger
Expanded class hierarchy of UltimateCronCacheLogger
File
- plugins/
ultimate_cron/ logger/ cache.class.php, line 10 - Cache logger for Ultimate Cron.
View source
class UltimateCronCacheLogger extends UltimateCronLogger {
public $log_entry_class = 'UltimateCronCacheLogEntry';
/**
* Default settings.
*/
public function defaultSettings() {
return array(
'bin' => 'cache_ultimate_cron',
'timeout' => 0,
);
}
/**
* Load log entry.
*/
public function load($name, $lock_id = NULL, $log_types = array(
ULTIMATE_CRON_LOG_TYPE_NORMAL,
)) {
$log_entry = new $this->log_entry_class($name, $this);
$job = _ultimate_cron_job_load($name);
$settings = $job
->getSettings('logger');
if (!$lock_id) {
$cache = cache_get('uc-name:' . $name, $settings['bin']);
if (empty($cache) || empty($cache->data)) {
return $log_entry;
}
$lock_id = $cache->data;
}
$cache = cache_get('uc-lid:' . $lock_id, $settings['bin']);
if (!empty($cache->data)) {
$log_entry
->setData((array) $cache->data);
$log_entry->finished = TRUE;
}
return $log_entry;
}
/**
* Get log entries.
*/
public function getLogEntries($name, $log_types, $limit = 10) {
$log_entry = $this
->load($name);
return $log_entry->lid ? array(
$log_entry,
) : array();
}
/**
* Settings form.
*/
public function settingsForm(&$form, &$form_state, $job = NULL) {
$elements =& $form['settings'][$this->type][$this->name];
$values =& $form_state['values']['settings'][$this->type][$this->name];
$elements['bin'] = array(
'#type' => 'textfield',
'#title' => t('Cache bin'),
'#description' => t('Select which cache bin to use for storing logs.'),
'#default_value' => $values['bin'],
'#fallback' => TRUE,
'#required' => TRUE,
);
$elements['timeout'] = array(
'#type' => 'textfield',
'#title' => t('Cache timeout'),
'#description' => t('Seconds before cache entry expires (0 = never, -1 = on next general cache wipe).'),
'#default_value' => $values['timeout'],
'#fallback' => TRUE,
'#required' => TRUE,
);
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
UltimateCronCacheLogger:: |
public | property |
Overrides UltimateCronLogger:: |
|
UltimateCronCacheLogger:: |
public | function |
Default settings. Overrides UltimateCronPlugin:: |
|
UltimateCronCacheLogger:: |
public | function |
Get log entries. Overrides UltimateCronLogger:: |
|
UltimateCronCacheLogger:: |
public | function |
Load log entry. Overrides UltimateCronLogger:: |
|
UltimateCronCacheLogger:: |
public | function |
Settings form. Overrides UltimateCronPlugin:: |
|
UltimateCronLogger:: |
public static | property | ||
UltimateCronLogger:: |
public | function | Begin capturing messages. | |
UltimateCronLogger:: |
public | function | PHP shutdown function callback. | |
UltimateCronLogger:: |
public static | function | Shutdown handler wrapper for catching messages. | |
UltimateCronLogger:: |
public | function | Create a new log entry. | |
UltimateCronLogger:: |
public | function | Factory method for creating a new unsaved log entry object. | |
UltimateCronLogger:: |
final public static | function | Invoke loggers watchdog hooks. | |
UltimateCronLogger:: |
public | function | Load latest log entry for multiple jobs. | 1 |
UltimateCronLogger:: |
final public static | function | Log to ultimate cron logs only. | |
UltimateCronLogger:: |
public | function | End message capturing. | |
UltimateCronPlugin:: |
public | property | ||
UltimateCronPlugin:: |
public static | property | ||
UltimateCronPlugin:: |
public static | property | ||
UltimateCronPlugin:: |
public static | property | 1 | |
UltimateCronPlugin:: |
public | property | ||
UltimateCronPlugin:: |
public | property | ||
UltimateCronPlugin:: |
public | property | ||
UltimateCronPlugin:: |
public | property | ||
UltimateCronPlugin:: |
public | property | 1 | |
UltimateCronPlugin:: |
public | function | Allow plugins to alter the allowed operations for a job. | 2 |
UltimateCronPlugin:: |
public | function | Clean form of empty fallback values. | |
UltimateCronPlugin:: |
public | function | A hook_cronapi() for plugins. | 1 |
UltimateCronPlugin:: |
public | function | A hook_cron_alter() for plugins. | 3 |
UltimateCronPlugin:: |
public | function | A hook_cron_post_invoke() for plugins. | |
UltimateCronPlugin:: |
public | function | A hook_cron_post_launch() for plugins. | |
UltimateCronPlugin:: |
public | function | A hook_cron_post_run() for plugins. | |
UltimateCronPlugin:: |
public | function | A hook_cron_post_schedule() for plugins. | 1 |
UltimateCronPlugin:: |
public | function | A hook_cron_pre_invoke() for plugins. | |
UltimateCronPlugin:: |
public | function | A hook_cron_pre_launch() for plugins. | |
UltimateCronPlugin:: |
public | function | A hook_cron_pre_run() for plugins. | |
UltimateCronPlugin:: |
public | function | A hook_cron_pre_schedule() for plugins. | 2 |
UltimateCronPlugin:: |
public static | function | Default settings form. | 1 |
UltimateCronPlugin:: |
public | function | Modified version drupal_array_get_nested_value(). | |
UltimateCronPlugin:: |
public static | function | Singleton factoryLogEntry. | |
UltimateCronPlugin:: |
public | function | Process fallback form parameters. | |
UltimateCronPlugin:: |
public | function | Format label for the plugin. | 1 |
UltimateCronPlugin:: |
public | function | Format verbose label for the plugin. | 1 |
UltimateCronPlugin:: |
public | function | Get default settings. | 1 |
UltimateCronPlugin:: |
public static | function | Get global plugin option. | |
UltimateCronPlugin:: |
public static | function | Get all global plugin options. | |
UltimateCronPlugin:: |
final public static | function | Invoke hook_cron_alter() on plugins. | |
UltimateCronPlugin:: |
final public static | function | Invoke hook_cron_post_invoke() on plugins. | |
UltimateCronPlugin:: |
final public static | function | Invoke hook_cron_post_launch() on plugins. | |
UltimateCronPlugin:: |
final public static | function | Invoke hook_cron_post_run() on plugins. | |
UltimateCronPlugin:: |
final public static | function | Invoke hook_cron_post_schedule() on plugins. | |
UltimateCronPlugin:: |
final public static | function | Invoke hook_cron_pre_invoke() on plugins. | |
UltimateCronPlugin:: |
final public static | function | Invoke hook_cron_pre_launch() on plugins. | |
UltimateCronPlugin:: |
final public static | function | Invoke hook_cron_pre_run() on plugins. | |
UltimateCronPlugin:: |
final public static | function | Invoke hook_cron_pre_schedule() on plugins. | |
UltimateCronPlugin:: |
public | function | Default plugin valid for all jobs. | 2 |
UltimateCronPlugin:: |
public static | function | Job settings form. | 1 |
UltimateCronPlugin:: |
public static | function | Job settings form submit handler. | 1 |
UltimateCronPlugin:: |
public static | function | Job settings form validate handler. | 1 |
UltimateCronPlugin:: |
public static | function | Set global plugin option. | |
UltimateCronPlugin:: |
public | function | Save settings to db. | |
UltimateCronPlugin:: |
public | function | Settings form submit handler. | 3 |
UltimateCronPlugin:: |
public | function | Settings form validate handler. | 1 |
UltimateCronPlugin:: |
public | function | Get label for a specific setting. | 3 |
UltimateCronPlugin:: |
public | function | Signal page for plugins. | 2 |
UltimateCronPlugin:: |
public static | function | Remove a global plugin option. | |
UltimateCronPlugin:: |
public static | function | Remove all global plugin options. | |
UltimateCronPlugin:: |
public | function | Constructor. | 1 |