Closed remicollet closed 2 years ago
Please silent this
touch
or make it conditional (if !file_exists(...)
) according to needs
👎 because if the file is read only, we can't load database contents. I prefer exception/error in such condition !
because if the file is read only, we can't load database contents. I prefer exception/error in such condition !
of course it works... when DATABASE_URL
is set a to read only database.
$ phpcompatinfo diagnose
PHP CompatInfo Requirements Checker
===================================
> Using PHP 8.0.15
> PHP is using the following php.ini file:
/etc/php-cli.ini
> Checking PHP CompatInfo requirements:
[x] PHP version must be at least 7.4.0
[x] pdo_sqlite extension must be available
[x] Check if source "/usr/share/php-bartlett-PHP-CompatInfo/data/compatinfo-db.sqlite" can be reached
[x] Check if tables exists in database
[x] Check if platforms are available in database
[OK] Your system is ready to run the application.
$ phpcompatinfo db:show standard
Reference Summary
=================
Releases 447
INI entries 17
Constants 380
Functions 559
Classes 4
Interfaces 0
Class Constants 0
Methods 6
Dependencies 0
$ phpcompatinfo analyser:run /usr/share/php/BaconQrCode2/
Compatibility Analyser
======================
Data Source Analysed
--------------------
Directories 12
Files 61
Errors 0
Extensions Analysis
-------------------
Extension REF EXT min/Max PHP min/Max
core core 5.3.0 7.1.0
ctype ctype 4.0.4 4.0.4
iconv iconv 4.0.5 4.0.5
imagick imagick 3.5.0RC1 5.4.0
spl spl 5.3.0 7.1.0
standard standard 7.0.2 7.0.2
xmlwriter xmlwriter 5.1.2 5.1.2
Total [7] 7.1.0
...
BTW, sometime it works...
$ phpcompatinfo db:list -a
Reference List
==============
Description Type Name Provided Installed Comment
The amqp PHP extension pecl amqp 1.11.0
The apc PHP extension pecl apc 3.1.13
The apcu PHP extension pecl apcu 5.1.21 5.1.21
...
Sometime it doesn't
$ phpcompatinfo db:list --name zip
In HandleMessageMiddleware.php line 129:
Handling "Bartlett\CompatInfoDb\Application\Query\ListRef\ListQuery" failed: An exception occurred while executing a query: SQLSTATE[HY000]: General error: 8 attempt to write a readonly database
In ExceptionConverter.php line 75:
An exception occurred while executing a query: SQLSTATE[HY000]: General error: 8 attempt to write a readonly database
In Exception.php line 26:
SQLSTATE[HY000]: General error: 8 attempt to write a readonly database
In Statement.php line 101:
SQLSTATE[HY000]: General error: 8 attempt to write a readonly database
db:list [-a|--all] [--type TYPE] [--name NAME]
Please allow read-only everywhere (obviously, excepted for db:create)
As I cannot re produced this issue, tell me if this patch is enough to solve the problem for you
diff --git a/config/set/default.php b/config/set/default.php
index 514dbe90..f7aa3976 100644
--- a/config/set/default.php
+++ b/config/set/default.php
@@ -119,8 +119,8 @@ return static function (ContainerConfigurator $containerConfigurator): void {
$cacheDir = dirname($url['path']);
if (!file_exists($cacheDir)) {
mkdir($cacheDir, 0755, true);
+ touch($url['path']);
}
- touch($url['path']);
}
$connectionParams = ['url' => $dbUrl];
Yes, this is enough
Patch provided was applied with commit 062f93a
Related to b9308f154a8afd7579d470e0a927e0e146a6806a
Please silent this
touch
or make it conditional (if !file_exists(...)
) according to needs