Album id now based on the current microtime #27
parent
029e0e9c43
commit
976635254e
@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Update to version 3.1.0
|
||||
*/
|
||||
|
||||
use Lychee\Modules\Database;
|
||||
use Lychee\Modules\Response;
|
||||
|
||||
// Change length of album id field
|
||||
$query = Database::prepare($connection, "ALTER TABLE `?` CHANGE `id` `id` BIGINT(14) NOT NULL", array(LYCHEE_TABLE_ALBUMS));
|
||||
$result = Database::execute($connection, $query, 'update_030100', __LINE__);
|
||||
|
||||
if ($result===false) Response::error('Could not adjust the length of the album id field!');
|
||||
|
||||
// Set version
|
||||
// if (Database::setVersion($connection, '030100')===false) Response::error('Could not update version of database!');
|
||||
|
||||
?>
|
@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
function generateID() {
|
||||
|
||||
// Generate id based on the current microtime
|
||||
$id = str_replace('.', '', microtime(true));
|
||||
|
||||
// Ensure that the id has a length of 14 chars
|
||||
while(strlen($id)<14) $id .= 0;
|
||||
|
||||
// Return the integer value of the id
|
||||
return intval($id);
|
||||
|
||||
}
|
||||
|
||||
?>
|
Loading…
Reference in new issue