update_020200.php 848 B

1234567891011121314151617181920212223242526
  1. <?php
  2. ###
  3. # @name Update to version 2.2
  4. # @author Tobias Reich
  5. # @copyright 2014 by Tobias Reich
  6. ###
  7. $query = Database::prepare($database, "SELECT `visible` FROM `?` LIMIT 1", [LYCHEE_TABLE_ALBUMS]);
  8. if (!$database->query($query)) {
  9. $query = Database::prepare($database, "ALTER TABLE `?` ADD `visible` TINYINT(1) NOT NULL DEFAULT 1", [LYCHEE_TABLE_ALBUMS]);
  10. $result = $database->query($query);
  11. if (!$result) {
  12. Log::error($database, 'update_020200', __LINE__, 'Could not update database (' . $database->error . ')');
  13. return false;
  14. }
  15. }
  16. $query = Database::prepare($database, "UPDATE ? SET value = '020200' WHERE `key` = 'version'", [LYCHEE_TABLE_SETTINGS]);
  17. $result = $database->query($query);
  18. if (!$result) {
  19. Log::error($database, 'update_020200', __LINE__, 'Could not update database (' . $database->error . ')');
  20. return false;
  21. }
  22. ?>