1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162 |
- <?php
- if (!defined('LYCHEE')) exit('Error: Direct access is not allowed!');
- $query = Database::prepare($connection, "ALTER TABLE `?` CHANGE `title` `title` VARCHAR( 100 ) NOT NULL DEFAULT ''", array(LYCHEE_TABLE_PHOTOS));
- $result = $connection->query($query);
- if (!$result) {
- Log::error('update_030001', __LINE__, 'Could not update database (' . $connection->error . ')');
- return false;
- }
- $query = Database::prepare($connection, "ALTER TABLE `?` CHANGE `title` `title` VARCHAR( 100 ) NOT NULL DEFAULT ''", array(LYCHEE_TABLE_ALBUMS));
- $result = $connection->query($query);
- if (!$result) {
- Log::error('update_030001', __LINE__, 'Could not update database (' . $connection->error . ')');
- return false;
- }
- $query = Database::prepare($connection, "SELECT `key` FROM `?` WHERE `key` = 'sortingAlbums' LIMIT 1", array(LYCHEE_TABLE_SETTINGS));
- $result = $connection->query($query);
- if ($result->num_rows===0) {
- $query = Database::prepare($connection, "INSERT INTO `?` (`key`, `value`) VALUES ('sortingAlbums', 'ORDER BY id DESC')", array(LYCHEE_TABLE_SETTINGS));
- $result = $connection->query($query);
- if (!$result) {
- Log::error('update_030001', __LINE__, 'Could not update database (' . $connection->error . ')');
- return false;
- }
- }
- $query = Database::prepare($connection, "UPDATE ? SET `key` = 'sortingPhotos' WHERE `key` = 'sorting' LIMIT 1", array(LYCHEE_TABLE_SETTINGS));
- $result = $connection->query($query);
- if (!$result) {
- Log::error('update_030001', __LINE__, 'Could not update database (' . $connection->error . ')');
- return false;
- }
- $query = Database::prepare($connection, "SELECT `key` FROM `?` WHERE `key` = 'identifier' LIMIT 1", array(LYCHEE_TABLE_SETTINGS));
- $result = $connection->query($query);
- if ($result->num_rows===0) {
- $identifier = md5(microtime(true));
- $query = Database::prepare($connection, "INSERT INTO `?` (`key`, `value`) VALUES ('identifier', '?')", array(LYCHEE_TABLE_SETTINGS, $identifier));
- $result = $connection->query($query);
- if (!$result) {
- Log::error('update_030001', __LINE__, 'Could not update database (' . $connection->error . ')');
- return false;
- }
- }
- if (Database::setVersion($connection, '030001')===false) return false;
- ?>
|