Generate identifier when creating the database, not on update

This fixes the broken 'setLogin' when using Lychee for the first time.
This commit is contained in:
Tobias Reich 2015-06-28 17:47:19 +02:00
parent e36fd87f5a
commit f925e118c2
2 changed files with 8 additions and 8 deletions

View File

@ -54,14 +54,6 @@ if ($result->num_rows===0) {
Log::error($database, 'update_030001', __LINE__, 'Could not update database (' . $database->error . ')'); Log::error($database, 'update_030001', __LINE__, 'Could not update database (' . $database->error . ')');
return false; return false;
} }
} else {
$identifier = md5(microtime(true));
$query = Database::prepare($database, "UPDATE `?` SET `value` = '?' WHERE `key` = 'identifier' LIMIT 1", array(LYCHEE_TABLE_SETTINGS, $identifier));
$result = $database->query($query);
if (!$result) {
Log::error($database, 'update_030001', __LINE__, 'Could not reset public albums (' . $database->error . ')');
return false;
}
} }
# Set version # Set version

View File

@ -198,6 +198,14 @@ if(!defined('LYCHEE')) exit('Error: Direct access is not allowed!');
return false; return false;
} }
# Generate identifier
$identifier = md5(microtime(true));
$query = Database::prepare($database, "UPDATE `?` SET `value` = '?' WHERE `key` = 'identifier' LIMIT 1", array(LYCHEE_TABLE_SETTINGS, $identifier));
if (!$database->query($query)) {
Log::error($database, __METHOD__, __LINE__, $database->error);
return false;
}
} }
# Create albums # Create albums