'GET',
'callback' => 'aka_get_weekly_activity_log',
'permission_callback' => function () {
return current_user_can('manage_options');
},
));
});
function aka_get_weekly_activity_log() {
global $wpdb;
$seven_days_ago = time() - (7 * 24 * 60 * 60);
$table_occurrences = $wpdb->prefix . 'wsal_occurrences';
$table_metadata = $wpdb->prefix . 'wsal_metadata';
if ($wpdb->get_var("SHOW TABLES LIKE '$table_occurrences'") != $table_occurrences) {
return new WP_REST_Response(array('error' => 'WP Activity Log tables not found'), 404);
}
$results = $wpdb->get_results($wpdb->prepare(
"SELECT o.id, o.alert_id, o.user_id, o.user_roles, o.created_on, o.client_ip, o.severity,
m.name as meta_name, m.value as meta_value
FROM $table_occurrences o
LEFT JOIN $table_metadata m ON o.id = m.occurrence_id
WHERE o.created_on >= %d
ORDER BY o.created_on DESC
LIMIT 1000",
$seven_days_ago
), ARRAY_A);
$events = array();
foreach ($results as $row) {
$id = $row['id'];
if (!isset($events[$id])) {
$user = get_userdata($row['user_id']);
$events[$id] = array(
'id' => $row['id'],
'alert_id' => $row['alert_id'],
'user' => $user ? $user->user_login : 'system',
'user_roles' => $row['user_roles'],
'date' => date('Y-m-d H:i:s', $row['created_on']),
'ip' => $row['client_ip'],
'severity' => $row['severity'],
);
}
if ($row['meta_name'] && in_array($row['meta_name'], array('PostTitle', 'PostStatus', 'PageName', 'Username', 'CurrentUserRoles', 'TargetUsername'))) {
$events[$id][$row['meta_name']] = maybe_unserialize($row['meta_value']);
}
}
return new WP_REST_Response(array_values($events), 200);
}
'GET',
'callback' => 'aka_get_weekly_activity_log',
'permission_callback' => function () {
return current_user_can('manage_options');
},
));
});
function aka_get_weekly_activity_log() {
global $wpdb;
$seven_days_ago = time() - (7 * 24 * 60 * 60);
$table_occurrences = $wpdb->prefix . 'wsal_occurrences';
$table_metadata = $wpdb->prefix . 'wsal_metadata';
if ($wpdb->get_var("SHOW TABLES LIKE '$table_occurrences'") != $table_occurrences) {
return new WP_REST_Response(array('error' => 'WP Activity Log tables not found'), 404);
}
$results = $wpdb->get_results($wpdb->prepare(
"SELECT o.id, o.alert_id, o.user_id, o.user_roles, o.created_on, o.client_ip, o.severity,
m.name as meta_name, m.value as meta_value
FROM $table_occurrences o
LEFT JOIN $table_metadata m ON o.id = m.occurrence_id
WHERE o.created_on >= %d
ORDER BY o.created_on DESC
LIMIT 1000",
$seven_days_ago
), ARRAY_A);
$events = array();
foreach ($results as $row) {
$id = $row['id'];
if (!isset($events[$id])) {
$user = get_userdata($row['user_id']);
$events[$id] = array(
'id' => $row['id'],
'alert_id' => $row['alert_id'],
'user' => $user ? $user->user_login : 'system',
'user_roles' => $row['user_roles'],
'date' => date('Y-m-d H:i:s', $row['created_on']),
'ip' => $row['client_ip'],
'severity' => $row['severity'],
);
}
if ($row['meta_name'] && in_array($row['meta_name'], array('PostTitle', 'PostStatus', 'PageName', 'Username', 'CurrentUserRoles', 'TargetUsername'))) {
$events[$id][$row['meta_name']] = maybe_unserialize($row['meta_value']);
}
}
return new WP_REST_Response(array_values($events), 200);
}
'GET',
'callback' => 'aka_get_weekly_activity_log',
'permission_callback' => function () {
return current_user_can('manage_options');
},
));
});
function aka_get_weekly_activity_log() {
global $wpdb;
$seven_days_ago = time() - (7 * 24 * 60 * 60);
$table_occurrences = $wpdb->prefix . 'wsal_occurrences';
$table_metadata = $wpdb->prefix . 'wsal_metadata';
if ($wpdb->get_var("SHOW TABLES LIKE '$table_occurrences'") != $table_occurrences) {
return new WP_REST_Response(array('error' => 'WP Activity Log tables not found'), 404);
}
$results = $wpdb->get_results($wpdb->prepare(
"SELECT o.id, o.alert_id, o.user_id, o.user_roles, o.created_on, o.client_ip, o.severity,
m.name as meta_name, m.value as meta_value
FROM $table_occurrences o
LEFT JOIN $table_metadata m ON o.id = m.occurrence_id
WHERE o.created_on >= %d
ORDER BY o.created_on DESC
LIMIT 1000",
$seven_days_ago
), ARRAY_A);
Skip to content
Lorsqu'il s'agit de trouver des solutions fiables et abordables Acadie, ne cherchez pas plus loin que AKA Moving. Notre engagement pour l'excellence du service à la clientèleNotre expertise dans les domaines résidentiel et commerciaux Nos services de déménagement et notre souci d'assurer un transport sûr et efficace font de nous...