You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
lychee/php/database/update_020700.php

37 lines
974 B

<?php
/**
* Update to version 2.7.0
*/
use Lychee\Modules\Database;
if (!defined('LYCHEE')) exit('Error: Direct access is not allowed!');
// Add medium to photos
$query = Database::prepare($connection, "SELECT `medium` FROM `?` LIMIT 1", array(LYCHEE_TABLE_PHOTOS));
$result = Database::execute($connection, $query, 'update_020700', __LINE__);
if ($result===false) {
$query = Database::prepare($connection, "ALTER TABLE `?` ADD `medium` TINYINT(1) NOT NULL DEFAULT 0", array(LYCHEE_TABLE_PHOTOS));
$result = Database::execute($connection, $query, 'update_020700', __LINE__);
if ($result===false) return false;
}
// Create medium folder
if (is_dir(LYCHEE_UPLOADS_MEDIUM)===false) {
// Only create the folder when it is missing
if (@mkdir(LYCHEE_UPLOADS_MEDIUM)===false) {
Log::error($connection, 'update_020700', __LINE__, 'Could not create medium-folder');
}
}
// Set version
if (Database::setVersion($connection, '020700')===false) return false;
?>