diff options
Diffstat (limited to 'plugins/ExampleLogTables')
-rw-r--r-- | plugins/ExampleLogTables/Dao/CustomUserLog.php | 2 | ||||
-rw-r--r-- | plugins/ExampleLogTables/ExampleLogTables.php | 19 |
2 files changed, 20 insertions, 1 deletions
diff --git a/plugins/ExampleLogTables/Dao/CustomUserLog.php b/plugins/ExampleLogTables/Dao/CustomUserLog.php index 50f3016301..ecdfd96f6f 100644 --- a/plugins/ExampleLogTables/Dao/CustomUserLog.php +++ b/plugins/ExampleLogTables/Dao/CustomUserLog.php @@ -25,7 +25,7 @@ class CustomUserLog public function install() { DbHelper::createTable($this->table, " - `user_id` VARCHAR(200) NOT NULL, + `user_id` VARCHAR(191) NOT NULL, `gender` VARCHAR(30) NOT NULL, `group` VARCHAR(30) NOT NULL, PRIMARY KEY (user_id)"); diff --git a/plugins/ExampleLogTables/ExampleLogTables.php b/plugins/ExampleLogTables/ExampleLogTables.php index caf83d594b..ed7ada493f 100644 --- a/plugins/ExampleLogTables/ExampleLogTables.php +++ b/plugins/ExampleLogTables/ExampleLogTables.php @@ -8,11 +8,19 @@ */ namespace Piwik\Plugins\ExampleLogTables; +use Piwik\Common; use Piwik\Plugins\ExampleLogTables\Dao\CustomUserLog; use Piwik\Plugins\ExampleLogTables\Dao\CustomGroupLog; class ExampleLogTables extends \Piwik\Plugin { + public function registerEvents() + { + return [ + 'Db.getTablesInstalled' => 'getTablesInstalled' + ]; + } + public function install() { // Install custom log table [disabled as example only] @@ -23,4 +31,15 @@ class ExampleLogTables extends \Piwik\Plugin // $userLog = new CustomGroupLog(); // $userLog->install(); } + + /** + * Register the new tables, so Matomo knows about them. + * + * @param array $allTablesInstalled + */ + public function getTablesInstalled(&$allTablesInstalled) + { + $allTablesInstalled[] = Common::prefixTable('log_group'); + $allTablesInstalled[] = Common::prefixTable('log_custom'); + } }
\ No newline at end of file |