Merge pull request #1596 from zertrin/1554-add-error-logging

Added some more error logging for database and filesystem store backends
This commit is contained in:
El RIDO 2025-07-17 06:44:46 +02:00 committed by GitHub
commit c1050e08e8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 8 additions and 0 deletions

View file

@ -1,6 +1,7 @@
# PrivateBin version history # PrivateBin version history
## 2.0.0 (not yet released) ## 2.0.0 (not yet released)
* ADDED: Error logging in database and filesystem backend (#1554)
* CHANGED: Remove page template (#265) * CHANGED: Remove page template (#265)
* CHANGED: Jdenticons are now used as the default icons * CHANGED: Jdenticons are now used as the default icons
* CHANGED: Upgrading libraries to: jdenticon 2.0.0 * CHANGED: Upgrading libraries to: jdenticon 2.0.0

View file

@ -188,6 +188,7 @@ class Database extends AbstractData
) )
); );
} catch (Exception $e) { } catch (Exception $e) {
error_log('Error while attempting to insert a paste into the database: ' . $e->getMessage() . PHP_EOL);
return false; return false;
} }
} }
@ -333,6 +334,7 @@ class Database extends AbstractData
) )
); );
} catch (Exception $e) { } catch (Exception $e) {
error_log('Error while attempting to insert a comment into the database: ' . $e->getMessage() . PHP_EOL);
return false; return false;
} }
} }
@ -915,8 +917,12 @@ class Database extends AbstractData
try { try {
$row = $this->_select('SELECT sqlite_version() AS "v"', array(), true); $row = $this->_select('SELECT sqlite_version() AS "v"', array(), true);
$supportsDropColumn = version_compare($row['v'], '3.35.0', '>='); $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) { } catch (PDOException $e) {
$supportsDropColumn = false; $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) { if ($supportsDropColumn) {

View file

@ -456,6 +456,7 @@ class Filesystem extends AbstractData
self::PROTECTION_LINE . PHP_EOL . Json::encode($data) self::PROTECTION_LINE . PHP_EOL . Json::encode($data)
); );
} catch (Exception $e) { } catch (Exception $e) {
error_log('Error while trying to store data to the filesystem at path "' . $filename . '": ' . $e->getMessage() . PHP_EOL);
return false; return false;
} }
} }