update_030000.php 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. <?php
  2. ###
  3. # @name Update to version 3.0.0
  4. # @copyright 2015 by Tobias Reich
  5. ###
  6. if (!defined('LYCHEE')) exit('Error: Direct access is not allowed!');
  7. # Remove login
  8. # Login now saved as crypt without md5. Legacy code has been removed.
  9. $query = Database::prepare($database, "UPDATE `?` SET `value` = '' WHERE `key` = 'username' LIMIT 1", array(LYCHEE_TABLE_SETTINGS));
  10. $resetUsername = $database->query($query);
  11. if (!$resetUsername) {
  12. Log::error($database, 'update_030000', __LINE__, 'Could not reset username (' . $database->error . ')');
  13. return false;
  14. }
  15. $query = Database::prepare($database, "UPDATE `?` SET `value` = '' WHERE `key` = 'password' LIMIT 1", array(LYCHEE_TABLE_SETTINGS));
  16. $resetPassword = $database->query($query);
  17. if (!$resetPassword) {
  18. Log::error($database, 'update_030000', __LINE__, 'Could not reset password (' . $database->error . ')');
  19. return false;
  20. }
  21. # Make public albums private and reset password
  22. # Password now saved as crypt without md5. Legacy code has been removed.
  23. $query = Database::prepare($database, "UPDATE `?` SET `public` = 0, `password` = NULL", array(LYCHEE_TABLE_ALBUMS));
  24. $resetPublic = $database->query($query);
  25. if (!$resetPublic) {
  26. Log::error($database, 'update_030000', __LINE__, 'Could not reset public albums (' . $database->error . ')');
  27. return false;
  28. }
  29. # Set version
  30. if (Database::setVersion($database, '030000')===false) return false;
  31. ?>