From 330855f58d4dc7b700b6f144bda8f641a6e788d1 Mon Sep 17 00:00:00 2001 From: zertrin Date: Wed, 16 Jul 2025 15:44:22 +0000 Subject: [PATCH 1/2] Added some more error logging for database and filesystem store backends This is to address issue #1554 --- lib/Data/Database.php | 6 ++++++ lib/Data/Filesystem.php | 1 + 2 files changed, 7 insertions(+) diff --git a/lib/Data/Database.php b/lib/Data/Database.php index 508555a2..fe65f273 100644 --- a/lib/Data/Database.php +++ b/lib/Data/Database.php @@ -188,6 +188,7 @@ class Database extends AbstractData ) ); } catch (Exception $e) { + error_log('Error while attempting to insert a paste into the database: ' . $e->getMessage() . PHP_EOL); return false; } } @@ -333,6 +334,7 @@ class Database extends AbstractData ) ); } catch (Exception $e) { + error_log('Error while attempting to insert a comment into the database: ' . $e->getMessage() . PHP_EOL); return false; } } @@ -915,8 +917,12 @@ class Database extends AbstractData try { $row = $this->_select('SELECT sqlite_version() AS "v"', array(), true); $supportsDropColumn = version_compare($row['v'], '3.35.0', '>='); + if (!$supportsDropColumn) { + error_log('Error: the available SQLite version (' . $row['v'] . ') does not support dropping columns. SQLite version 3.35.0 or later is necessary. The migration will not be fully complete, and you will need to delete the "postdate" column of the "paste" table yourself!'); + } } catch (PDOException $e) { $supportsDropColumn = false; + error_log('Error while checking the SQLite version. The migration will not be fully complete, and you will need to delete the "postdate" column of the "paste" table yourself!'); } } if ($supportsDropColumn) { diff --git a/lib/Data/Filesystem.php b/lib/Data/Filesystem.php index 85cd2a5e..33bef921 100644 --- a/lib/Data/Filesystem.php +++ b/lib/Data/Filesystem.php @@ -456,6 +456,7 @@ class Filesystem extends AbstractData self::PROTECTION_LINE . PHP_EOL . Json::encode($data) ); } catch (Exception $e) { + error_log('Error while trying to store data to the filesystem at path "' . $filename . '": ' . $e->getMessage() . PHP_EOL); return false; } } From 7e4d9eb535905dcd9e39679fb3ffd2507404aa73 Mon Sep 17 00:00:00 2001 From: zertrin Date: Thu, 17 Jul 2025 04:28:55 +0000 Subject: [PATCH 2/2] Updated changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 457e2897..955f987f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,7 @@ # PrivateBin version history ## 2.0.0 (not yet released) +* ADDED: Error logging in database and filesystem backend (#1554) * CHANGED: Remove page template (#265) * CHANGED: Jdenticons are now used as the default icons * CHANGED: Upgrading libraries to: jdenticon 2.0.0