1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
|
<?php
if (!defined('ABSPATH')) exit; if (!class_exists('BVActLogCallback')) : require_once dirname( __FILE__ ) . '/../../wp_actlog.php';
class BVActLogCallback extends BVCallbackBase { public $db; public $settings;
public function __construct($callback_handler) { $this->db = $callback_handler->db; $this->settings = $callback_handler->settings; }
public function dropActLogTable() { return $this->db->dropBVTable(BVWPActLog::$actlog_table); }
public function createActLogTable($usedbdelta = false) { $db = $this->db; $charset_collate = $db->getCharsetCollate(); $table = $this->db->getBVTable(BVWPActLog::$actlog_table); $query = "CREATE TABLE $table ( id bigint(20) NOT NULL AUTO_INCREMENT, site_id int NOT NULL, user_id int DEFAULT 0, username text DEFAULT '', request_id text DEFAULT '', ip varchar(20) DEFAULT '', event_type varchar(40) NOT NULL DEFAULT '', event_data mediumtext NOT NULL, time int, PRIMARY KEY (id) ) $charset_collate;"; return $db->createTable($query, BVWPActLog::$actlog_table, $usedbdelta); }
public function process($request) { $settings = $this->settings; $params = $request->params; switch ($request->method) { case "truncactlogtable": $resp = array("status" => $this->db->truncateBVTable(BVWPActLog::$actlog_table)); break; case "dropactlogtable": $resp = array("status" => $this->dropActLogTable()); break; case "createactlogtable": $usedbdelta = array_key_exists('usedbdelta', $params); $resp = array("status" => $this->createActLogTable($usedbdelta)); break; default: $resp = false; } return $resp; } } endif;
|