| @@ -1,16 +1,16 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | 3 | if (!defined('ABSPATH')) exit; |
| 4 | -if (!class_exists('BVActLogCallback')) : | |
| 4 | +if (!class_exists('WPRActLogCallback')) : | |
| 5 | 5 | |
| 6 | 6 | require_once dirname( __FILE__ ) . '/../../wp_actlog.php'; |
| 7 | 7 | |
| 8 | -class BVActLogCallback extends BVCallbackBase { | |
| 8 | +class WPRActLogCallback extends WPRCallbackBase { | |
| 9 | 9 | public $db; |
| 10 | 10 | public $settings; |
| 11 | 11 | |
| 12 | - const ACTLOG_WING_VERSION = 1.0; | |
| 12 | + const ACTLOG_WING_VERSION = 1.2; | |
| 13 | 13 | |
| 14 | 14 | public function __construct($callback_handler) { |
| 15 | 15 | $this->db = $callback_handler->db; |
| 16 | 16 | $this->settings = $callback_handler->settings; |
| @@ -29,10 +29,10 @@ | ||
| 29 | 29 | site_id int NOT NULL, |
| 30 | 30 | user_id int DEFAULT 0, |
| 31 | 31 | username text DEFAULT '', |
| 32 | 32 | request_id text DEFAULT '', |
| 33 | - ip varchar(20) DEFAULT '', | |
| 34 | - event_type varchar(40) NOT NULL DEFAULT '', | |
| 33 | + ip varchar(50) DEFAULT '', | |
| 34 | + event_type varchar(60) NOT NULL DEFAULT '', | |
| 35 | 35 | event_data mediumtext NOT NULL, |
| 36 | 36 | time int, |
| 37 | 37 | PRIMARY KEY (id) |
| 38 | 38 | ) $charset_collate;"; |
| @@ -38,8 +38,16 @@ | ||
| 38 | 38 | ) $charset_collate;"; |
| 39 | 39 | return $db->createTable($query, BVWPActLog::$actlog_table, $usedbdelta); |
| 40 | 40 | } |
| 41 | 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 | + | |
| 42 | 50 | public function process($request) { |
| 43 | 51 | $settings = $this->settings; |
| 44 | 52 | $params = $request->params; |
| 45 | 53 | switch ($request->method) { |
| @@ -52,8 +60,11 @@ | ||
| 52 | 60 | case "createactlogtable": |
| 53 | 61 | $usedbdelta = array_key_exists('usedbdelta', $params); |
| 54 | 62 | $resp = array("status" => $this->createActLogTable($usedbdelta)); |
| 55 | 63 | break; |
| 64 | + case "alteractlogtable": | |
| 65 | + $resp = array("status" => $this->alterActLogTable()); | |
| 66 | + break; | |
| 56 | 67 | default: |
| 57 | 68 | $resp = false; |
| 58 | 69 | } |
| 59 | 70 | return $resp; |
| @@ -58,5 +69,5 @@ | ||
| 58 | 69 | } |
| 59 | 70 | return $resp; |
| 60 | 71 | } |
| 61 | 72 | } |
| 62 | -endif; | |
| 73 | +endif; | |