update_030003.php 815 B

12345678910111213141516171819202122232425262728
  1. <?php
  2. /**
  3. * Update to version 3.0.3
  4. */
  5. namespace Lychee\Database;
  6. use Lychee\Modules\Database;
  7. if (!defined('LYCHEE')) exit('Error: Direct access is not allowed!');
  8. // Add skipDuplicates to settings
  9. $query = Database::prepare($connection, "SELECT `key` FROM `?` WHERE `key` = 'skipDuplicates' LIMIT 1", array(LYCHEE_TABLE_SETTINGS));
  10. $result = $connection->query($query);
  11. if ($result->num_rows===0) {
  12. $query = Database::prepare($connection, "INSERT INTO `?` (`key`, `value`) VALUES ('skipDuplicates', '0')", array(LYCHEE_TABLE_SETTINGS));
  13. $result = $connection->query($query);
  14. if (!$result) {
  15. Log::error('update_030003', __LINE__, 'Could not update database (' . $connection->error . ')');
  16. return false;
  17. }
  18. }
  19. // Set version
  20. if (Database::setVersion($connection, '030003')===false) return false;
  21. ?>