mirror of https://github.com/itflow-org/itflow
DB Dump, store file hash in the db
This commit is contained in:
parent
a95b32a57e
commit
811f253470
|
|
@ -1268,11 +1268,19 @@ if (LATEST_DATABASE_VERSION > CURRENT_DATABASE_VERSION) {
|
|||
mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '0.7.4'");
|
||||
}
|
||||
|
||||
//if (CURRENT_DATABASE_VERSION == '0.7.4') {
|
||||
if (CURRENT_DATABASE_VERSION == '0.7.4') {
|
||||
//Insert queries here required to update to DB version 0.7.5
|
||||
mysqli_query($mysqli, "ALTER TABLE `files` ADD `file_hash` VARCHAR(200) DEFAULT NULL AFTER `file_ext`");
|
||||
|
||||
// Then, update the database to the next sequential version
|
||||
//mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '0.7.5'");
|
||||
mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '0.7.5'");
|
||||
}
|
||||
|
||||
//if (CURRENT_DATABASE_VERSION == '0.7.5') {
|
||||
//Insert queries here required to update to DB version 0.7.6
|
||||
|
||||
// Then, update the database to the next sequential version
|
||||
//mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '0.7.6'");
|
||||
//}
|
||||
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -5,4 +5,4 @@
|
|||
* It is used in conjunction with database_updates.php
|
||||
*/
|
||||
|
||||
DEFINE("LATEST_DATABASE_VERSION", "0.7.4");
|
||||
DEFINE("LATEST_DATABASE_VERSION", "0.7.5");
|
||||
|
|
|
|||
4
db.sql
4
db.sql
|
|
@ -561,10 +561,12 @@ CREATE TABLE `files` (
|
|||
`file_reference_name` varchar(200) DEFAULT NULL,
|
||||
`file_name` varchar(200) NOT NULL,
|
||||
`file_ext` varchar(200) DEFAULT NULL,
|
||||
`file_hash` varchar(200) DEFAULT NULL,
|
||||
`file_created_at` datetime NOT NULL DEFAULT current_timestamp(),
|
||||
`file_updated_at` datetime DEFAULT NULL ON UPDATE current_timestamp(),
|
||||
`file_archived_at` datetime DEFAULT NULL,
|
||||
`file_accessed_at` datetime DEFAULT NULL,
|
||||
`file_folder_id` int(11) NOT NULL DEFAULT 0,
|
||||
`file_client_id` int(11) NOT NULL DEFAULT 0,
|
||||
PRIMARY KEY (`file_id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
|
||||
|
|
@ -1691,4 +1693,4 @@ CREATE TABLE `vendors` (
|
|||
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
||||
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
|
||||
|
||||
-- Dump completed on 2023-08-22 18:18:38
|
||||
-- Dump completed on 2023-08-23 16:27:20
|
||||
|
|
|
|||
|
|
@ -35,7 +35,10 @@ if (isset($_POST['add_files'])) {
|
|||
|
||||
move_uploaded_file($file_tmp_path, $dest_path);
|
||||
|
||||
mysqli_query($mysqli,"INSERT INTO files SET file_reference_name = '$file_reference_name', file_name = '$file_name', file_ext = '$file_extension', file_client_id = $client_id");
|
||||
// Extract .ext from reference file name to be used to store SHA256 hash value
|
||||
$file_hash = strstr($file_reference_name, '.', true) ?: $file_reference_name;
|
||||
|
||||
mysqli_query($mysqli,"INSERT INTO files SET file_reference_name = '$file_reference_name', file_name = '$file_name', file_ext = '$file_extension', file_hash = '$file_hash', file_client_id = $client_id");
|
||||
|
||||
//Logging
|
||||
$file_id = intval(mysqli_insert_id($mysqli));
|
||||
|
|
|
|||
Loading…
Reference in New Issue