2015-02-08 14:36:13 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
###
|
|
|
|
# @name Update to version 3.0.0
|
|
|
|
# @copyright 2015 by Tobias Reich
|
|
|
|
###
|
|
|
|
|
|
|
|
if (!defined('LYCHEE')) exit('Error: Direct access is not allowed!');
|
|
|
|
|
|
|
|
# Remove login
|
|
|
|
# Login now saved as crypt without md5. Legacy code has been removed.
|
2016-01-24 21:14:20 +00:00
|
|
|
$query = Database::prepare($connection, "UPDATE `?` SET `value` = '' WHERE `key` = 'username' LIMIT 1", array(LYCHEE_TABLE_SETTINGS));
|
|
|
|
$resetUsername = $connection->query($query);
|
2015-02-08 14:36:13 +00:00
|
|
|
if (!$resetUsername) {
|
2016-01-24 21:14:20 +00:00
|
|
|
Log::error('update_030000', __LINE__, 'Could not reset username (' . $connection->error . ')');
|
2015-02-08 14:36:13 +00:00
|
|
|
return false;
|
|
|
|
}
|
2016-01-24 21:14:20 +00:00
|
|
|
$query = Database::prepare($connection, "UPDATE `?` SET `value` = '' WHERE `key` = 'password' LIMIT 1", array(LYCHEE_TABLE_SETTINGS));
|
|
|
|
$resetPassword = $connection->query($query);
|
2015-02-08 14:36:13 +00:00
|
|
|
if (!$resetPassword) {
|
2016-01-24 21:14:20 +00:00
|
|
|
Log::error('update_030000', __LINE__, 'Could not reset password (' . $connection->error . ')');
|
2015-02-08 14:36:13 +00:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
# Make public albums private and reset password
|
|
|
|
# Password now saved as crypt without md5. Legacy code has been removed.
|
2016-01-24 21:14:20 +00:00
|
|
|
$query = Database::prepare($connection, "UPDATE `?` SET `public` = 0, `password` = NULL", array(LYCHEE_TABLE_ALBUMS));
|
|
|
|
$resetPublic = $connection->query($query);
|
2015-02-08 14:36:13 +00:00
|
|
|
if (!$resetPublic) {
|
2016-01-24 21:14:20 +00:00
|
|
|
Log::error('update_030000', __LINE__, 'Could not reset public albums (' . $connection->error . ')');
|
2015-02-08 14:36:13 +00:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
# Set version
|
2016-01-24 21:14:20 +00:00
|
|
|
if (Database::setVersion($connection, '030000')===false) return false;
|
2015-02-08 14:36:13 +00:00
|
|
|
|
|
|
|
?>
|