Просмотр исходного кода

Added some more error logging for database and filesystem store backends

This is to address issue #1554
zertrin 1 год назад
Родитель
Сommit
330855f58d
2 измененных файлов с 7 добавлено и 0 удалено
  1. 6 0
      lib/Data/Database.php
  2. 1 0
      lib/Data/Filesystem.php

+ 6 - 0
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) {

+ 1 - 0
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;
         }
     }