Database::setVersion to update the database version
This commit is contained in:
parent
5d9e41d2ae
commit
e20ba354da
@ -37,12 +37,7 @@ if ($result->num_rows===0) {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
$query = Database::prepare($database, "UPDATE ? SET value = '020100' WHERE `key` = 'version'", array(LYCHEE_TABLE_SETTINGS));
|
||||
$result = $database->query($query);
|
||||
if (!$result) {
|
||||
Log::error($database, 'update_020100', __LINE__, 'Could not update database (' . $database->error . ')');
|
||||
return false;
|
||||
}
|
||||
if (Database::setVersion($database, '020100')===false) return false;
|
||||
}
|
||||
|
||||
?>
|
@ -13,11 +13,7 @@ if (!$result) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$query = Database::prepare($database, "UPDATE ? SET value = '020101' WHERE `key` = 'version'", array(LYCHEE_TABLE_SETTINGS));
|
||||
$result = $database->query($query);
|
||||
if (!$result) {
|
||||
Log::error($database, 'update_020101', __LINE__, 'Could not update database (' . $database->error . ')');
|
||||
return false;
|
||||
}
|
||||
# Set version
|
||||
if (Database::setVersion($database, '020101')===false) return false;
|
||||
|
||||
?>
|
@ -16,11 +16,7 @@ if (!$database->query($query)) {
|
||||
}
|
||||
}
|
||||
|
||||
$query = Database::prepare($database, "UPDATE ? SET value = '020200' WHERE `key` = 'version'", array(LYCHEE_TABLE_SETTINGS));
|
||||
$result = $database->query($query);
|
||||
if (!$result) {
|
||||
Log::error($database, 'update_020200', __LINE__, 'Could not update database (' . $database->error . ')');
|
||||
return false;
|
||||
}
|
||||
# Set version
|
||||
if (Database::setVersion($database, '020200')===false) return false;
|
||||
|
||||
?>
|
@ -150,11 +150,6 @@ if (!$result) {
|
||||
}
|
||||
|
||||
# Set version
|
||||
$query = Database::prepare($database, "UPDATE ? SET value = '020500' WHERE `key` = 'version'", array(LYCHEE_TABLE_SETTINGS));
|
||||
$result = $database->query($query);
|
||||
if (!$result) {
|
||||
Log::error($database, 'update_020500', __LINE__, 'Could not update database (' . $database->error . ')');
|
||||
return false;
|
||||
}
|
||||
if (Database::setVersion($database, '020500')===false) return false;
|
||||
|
||||
?>
|
@ -18,11 +18,6 @@ if (!$database->query($query)) {
|
||||
}
|
||||
|
||||
# Set version
|
||||
$query = Database::prepare($database, "UPDATE ? SET value = '020505' WHERE `key` = 'version'", array(LYCHEE_TABLE_SETTINGS));
|
||||
$result = $database->query($query);
|
||||
if (!$result) {
|
||||
Log::error($database, 'update_020505', __LINE__, 'Could not update database (' . $database->error . ')');
|
||||
return false;
|
||||
}
|
||||
if (Database::setVersion($database, '020505')===false) return false;
|
||||
|
||||
?>
|
@ -18,11 +18,6 @@ if (!$database->query($query)) {
|
||||
}
|
||||
|
||||
# Set version
|
||||
$query = Database::prepare($database, "UPDATE ? SET value = '020601' WHERE `key` = 'version'", array(LYCHEE_TABLE_SETTINGS));
|
||||
$result = $database->query($query);
|
||||
if (!$result) {
|
||||
Log::error($database, 'update_020601', __LINE__, 'Could not update database (' . $database->error . ')');
|
||||
return false;
|
||||
}
|
||||
if (Database::setVersion($database, '020601')===false) return false;
|
||||
|
||||
?>
|
@ -41,11 +41,6 @@ if ($result->num_rows===0) {
|
||||
}
|
||||
|
||||
# Set version
|
||||
$query = Database::prepare($database, "UPDATE ? SET value = '020602' WHERE `key` = 'version'", array(LYCHEE_TABLE_SETTINGS));
|
||||
$result = $database->query($query);
|
||||
if (!$result) {
|
||||
Log::error($database, 'update_020602', __LINE__, 'Could not update database (' . $database->error . ')');
|
||||
return false;
|
||||
}
|
||||
if (Database::setVersion($database, '020602')===false) return false;
|
||||
|
||||
?>
|
@ -242,6 +242,17 @@ if(!defined('LYCHEE')) exit('Error: Direct access is not allowed!');
|
||||
|
||||
}
|
||||
|
||||
static function setVersion($database, $version) {
|
||||
|
||||
$query = Database::prepare($database, "UPDATE ? SET value = '?' WHERE `key` = 'version'", array(LYCHEE_TABLE_SETTINGS, $version));
|
||||
$result = $database->query($query);
|
||||
if (!$result) {
|
||||
Log::error($database, __METHOD__, __LINE__, 'Could not update database (' . $database->error . ')');
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
static function prepare($database, $query, $data) {
|
||||
|
||||
# Check dependencies
|
||||
|
Loading…
Reference in New Issue
Block a user