update_030000.php 1.3 KB

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