View source
<?php
function object_log_menu() {
$items = array();
$items['admin/reports/object_log'] = array(
'title' => 'Object log',
'description' => 'View objects saved in the object log.',
'page callback' => 'object_log_overview_page',
'access arguments' => array(
'access devel information',
),
'type' => MENU_NORMAL_ITEM,
'file' => 'object_log.admin.inc',
);
$items['admin/reports/object_log/%'] = array(
'title' => 'Object log',
'description' => 'View objects saved in the object log.',
'page callback' => 'object_log_object_page',
'page arguments' => array(
3,
),
'access arguments' => array(
'access devel information',
),
'type' => MENU_NORMAL_ITEM,
'file' => 'object_log.admin.inc',
);
return $items;
}
function object_log($label, $data) {
$fields = array(
'data' => serialize($data),
'created' => REQUEST_TIME,
);
db_merge('object_log')
->key(array(
'label' => $label,
))
->fields($fields)
->execute();
}
function object_log_retrieve($label) {
$result = db_query('SELECT label, data, created FROM {object_log} WHERE label = :label', array(
':label' => $label,
));
$log = $result
->fetchObject();
if (empty($log->data)) {
return FALSE;
}
$log->data = unserialize($log->data);
return $log;
}
function object_log_clear_log() {
db_delete('object_log')
->execute();
}