FriendsOfFlarum / upload

The file upload extension with insane intelligence for your Flarum forum.
https://discuss.flarum.org/d/4154
MIT License
176 stars 96 forks source link

MapFilesCommand triggers error with double prefix in table names. #347

Closed therealmaxmoon closed 1 year ago

therealmaxmoon commented 1 year ago

Bug Report

Current Behavior I tried to figure out, which files are unused and to clean up Flarum with the commands, which were mentioned here.

But the map command failed and it showed weird table names with double prefix ("flafla").

In Connection.php line 712:

  SQLSTATE[42S02]: Base table or view not found: 1051 Unknown table 'flarum_forum.fla_fla_fof_upload_files' (SQL: select `fla_fla_fof_upload_files`.*, group_concat(distinct posts.id) as matched_post_ids from `  
  fla_fof_upload_files` left join `fla_posts` on `fla_fla_fof_upload_files`.`actor_id` = `fla_posts`.`user_id` and `fla_posts`.`content` like CONCAT('%', fla_fof_upload_files.url, '%') group by `fla_fla_fof_up  
  load_files`.`id` order by `fla_fla_fof_upload_files`.`id` asc limit 1000 offset 0)                                                                                                                               

In Exception.php line 18:

  SQLSTATE[42S02]: Base table or view not found: 1051 Unknown table 'flarum_forum.fla_fla_fof_upload_files'  

In PDOConnection.php line 82:

  SQLSTATE[42S02]: Base table or view not found: 1051 Unknown table 'flarum_forum.fla_fla_fof_upload_files'  

fof:upload [--map] [--cleanup] [--cleanup-before [CLEANUP-BEFORE]] [--force]

I've checked the database and flarum_forum.fla_fla_fof_upload_files doesn't exist, but flarum_forum.fla_fof_upload_files does.

I remember to set "fla_" as a database prefix while installation.

Steps to Reproduce

  1. Navigate to the root directory of your Flarum installation (e.g. cd /var/www/flarum)
  2. Execute the command php flarum fof:upload --map
  3. See the error message shown above

Expected Behavior Show a map of all used media.

Screenshots image

Flarum core: 1.8.1
PHP version: 8.2.7
MySQL version: 10.11.3-MariaDB-1
Loaded extensions: Core, date, libxml, openssl, pcre, zlib, filter, hash, json, pcntl, random, Reflection, SPL, session, standard, sodium, mysqlnd, PDO, xml, calendar, ctype, curl, dom, mbstring, FFI, fileinfo, ftp, gd, gettext, iconv, exif, mysqli, pdo_mysql, Phar, posix, readline, shmop, SimpleXML, sockets, sysvmsg, sysvsem, sysvshm, tokenizer, xmlreader, xmlwriter, xsl, zip, Zend OPcache
+-------------------------------------+---------+--------+
| Flarum Extensions                   |         |        |
+-------------------------------------+---------+--------+
| ID                                  | Version | Commit |
+-------------------------------------+---------+--------+
| flarum-flags                        | v1.8.0  |        |
| flarum-sticky                       | v1.8.0  |        |
| flarum-tags                         | v1.8.0  |        |
| flarum-lock                         | v1.8.0  |        |
| flarum-suspend                      | v1.8.0  |        |
| flarum-approval                     | v1.8.0  |        |
| flarum-markdown                     | v1.8.0  |        |
| zerosonesfun-composer-preview       | 1.3     |        |
| v17development-seo                  | v1.8.0  |        |
| v17development-blog                 | v0.7.2  |        |
| ralkage-hcaptcha                    | 1.0.0   |        |
| nearata-twofactor                   | v2.2.1  |        |
| glowingblue-password-strength       | 3.1.0   |        |
| fof-user-bio                        | 1.2.1   |        |
| fof-upload                          | 1.3.3   |        |
| fof-terms                           | 1.2.1   |        |
| fof-sitemap                         | 2.2.0   |        |
| fof-profile-image-crop              | 1.1.5   |        |
| fof-polls                           | 2.1.1   |        |
| fof-links                           | 1.2.0   |        |
| fof-best-answer                     | 1.3.1   |        |
| flarum-subscriptions                | v1.8.0  |        |
| flarum-statistics                   | v1.8.0  |        |
| flarum-mentions                     | v1.8.2  |        |
| flarum-likes                        | v1.8.0  |        |
| flarum-lang-english                 | v1.8.0  |        |
| flarum-emoji                        | v1.8.0  |        |
| clarkwinkelmann-first-post-approval | 1.0.1   |        |
| askvortsov-markdown-tables          | v1.2.1  |        |
| askvortsov-checklist                | v1.3.1  |        |
+-------------------------------------+---------+--------+
Base URL: https://forum.utopify.org
Installation path: /var/www/flarum
Queue driver: sync
Session driver: file
Scheduler status: Inactive
Mail driver: mail
Debug mode: off