2 months later

clarkwinkelmann Hi Clark,

I tried to install this extension after upgrading my forum to the version 1.1.0. When I click on "Enable" I´m getting this error:

Next Illuminate\Database\QueryException: SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'json null, `created_at` datetime not null) default character set utf8mb4 collate' at line 1 (SQL: create table `kilowhat_audit_log` (`id` int unsigned not null auto_increment primary key, `actor_id` int unsigned null, `client` varchar(255) not null, `ip_address` varchar(255) null, `action` varchar(255) not null, `payload` json null, `created_at` datetime not null) default character set utf8mb4 collate 'utf8mb4_unicode_ci' engine = InnoDB) in /home2/myuser/flarum_base/vendor/illuminate/database/Connection.php:703
Stack trace:
#0 /home2/myuser/flarum_base/vendor/illuminate/database/Connection.php(663): Illuminate\Database\Connection->runQueryCallback('create table `k...', Array, Object(Closure))
#1 /home2/myuser/flarum_base/vendor/illuminate/database/Connection.php(493): Illuminate\Database\Connection->run('create table `k...', Array, Object(Closure))
#2 /home2/myuser/flarum_base/vendor/illuminate/database/Schema/Blueprint.php(109): Illuminate\Database\Connection->statement('create table `k...')
#3 /home2/myuser/flarum_base/vendor/illuminate/database/Schema/Builder.php(365): Illuminate\Database\Schema\Blueprint->build(Object(Illuminate\Database\MySqlConnection), Object(Illuminate\Database\Schema\Grammars\MySqlGrammar))
#4 /home2/myuser/flarum_base/vendor/illuminate/database/Schema/Builder.php(228): Illuminate\Database\Schema\Builder->build(Object(Illuminate\Database\Schema\Blueprint))
#5 /home2/myuser/flarum_base/vendor/kilowhat/flarum-ext-audit-free/migrations/2020_06_12_create_log_table.php(22): Illuminate\Database\Schema\Builder->create('kilowhat_audit_...', Object(Closure))
#6 [internal function]: Illuminate\Filesystem\Filesystem::{closure}(Object(Illuminate\Database\Schema\MySqlBuilder))
#7 /home2/myuser/flarum_base/vendor/flarum/core/src/Database/Migrator.php(202): call_user_func(Object(Closure), Object(Illuminate\Database\Schema\MySqlBuilder))
#8 /home2/myuser/flarum_base/vendor/flarum/core/src/Database/Migrator.php(133): Flarum\Database\Migrator->runClosureMigration(Array)
#9 /home2/myuser/flarum_base/vendor/flarum/core/src/Database/Migrator.php(116): Flarum\Database\Migrator->runUp('/home2/myuser...', '2020_06_12_crea...', Object(Flarum\Extension\Extension))
#10 /home2/myuser/flarum_base/vendor/flarum/core/src/Database/Migrator.php(90): Flarum\Database\Migrator->runMigrationList('/home2/myuser...', Array, Object(Flarum\Extension\Extension))
#11 /home2/myuser/flarum_base/vendor/flarum/core/src/Extension/Extension.php(503): Flarum\Database\Migrator->run('/home2/myuser...', Object(Flarum\Extension\Extension))
#12 /home2/myuser/flarum_base/vendor/flarum/core/src/Extension/ExtensionManager.php(311): Flarum\Extension\Extension->migrate(Object(Flarum\Database\Migrator), 'up')
#13 /home2/myuser/flarum_base/vendor/flarum/core/src/Extension/ExtensionManager.php(182): Flarum\Extension\ExtensionManager->migrate(Object(Flarum\Extension\Extension))
#14 /home2/myuser/flarum_base/vendor/flarum/core/src/Extension/Command/ToggleExtensionHandler.php(36): Flarum\Extension\ExtensionManager->enable('kilowhat-audit-...')
#15 /home2/myuser/flarum_base/vendor/illuminate/bus/Dispatcher.php(122): Flarum\Extension\Command\ToggleExtensionHandler->handle(Object(Flarum\Extension\Command\ToggleExtension))
#16 /home2/myuser/flarum_base/vendor/illuminate/pipeline/Pipeline.php(128): Illuminate\Bus\Dispatcher->Illuminate\Bus\{closure}(Object(Flarum\Extension\Command\ToggleExtension))
#17 /home2/myuser/flarum_base/vendor/illuminate/pipeline/Pipeline.php(103): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Flarum\Extension\Command\ToggleExtension))
#18 /home2/myuser/flarum_base/vendor/illuminate/bus/Dispatcher.php(132): Illuminate\Pipeline\Pipeline->then(Object(Closure))
#19 /home2/myuser/flarum_base/vendor/illuminate/bus/Dispatcher.php(78): Illuminate\Bus\Dispatcher->dispatchNow(Object(Flarum\Extension\Command\ToggleExtension))
#20 /home2/myuser/flarum_base/vendor/flarum/core/src/Api/Controller/UpdateExtensionController.php(43): Illuminate\Bus\Dispatcher->dispatch(Object(Flarum\Extension\Command\ToggleExtension))
#21 /home2/myuser/flarum_base/vendor/flarum/core/src/Http/RouteHandlerFactory.php(41): Flarum\Api\Controller\UpdateExtensionController->handle(Object(Laminas\Diactoros\ServerRequest))
#22 /home2/myuser/flarum_base/vendor/flarum/core/src/Http/Middleware/ExecuteRoute.php(27): Flarum\Http\RouteHandlerFactory->Flarum\Http\{closure}(Object(Laminas\Diactoros\ServerRequest), Array)
#23 /home2/myuser/flarum_base/vendor/laminas/laminas-stratigility/src/Next.php(51): Flarum\Http\Middleware\ExecuteRoute->process(Object(Laminas\Diactoros\ServerRequest), Object(Closure))
#24 /home2/myuser/flarum_base/vendor/flarum/core/src/Api/Middleware/ThrottleApi.php(33): Laminas\Stratigility\Next->handle(Object(Laminas\Diactoros\ServerRequest))
#25 /home2/myuser/flarum_base/vendor/laminas/laminas-stratigility/src/Next.php(51): Flarum\Api\Middleware\ThrottleApi->process(Object(Laminas\Diactoros\ServerRequest), Object(Laminas\Stratigility\Next))
#26 /home2/myuser/flarum_base/vendor/flarum/core/src/Http/Middleware/CheckCsrfToken.php(44): Laminas\Stratigility\Next->handle(Object(Laminas\Diactoros\ServerRequest))
#27 /home2/myuser/flarum_base/vendor/laminas/laminas-stratigility/src/Next.php(51): Flarum\Http\Middleware\CheckCsrfToken->process(Object(Laminas\Diactoros\ServerRequest), Object(Laminas\Stratigility\Next))
#28 /home2/myuser/flarum_base/vendor/flarum/core/src/Http/Middleware/ResolveRoute.php(67): Laminas\Stratigility\Next->handle(Object(Laminas\Diactoros\ServerRequest))
#29 /home2/myuser/flarum_base/vendor/laminas/laminas-stratigility/src/Next.php(51): Flarum\Http\Middleware\ResolveRoute->process(Object(Laminas\Diactoros\ServerRequest), Object(Laminas\Stratigility\Next))
#30 /home2/myuser/flarum_base/vendor/flarum/core/src/Http/Middleware/SetLocale.php(51): Laminas\Stratigility\Next->handle(Object(Laminas\Diactoros\ServerRequest))
#31 /home2/myuser/flarum_base/vendor/laminas/laminas-stratigility/src/Next.php(51): Flarum\Http\Middleware\SetLocale->process(Object(Laminas\Diactoros\ServerRequest), Object(Laminas\Stratigility\Next))
#32 /home2/myuser/flarum_base/vendor/flarum/core/src/Http/Middleware/AuthenticateWithHeader.php(58): Laminas\Stratigility\Next->handle(Object(Laminas\Diactoros\ServerRequest))
#33 /home2/myuser/flarum_base/vendor/laminas/laminas-stratigility/src/Next.php(51): Flarum\Http\Middleware\AuthenticateWithHeader->process(Object(Laminas\Diactoros\ServerRequest), Object(Laminas\Stratigility\Next))
#34 /home2/myuser/flarum_base/vendor/flarum/core/src/Http/Middleware/AuthenticateWithSession.php(31): Laminas\Stratigility\Next->handle(Object(Laminas\Diactoros\ServerRequest))
#35 /home2/myuser/flarum_base/vendor/laminas/laminas-stratigility/src/Next.php(51): Flarum\Http\Middleware\AuthenticateWithSession->process(Object(Laminas\Diactoros\ServerRequest), Object(Laminas\Stratigility\Next))
#36 /home2/myuser/flarum_base/vendor/flarum/core/src/Http/Middleware/RememberFromCookie.php(52): Laminas\Stratigility\Next->handle(Object(Laminas\Diactoros\ServerRequest))
#37 /home2/myuser/flarum_base/vendor/laminas/laminas-stratigility/src/Next.php(51): Flarum\Http\Middleware\RememberFromCookie->process(Object(Laminas\Diactoros\ServerRequest), Object(Laminas\Stratigility\Next))
#38 /home2/myuser/flarum_base/vendor/flarum/core/src/Http/Middleware/StartSession.php(61): Laminas\Stratigility\Next->handle(Object(Laminas\Diactoros\ServerRequest))
#39 /home2/myuser/flarum_base/vendor/laminas/laminas-stratigility/src/Next.php(51): Flarum\Http\Middleware\StartSession->process(Object(Laminas\Diactoros\ServerRequest), Object(Laminas\Stratigility\Next))
#40 /home2/myuser/flarum_base/vendor/flarum/core/src/Api/Middleware/FakeHttpMethods.php(29): Laminas\Stratigility\Next->handle(Object(Laminas\Diactoros\ServerRequest))
#41 /home2/myuser/flarum_base/vendor/laminas/laminas-stratigility/src/Next.php(51): Flarum\Api\Middleware\FakeHttpMethods->process(Object(Laminas\Diactoros\ServerRequest), Object(Laminas\Stratigility\Next))
#42 /home2/myuser/flarum_base/vendor/flarum/core/src/Http/Middleware/ParseJsonBody.php(28): Laminas\Stratigility\Next->handle(Object(Laminas\Diactoros\ServerRequest))
#43 /home2/myuser/flarum_base/vendor/laminas/laminas-stratigility/src/Next.php(51): Flarum\Http\Middleware\ParseJsonBody->process(Object(Laminas\Diactoros\ServerRequest), Object(Laminas\Stratigility\Next))
#44 /home2/myuser/flarum_base/vendor/flarum/core/src/Http/Middleware/HandleErrors.php(57): Laminas\Stratigility\Next->handle(Object(Laminas\Diactoros\ServerRequest))
#45 /home2/myuser/flarum_base/vendor/laminas/laminas-stratigility/src/Next.php(51): Flarum\Http\Middleware\HandleErrors->process(Object(Laminas\Diactoros\ServerRequest), Object(Laminas\Stratigility\Next))
#46 /home2/myuser/flarum_base/vendor/flarum/core/src/Http/Middleware/InjectActorReference.php(25): Laminas\Stratigility\Next->handle(Object(Laminas\Diactoros\ServerRequest))
#47 /home2/myuser/flarum_base/vendor/laminas/laminas-stratigility/src/Next.php(51): Flarum\Http\Middleware\InjectActorReference->process(Object(Laminas\Diactoros\ServerRequest), Object(Laminas\Stratigility\Next))
#48 /home2/myuser/flarum_base/vendor/laminas/laminas-stratigility/src/MiddlewarePipe.php(76): Laminas\Stratigility\Next->handle(Object(Laminas\Diactoros\ServerRequest))
#49 /home2/myuser/flarum_base/vendor/middlewares/request-handler/src/RequestHandler.php(84): Laminas\Stratigility\MiddlewarePipe->process(Object(Laminas\Diactoros\ServerRequest), Object(Laminas\Stratigility\Next))
#50 /home2/myuser/flarum_base/vendor/laminas/laminas-stratigility/src/Next.php(51): Middlewares\RequestHandler->process(Object(Laminas\Diactoros\ServerRequest), Object(Laminas\Stratigility\Next))
#51 /home2/myuser/flarum_base/vendor/middlewares/base-path-router/src/BasePathRouter.php(101): Laminas\Stratigility\Next->handle(Object(Laminas\Diactoros\ServerRequest))
#52 /home2/myuser/flarum_base/vendor/laminas/laminas-stratigility/src/Next.php(51): Middlewares\BasePathRouter->process(Object(Laminas\Diactoros\ServerRequest), Object(Laminas\Stratigility\Next))
#53 /home2/myuser/flarum_base/vendor/laminas/laminas-stratigility/src/Middleware/OriginalMessages.php(36): Laminas\Stratigility\Next->handle(Object(Laminas\Diactoros\ServerRequest))
#54 /home2/myuser/flarum_base/vendor/laminas/laminas-stratigility/src/Next.php(51): Laminas\Stratigility\Middleware\OriginalMessages->process(Object(Laminas\Diactoros\ServerRequest), Object(Laminas\Stratigility\Next))
#55 /home2/myuser/flarum_base/vendor/middlewares/base-path/src/BasePath.php(73): Laminas\Stratigility\Next->handle(Object(Laminas\Diactoros\ServerRequest))
#56 /home2/myuser/flarum_base/vendor/laminas/laminas-stratigility/src/Next.php(51): Middlewares\BasePath->process(Object(Laminas\Diactoros\ServerRequest), Object(Laminas\Stratigility\Next))
#57 /home2/myuser/flarum_base/vendor/flarum/core/src/Http/Middleware/ProcessIp.php(24): Laminas\Stratigility\Next->handle(Object(Laminas\Diactoros\ServerRequest))
#58 /home2/myuser/flarum_base/vendor/laminas/laminas-stratigility/src/Next.php(51): Flarum\Http\Middleware\ProcessIp->process(Object(Laminas\Diactoros\ServerRequest), Object(Laminas\Stratigility\Next))
#59 /home2/myuser/flarum_base/vendor/laminas/laminas-stratigility/src/MiddlewarePipe.php(76): Laminas\Stratigility\Next->handle(Object(Laminas\Diactoros\ServerRequest))
#60 /home2/myuser/flarum_base/vendor/laminas/laminas-stratigility/src/MiddlewarePipe.php(65): Laminas\Stratigility\MiddlewarePipe->process(Object(Laminas\Diactoros\ServerRequest), Object(Laminas\Stratigility\EmptyPipelineHandler))
#61 /home2/myuser/flarum_base/vendor/laminas/laminas-httphandlerrunner/src/RequestHandlerRunner.php(96): Laminas\Stratigility\MiddlewarePipe->handle(Object(Laminas\Diactoros\ServerRequest))
#62 /home2/myuser/flarum_base/vendor/flarum/core/src/Http/Server.php(44): Laminas\HttpHandlerRunner\RequestHandlerRunner->run()
#63 /home2/myuser/domain.com/forum/index.php(26): Flarum\Http\Server->listen()
#64 {main}  

Environment:

  • Flarum core 1.1.1
  • PHP version: 7.4.25
  • MySQL version: 5.6.41-84.1

Any idea how to fix it? Thank you.

    jslirola you need to update your MySQL server. See extension documentation for supported database servers. You need JSON column support.

      clarkwinkelmann I just saw the requirements... Can I update the type of the field to use LONGTEXT instead of json? I think is an alias.

      Is a shared hosting and I can´t update MySQL server for now.

        jslirola you can try, but I'm not sure it will work.

        For storage and retrieval, JSON fields can use text (that's what Flarum does for user settings and event posts) but this extension also uses JSON conditions inside of the SQL queries. You will probably need support for JSON_EXTRACT() SQL command at the very least, and I doubt MySQL 5.6 has that support.

          samtto there might be a javascript error. Can you check under the browser development tools > Console and see if there's any red error message written there?

            clarkwinkelmann Thank you. I did it two days ago and apparently is working. I checked the source code in Github and you´re using JSON_EXTRACT() in two files but I'm not sure when the extension uses them.

            This is the query I ran to create the table in MySQL 5.6::

            CREATE TABLE `kilowhat_audit_log`
              (
                 `id`         INT UNSIGNED NOT NULL auto_increment PRIMARY KEY,
                 `actor_id`   INT UNSIGNED NULL,
                 `client`     VARCHAR(255) NOT NULL,
                 `ip_address` VARCHAR(255) NULL,
                 `action`     VARCHAR(255) NOT NULL,
                 `payload`    LONGTEXT NULL,
                 `created_at` DATETIME NOT NULL
              )
            DEFAULT CHARACTER SET utf8mb4 COLLATE 'utf8mb4_unicode_ci' engine = innodb)  

            After that I was able to activate the extension. 😀

              jslirola actually, I don't think the free version of the extension uses the filters that use JSON_EXTRACT(). Those filters are available for custom REST API request, but if you're only using the extension from the admin panel it might never be used 👍

              samtto this might be a conflict with another extension that modifies the content at the top of an extension's settings ("header"). But I have not seen that happen before.

              Can you share your php flarum info output?

              If you are able to test without disturbing your forum, you could also try disabling other extensions and see if the issue goes away to identify which one might be responsible.

                clarkwinkelmann

                [root@VM-0-6-centos tmtd]# php flarum info
                Flarum core 1.1.1
                PHP version: 7.4.9
                MySQL version: 5.7.30-log
                Loaded extensions: Core, date, libxml, openssl, pcre, sqlite3, zlib, bcmath, ctype, curl, dom, filter, ftp, gd, gettext, hash, iconv, intl, json, mbstring, SPL, session, pcntl, standard, PDO, mysqlnd, pdo_sqlite, bz2, posix, Reflection, pdo_mysql, shmop, SimpleXML, soap, sockets, sodium, mysqli, sysvsem, tokenizer, xml, xmlreader, xmlrpc, xmlwriter, zip, fileinfo, exif, gmp, Phar, Zend OPcache
                +--------------------------------+-------------+--------+
                | Flarum Extensions              |             |        |
                +--------------------------------+-------------+--------+
                | ID                             | Version     | Commit |
                +--------------------------------+-------------+--------+
                | flarum-flags                   | v1.1.0      |        |
                | flarum-subscriptions           | v1.1.0      |        |
                | flarum-tags                    | v1.1.0      |        |
                | flarum-sticky                  | v1.1.0      |        |
                | flarum-suspend                 | v1.1.0      |        |
                | flarum-nicknames               | v1.1.0      |        |
                | flarum-lock                    | v1.1.0      |        |
                | flarum-approval                | v1.1.0      |        |
                | afrux-forum-widgets-core       | v0.1.6      |        |
                | fof-follow-tags                | 1.0.2       |        |
                | flarum-markdown                | v1.1.0      |        |
                | zerosonesfun-essential-audio   | 0.3         |        |
                | the-turk-stickiest             | 2.0.3       |        |
                | the-turk-diff                  | 1.1.1       |        |
                | sycho-move-posts               | v0.1.5      |        |
                | ramesh-dada-realtime           | 100.1       |        |
                | nearata-twofactor              | v2.0.1      |        |
                | kilowhat-audit-free            | 1.4.2       |        |
                | justoverclock-welcomebox       | 1.3.4       |        |
                | justoverclock-hashtag          | 0.2.0       |        |
                | justoverclock-events-countdown | 0.1.8       |        |
                | justoverclock-edit-posts       | 0.1.1       |        |
                | jslirola-login2seeplus         | v0.2        |        |
                | itnt-uitab                     | v0.4.0      |        |
                | ianm-follow-users              | 1.0.4       |        |
                | ganuonglachanh-sonic           | 0.1.5       |        |
                | fof-user-bio                   | 1.0.0       |        |
                | fof-upload                     | 1.0.5       |        |
                | fof-terms                      | 1.1.1       |        |
                | fof-split                      | 1.0.0       |        |
                | fof-profile-image-crop         | 1.0.0       |        |
                | fof-pretty-mail                | 1.0.1       |        |
                | fof-polls                      | 1.0.3       |        |
                | fof-pages                      | 1.0.1       |        |
                | fof-merge-discussions          | 1.0.0       |        |
                | fof-links                      | 1.0.3       |        |
                | fof-ignore-users               | 1.0.0       |        |
                | fof-formatting                 | 1.0.1       |        |
                | fof-drafts                     | 1.0.3       |        |
                | fof-discussion-thumbnail       | 1.0.1       |        |
                | fof-byobu                      | 1.0.1       |        |
                | fof-best-answer                | 1.1.5       |        |
                | fof-bbcode-details             | 1.0.0       |        |
                | flarumtr-mobile-search         | v1.2        |        |
                | flarum-statistics              | v1.1.0      |        |
                | flarum-mentions                | v1.1.1      |        |
                | flarum-likes                   | v1.1.0      |        |
                | flarum-lang-english            | v1.1.0      |        |
                | flarum-lang-chinese-simplified | v1.0.4.1009 |        |
                | flarum-bbcode                  | v1.1.0      |        |
                | ffans-clipboardjs              | v1.0.0      |        |
                | clarkwinkelmann-emojionearea   | 1.0.0       |        |
                | clarkwinkelmann-bookmarks      | 1.0.0       |        |
                | clarkwinkelmann-author-change  | 1.0.2       |        |
                | askvortsov-rich-text           | v2.1.0      |        |
                | askvortsov-pwa                 | v3.0.4      |        |
                | askvortsov-checklist           | v1.3.1      |        |
                | afrux-top-posters-widget       | v0.1.3      |        |
                | afrux-online-users-widget      | v0.1.5      |        |
                | afrux-asirem                   | v0.1.4      |        |
                +--------------------------------+-------------+--------+
                Base URL: https://bbs.tmtd.cn
                Installation path: /www/wwwroot/bbs.tmtd.cn/tmtd
                Queue driver: sync
                Mail driver: smtp
                Debug mode: ON
                
                Don't forget to turn off debug mode! It should never be turned on in a production system.

                turn off "FFans Clipboardjs" and keep still.
                There is another error:

                
                TypeError: Cannot read properties of undefined (reading 'children')
                    at n.e.header (admin.js?v=909ef9b6:sourcemap:5254)
                    at n.view (admin.js?v=909ef9b6:sourcemap:5660)
                    at n.forEach.t.<computed> [as view] (admin.js?v=909ef9b6:sourcemap:1)
                    at Function.s (admin.js?v=909ef9b6:sourcemap:25)
                    at admin.js?v=909ef9b6:sourcemap:25
                    at admin.js?v=909ef9b6:sourcemap:25
                    at c (admin.js?v=909ef9b6:sourcemap:25)
                    at u (admin.js?v=909ef9b6:sourcemap:25)
                    at p (admin.js?v=909ef9b6:sourcemap:25)
                    at admin.js?v=909ef9b6:sourcemap:25
                11 days later

                Fealist it depends what you call bloat.

                The additional table is only written to during the logged action. The table is only read from when accessing the log page, so there's zero performance impact for regular forum visitors and only minimal performance decrease during logged actions.

                As for the storage size of the database, I don't think it's relevant. Your posts table will take many more times the size of the log table, even on low activity forums. But if the size of the log table became an issue, feel free to reach out, I'd be curious to know what is taking that much space in there.

                You can safely truncate the log table at regular interval if you wanted to get rid of older logs.

                You could even delete the indexes on the table if they were taking too much disk space, this will only slow down log retrieval but no other impact.

                Other community extensions on your forum will likely have a much bigger impact on performance and database tables/indexes than this extension.

                3 months later

                Hari good idea! I'll think about it!

                I'd probably add this to the pro version as an extra bonus feature.

                • Hari replied to this.
                  7 days later

                  samtto You have a very nice backend design, is made by you?
                  Also your forum footer are amazing! Nice animation with fishes.

                  Your forum seems doesn't load any content to not registered user so all links in the footer are broken. I suggest to check your forum using incognito mode. I don't think have not found pages is what you want.
                  Maybe you set only registered user can see discussions but to not logged in user the forum looks not very nice, all broken 🙂