update_030003.php 914 B

12345678910111213141516171819202122232425262728
  1. <?php
  2. /**
  3. * Update to version 3.0.3
  4. */
  5. use Lychee\Modules\Database;
  6. use Lychee\Modules\Response;
  7. // Add skipDuplicates to settings
  8. $query = Database::prepare($connection, "SELECT `key` FROM `?` WHERE `key` = 'skipDuplicates' LIMIT 1", array(LYCHEE_TABLE_SETTINGS));
  9. $result = Database::execute($connection, $query, 'update_030003', __LINE__);
  10. if ($result===false) Response::error('Could not get current skipDuplicates from database!');
  11. if ($result->num_rows===0) {
  12. $query = Database::prepare($connection, "INSERT INTO `?` (`key`, `value`) VALUES ('skipDuplicates', '0')", array(LYCHEE_TABLE_SETTINGS));
  13. $result = Database::execute($connection, $query, 'update_030003', __LINE__);
  14. if ($result===false) Response::error('Could not add skipDuplicates to database!');
  15. }
  16. // Set version
  17. if (Database::setVersion($connection, '030003')===false) Response::error('Could not update version of database!');
  18. ?>