update_020100.php 991 B

1234567891011121314151617181920212223242526272829
  1. <?php
  2. ###
  3. # @name Update to version 2.1
  4. # @author Tobias Reich
  5. # @copyright 2014 by Tobias Reich
  6. ###
  7. if(!$database->query("SELECT `tags` FROM `lychee_photos` LIMIT 1;")) {
  8. $result = $database->query("ALTER TABLE `lychee_photos` ADD `tags` VARCHAR( 1000 ) NULL DEFAULT ''");
  9. if (!$result) return false;
  10. }
  11. $result = $database->query("SELECT `key` FROM `lychee_settings` WHERE `key` = 'dropboxKey' LIMIT 1;");
  12. if ($result->num_rows===0) {
  13. $result = $database->query("INSERT INTO `lychee_settings` (`key`, `value`) VALUES ('dropboxKey', '')");
  14. if (!$result) return false;
  15. }
  16. $result = $database->query("SELECT `key` FROM `lychee_settings` WHERE `key` = 'version' LIMIT 1;");
  17. if ($result->num_rows===0) {
  18. $result = $database->query("INSERT INTO `lychee_settings` (`key`, `value`) VALUES ('version', '020100')");
  19. if (!$result) return false;
  20. } else {
  21. $result = $database->query("UPDATE lychee_settings SET value = '020100' WHERE `key` = 'version';");
  22. if (!$result) return false;
  23. }
  24. ?>