update_030000.php 1.3 KB

1234567891011121314151617181920212223242526272829303132
  1. <?php
  2. /**
  3. * Update to version 3.0.0
  4. */
  5. use Lychee\Modules\Database;
  6. use Lychee\Modules\Response;
  7. // Remove login
  8. // Login now saved as crypt without md5. Legacy code has been removed.
  9. $query = Database::prepare($connection, "UPDATE `?` SET `value` = '' WHERE `key` = 'username' LIMIT 1", array(LYCHEE_TABLE_SETTINGS));
  10. $result = Database::execute($connection, $query, 'update_030000', __LINE__);
  11. if ($result===false) Response::error('Could not reset username in database!');
  12. $query = Database::prepare($connection, "UPDATE `?` SET `value` = '' WHERE `key` = 'password' LIMIT 1", array(LYCHEE_TABLE_SETTINGS));
  13. $result = Database::execute($connection, $query, 'update_030000', __LINE__);
  14. if ($result===false) Response::error('Could not reset password in database!');
  15. // Make public albums private and reset password
  16. // Password now saved as crypt without md5. Legacy code has been removed.
  17. $query = Database::prepare($connection, "UPDATE `?` SET `public` = 0, `password` = NULL", array(LYCHEE_TABLE_ALBUMS));
  18. $result = Database::execute($connection, $query, 'update_030000', __LINE__);
  19. if ($result===false) Response::error('Could not reset publicity of photos in database!');
  20. // Set version
  21. if (Database::setVersion($connection, '030000')===false) Response::error('Could not update version of database!');
  22. ?>