fisharebest / webtrees

Online genealogy
https://webtrees.net
GNU General Public License v3.0
418 stars 290 forks source link

AllTags template in HTML block fails without a 'news' table in the DB #4988

Closed kiwi3685 closed 1 month ago

kiwi3685 commented 1 month ago

I just tried to use the "AllTags" template in an HTML block and received the following error:

SQLSTATE[42S02]: Base table or view not found: 1146 Table 'our-families.wt21_news' doesn't exist (SQL: select count(*) as aggregate fromwt21_newswheregedcom_id= 1) …/vendor/illuminate/database/Connection.php:712

I have never enabled, or tried to use the news table, so the error is quite correct. Just enabling the news module doesn't create it either. It is necessary to actually use it.

The fix I found is to add "if (DB::schema()->hasTable('news'))" to each function in NewsRepository.php, and "return '0'" if either fails.

Not sure if thats the ideal solution. Should the module be created at first set-up instead? I'm happy to create a pull request for either.

fisharebest commented 1 month ago

A long time ago, the news/favorites/mail tables were created by their respective modules. Since 1.7.?, these have been created by the core code.

So surprised you don't have them. What is the history of this site? Upgrade from PGV/kiwitrees/??? or fresh install?

kiwi3685 commented 1 month ago

Ah, thats what confused me. It was actually a fresh install, then modifed to import kiwitrees data. My mistake was to delete tables I knew I would never need.

My mistake, so I'll close this issue.