Added update script to v2.5 + version push (#115)

This commit is contained in:
Tobias Reich 2014-04-10 22:42:14 +02:00
parent a5010a2bf3
commit fe6d05425b
4 changed files with 33 additions and 4 deletions

View File

@ -9,7 +9,7 @@ var lychee = {
title: "",
version: "2.5 b1",
version_code: "020200",
version_code: "020500",
api_path: "php/api.php",
update_path: "http://lychee.electerious.com/version/index.php",

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,28 @@
<?php
###
# @name Update to version 2.5
# @author Tobias Reich
# @copyright 2014 by Tobias Reich
###
if (!$database->query("SELECT `takestamp` FROM `lychee_photos` LIMIT 1;")) {
$result = $database->query("ALTER TABLE `lychee_photos` ADD `takestamp` INT(11) DEFAULT NULL");
if (!$result) return false;
}
if ($database->query("SELECT `takedate`, `taketime` FROM `lychee_photos` LIMIT 1;")) {
$result = $database->query("SELECT `id`, `takedate`, `taketime` FROM `lychee_photos` WHERE `takedate` <> '' AND `taketime` <> '';");
if (!$result) return false;
while ($photo = $result->fetch_object()) {
$takestamp = strtotime($photo->takedate . $photo->taketime);
$database->query("UPDATE lychee_photos SET takestamp = '$takestamp' WHERE `id` = '$photo->id';");
}
$result = $database->query("ALTER TABLE `lychee_photos` DROP COLUMN `takedate`;");
$result = $database->query("ALTER TABLE `lychee_photos` DROP COLUMN `taketime`;");
}
$result = $database->query("UPDATE lychee_settings SET value = '020500' WHERE `key` = 'version';");
if (!$result) return false;
?>

View File

@ -43,7 +43,8 @@ class Database extends Module {
$updates = array(
'020100', #2.1
'020101', #2.1.1
'020200' #2.2
'020200', #2.2
'020500' #2.5
);
# For each update