From 6a3175537e947c022244961902ddef70480251af Mon Sep 17 00:00:00 2001 From: Matthew Exon Date: Sun, 2 Oct 2022 21:19:08 +0200 Subject: [PATCH] Fix length of keys --- retriever/database.sql | 4 ++-- retriever/retriever.php | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/retriever/database.sql b/retriever/database.sql index 6139fea4..2cabf9ef 100644 --- a/retriever/database.sql +++ b/retriever/database.sql @@ -28,14 +28,14 @@ CREATE TABLE IF NOT EXISTS `retriever_resource` ( `contact-id` int(10) unsigned NOT NULL DEFAULT '0', `type` char(255) NULL DEFAULT NULL, `binary` int(1) NOT NULL DEFAULT 0, - `url` varbinary(800) NOT NULL, + `url` varbinary(700) NOT NULL, `created` timestamp NOT NULL DEFAULT now(), `completed` timestamp NULL DEFAULT NULL, `last-try` timestamp NULL DEFAULT NULL, `num-tries` int(11) NOT NULL DEFAULT 0, `data` mediumblob NULL DEFAULT NULL, `http-code` smallint(1) unsigned NULL DEFAULT NULL, - `redirect-url` varbinary(800) NOT NULL, + `redirect-url` varbinary(700) NOT NULL, KEY `url` (`url`), KEY `completed` (`completed`), PRIMARY KEY (`id`) diff --git a/retriever/retriever.php b/retriever/retriever.php index 5bd078c6..977ed49a 100644 --- a/retriever/retriever.php +++ b/retriever/retriever.php @@ -38,8 +38,8 @@ function retriever_install() { !DBA::e("ALTER TABLE `retriever_item` CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci") || !DBA::e("ALTER TABLE `retriever_item` MODIFY `item-uri` varbinary(255) NOT NULL") || !DBA::e("ALTER TABLE `retriever_resource` CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci") || - !DBA::e("ALTER TABLE `retriever_resource` MODIFY `url` varbinary(800) NOT NULL") || - !DBA::e("ALTER TABLE `retriever_resource` MODIFY `redirect-url` varbinary(800) NOT NULL")) { + !DBA::e("ALTER TABLE `retriever_resource` MODIFY `url` varbinary(700) NOT NULL") || + !DBA::e("ALTER TABLE `retriever_resource` MODIFY `redirect-url` varbinary(700) NOT NULL")) { Logger::warning('Unable to update database tables: ' . DBA::errorMessage()); return; } @@ -479,9 +479,9 @@ function add_retriever_resource($url, $uid, $cid, $binary = false) { return $resource; } - // 800 characters is the size of this field in the database - if (strlen($url) > 800) { - Logger::warning('add_retriever_resource: URL is longer than 800 characters'); + // 700 characters is the size of this field in the database + if (strlen($url) > 700) { + Logger::warning('add_retriever_resource: URL is longer than 700 characters'); } $resource = DBA::selectFirst('retriever_resource', [], ['url' => $url, 'item-uid' => intval($uid), 'contact-id' => intval($cid)]);