PluginProbe
The WP Remote WordPress Plugin / 6.76
The WP Remote WordPress Plugin v6.76
6.76 6.72 6.69 6.65 6.62 6.48 6.47 4.87 4.97 5.05 5.09 5.16 5.22 5.24 5.25 5.38 5.41 5.42 5.45 5.47 5.53 5.56 5.65 5.68 5.72 All 54 releases
wpremote / callback / wings / actlog.php

actlog.php in The WP Remote WordPress Plugin 6.76, at callback/wings/actlog.php

74 lines 2.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 if (!defined('ABSPATH')) exit;
4 if (!class_exists('WPRActLogCallback')) :
5
6 require_once dirname( __FILE__ ) . '/../../wp_actlog.php';
7
8 class WPRActLogCallback extends WPRCallbackBase {
9 public $db;
10 public $settings;
11
12 const ACTLOG_WING_VERSION = 1.2;
13
14 public function __construct($callback_handler) {
15 $this->db = $callback_handler->db;
16 $this->settings = $callback_handler->settings;
17 }
18
19 public function dropActLogTable() {
20 return $this->db->dropBVTable(BVWPActLog::$actlog_table);
21 }
22
23 public function createActLogTable($usedbdelta = false) {
24 $db = $this->db;
25 $charset_collate = $db->getCharsetCollate();
26 $table = $this->db->getBVTable(BVWPActLog::$actlog_table);
27 $query = "CREATE TABLE $table (
28 id bigint(20) NOT NULL AUTO_INCREMENT,
29 site_id int NOT NULL,
30 user_id int DEFAULT 0,
31 username text DEFAULT '',
32 request_id text DEFAULT '',
33 ip varchar(50) DEFAULT '',
34 event_type varchar(60) NOT NULL DEFAULT '',
35 event_data mediumtext NOT NULL,
36 time int,
37 PRIMARY KEY (id)
38 ) $charset_collate;";
39 return $db->createTable($query, BVWPActLog::$actlog_table, $usedbdelta);
40 }
41
42 # The server confirms this migration before enabling the modern capture policy.
43 public function alterActLogTable() {
44 $table = $this->db->getBVTable(BVWPActLog::$actlog_table);
45 $query = "ALTER TABLE $table MODIFY ip varchar(" . BVWPActLog::IP_MAX_LENGTH . ") DEFAULT '', " .
46 "MODIFY event_type varchar(" . BVWPActLog::EVENT_TYPE_MAX_LENGTH . ") NOT NULL DEFAULT ''";
47 return $this->db->alterBVTable($query, BVWPActLog::$actlog_table);
48 }
49
50 public function process($request) {
51 $settings = $this->settings;
52 $params = $request->params;
53 switch ($request->method) {
54 case "truncactlogtable":
55 $resp = array("status" => $this->db->truncateBVTable(BVWPActLog::$actlog_table));
56 break;
57 case "dropactlogtable":
58 $resp = array("status" => $this->dropActLogTable());
59 break;
60 case "createactlogtable":
61 $usedbdelta = array_key_exists('usedbdelta', $params);
62 $resp = array("status" => $this->createActLogTable($usedbdelta));
63 break;
64 case "alteractlogtable":
65 $resp = array("status" => $this->alterActLogTable());
66 break;
67 default:
68 $resp = false;
69 }
70 return $resp;
71 }
72 }
73 endif;
74