Add a check of DB's existence when SQLite is used

General discussion of development ideas and the approaches taken in the 3.x branch of phpBB. The current feature release of phpBB 3 is 3.3/Proteus.
Forum rules
Please do not post support questions regarding installing, updating, or upgrading phpBB 3.3.x. If you need support for phpBB 3.3.x please visit the 3.3.x Support Forum on phpbb.com.

If you have questions regarding writing extensions please post in Extension Writers Discussion to receive proper guidance from our staff and community.
Post Reply
User avatar
yehors
Registered User
Posts: 4
Joined: Sun Jun 02, 2019 2:11 pm

Add a check of DB's existence when SQLite is used

Post by yehors »

I suggest adding a check of DB's existence when SQLite is used.
Today, I renamed the folder of the forum where I were using SQLite as a database and got the following stack trace:

Code: Select all

[Sun Jun  2 17:25:25 2019] PHP Fatal error:  Uncaught Error: Call to a member function query() on null in /home/yehor/Projects/-.dev/phpbb/db/driver/sqlite3.php:394
Stack trace:
#0 /home/yehor/Projects/-.dev/phpbb/db/driver/driver.php(1127): phpbb\db\driver\sqlite3->_sql_report('start', 'SELECT config_n...')
#1 /home/yehor/Projects/-.dev/phpbb/db/driver/sqlite3.php(124): phpbb\db\driver\driver->sql_report('start', 'SELECT config_n...')
#2 /home/yehor/Projects/-.dev/phpbb/db/driver/factory.php(329): phpbb\db\driver\sqlite3->sql_query('SELECT config_n...', 0)
#3 /home/yehor/Projects/-.dev/phpbb/config/db.php(71): phpbb\db\driver\factory->sql_query('SELECT config_n...')
#4 [internal function]: phpbb\config\db->__construct(Object(phpbb\db\driver\factory), Object(phpbb\cache\driver\dummy), 'phpbb_config')
#5 /home/yehor/Projects/-.dev/vendor/symfony/dependency-injection/ContainerBuilder.php(925): ReflectionClass->newInstanceArgs(Array)
#6 /home/yehor/Projects/-.dev/vendor/symfony/dependency-injection/ContainerBuilder.php(467): Symfony\Component in /home/yehor/Projects/-.dev/phpbb/db/driver/sqlite3.php on line 394
After the realization that the forum still uses the old path to the database, I understood this stack trace.
My proposition is in adding a human-readable message that the path is incorrect.

User avatar
DavidIQ
Customisations Team Leader
Customisations Team Leader
Posts: 1903
Joined: Thu Mar 02, 2006 4:29 pm
Location: Earth
Contact:

Re: Add a check of DB's existence when SQLite is used

Post by DavidIQ »

This looks more like a bug report that needs to be reported to the tracker.
Image

User avatar
yehors
Registered User
Posts: 4
Joined: Sun Jun 02, 2019 2:11 pm

Re: Add a check of DB's existence when SQLite is used

Post by yehors »

DavidIQ wrote: Mon Jun 03, 2019 1:37 pm This looks more like a bug report that needs to be reported to the tracker.
Do I really need to do this? If yes then I will create a ticket about this.

User avatar
DavidIQ
Customisations Team Leader
Customisations Team Leader
Posts: 1903
Joined: Thu Mar 02, 2006 4:29 pm
Location: Earth
Contact:

Re: Add a check of DB's existence when SQLite is used

Post by DavidIQ »

If there's a bug you've found that you think needs addressing then any review and/or work would be done off of the tracker, not from a forum post. If for some reason you're unable to do that then let us know.
Image

User avatar
yehors
Registered User
Posts: 4
Joined: Sun Jun 02, 2019 2:11 pm

Re: Add a check of DB's existence when SQLite is used

Post by yehors »

It is just misconfiguration, not a bug in my opinion. I can send the topic's link to the core developers so that they can decide what to do with it.

User avatar
3Di
Registered User
Posts: 951
Joined: Tue Nov 01, 2005 9:50 pm
Location: Milano 🇮🇹 Frankfurt 🇩🇪
Contact:

Re: Add a check of DB's existence when SQLite is used

Post by 3Di »

I hope you realized that changing the name of the folder containing the forum could create problems, it 's not an operation that you can do without expecting consequences like the one you described. A completely anomalous operation.
Therefore I consider the idea of implementing any check-in for all those who perform similar operations ... simply not proposable.

That's just me though. :)
🆓 Free support for our extensions also provided here: phpBB Studio
🚀 Looking for a specific feature or alternative option? We will rock you!
Please PM me only to request paid works. Thx. Want to compensate me for my interest? Donate
My development's activity º PhpStorm's proud user º Extensions, Scripts, MOD porting, Update/Upgrades

User avatar
yehors
Registered User
Posts: 4
Joined: Sun Jun 02, 2019 2:11 pm

Re: Add a check of DB's existence when SQLite is used

Post by yehors »

My case is not so bad, actually. I have changed the forum's path in one place and nothing problems were caught after renaming.

Post Reply