-
Notifications
You must be signed in to change notification settings - Fork 675
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #354 from electerious/develop
v3.0.1
- Loading branch information
Showing
31 changed files
with
441 additions
and
156 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
<?php | ||
|
||
### | ||
# @name Update to version 3.0.1 | ||
# @copyright 2015 by Tobias Reich | ||
### | ||
|
||
if (!defined('LYCHEE')) exit('Error: Direct access is not allowed!'); | ||
|
||
# Change length of photo title | ||
$query = Database::prepare($database, "ALTER TABLE `?` CHANGE `title` `title` VARCHAR( 100 ) NOT NULL DEFAULT ''", array(LYCHEE_TABLE_PHOTOS)); | ||
$result = $database->query($query); | ||
if (!$result) { | ||
Log::error($database, 'update_030001', __LINE__, 'Could not update database (' . $database->error . ')'); | ||
return false; | ||
} | ||
|
||
# Change length of album title | ||
$query = Database::prepare($database, "ALTER TABLE `?` CHANGE `title` `title` VARCHAR( 100 ) NOT NULL DEFAULT ''", array(LYCHEE_TABLE_ALBUMS)); | ||
$result = $database->query($query); | ||
if (!$result) { | ||
Log::error($database, 'update_030001', __LINE__, 'Could not update database (' . $database->error . ')'); | ||
return false; | ||
} | ||
|
||
# Add album sorting to settings | ||
$query = Database::prepare($database, "SELECT `key` FROM `?` WHERE `key` = 'sortingAlbums' LIMIT 1", array(LYCHEE_TABLE_SETTINGS)); | ||
$result = $database->query($query); | ||
if ($result->num_rows===0) { | ||
$query = Database::prepare($database, "INSERT INTO `?` (`key`, `value`) VALUES ('sortingAlbums', 'ORDER BY id DESC')", array(LYCHEE_TABLE_SETTINGS)); | ||
$result = $database->query($query); | ||
if (!$result) { | ||
Log::error($database, 'update_030001', __LINE__, 'Could not update database (' . $database->error . ')'); | ||
return false; | ||
} | ||
} | ||
|
||
# Rename sorting to sortingPhotos | ||
$query = Database::prepare($database, "UPDATE ? SET `key` = 'sortingPhotos' WHERE `key` = 'sorting' LIMIT 1", array(LYCHEE_TABLE_SETTINGS)); | ||
$result = $database->query($query); | ||
if (!$result) { | ||
Log::error($database, 'update_030001', __LINE__, 'Could not update database (' . $database->error . ')'); | ||
return false; | ||
} | ||
|
||
# Add identifier to settings | ||
$query = Database::prepare($database, "SELECT `key` FROM `?` WHERE `key` = 'identifier' LIMIT 1", array(LYCHEE_TABLE_SETTINGS)); | ||
$result = $database->query($query); | ||
if ($result->num_rows===0) { | ||
$identifier = md5(microtime(true)); | ||
$query = Database::prepare($database, "INSERT INTO `?` (`key`, `value`) VALUES ('identifier', '?')", array(LYCHEE_TABLE_SETTINGS, $identifier)); | ||
$result = $database->query($query); | ||
if (!$result) { | ||
Log::error($database, 'update_030001', __LINE__, 'Could not update database (' . $database->error . ')'); | ||
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 | ||
if (Database::setVersion($database, '030001')===false) return false; | ||
|
||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.