From 708e50cf162c6c7f659196753e2440db406fc9bd Mon Sep 17 00:00:00 2001 From: acanas Date: Sat, 20 Mar 2021 14:36:25 +0100 Subject: [PATCH] Version 20.51.27: Mar 20, 2021 Debug database table renamed. --- sql/swad.sql | 28 ++++++++++++++-------------- swad_API.c | 23 ++++++++++++++--------- swad_changelog.h | 12 ++++++++++-- swad_database.c | 6 +++--- swad_layout.c | 2 +- 5 files changed, 42 insertions(+), 29 deletions(-) diff --git a/sql/swad.sql b/sql/swad.sql index 616c17f0d..f3cfda91d 100644 --- a/sql/swad.sql +++ b/sql/swad.sql @@ -1,6 +1,18 @@ CREATE DATABASE IF NOT EXISTS swad DEFAULT CHARACTER SET=latin1 DEFAULT COLLATE latin1_spanish_ci; USE swad; -- +-- Table API_keys: stores the keys used in the API / web service +-- +CREATE TABLE IF NOT EXISTS API_keys ( + WSKey CHAR(43) NOT NULL, + UsrCod INT NOT NULL, + PlgCod INT NOT NULL, + LastTime DATETIME NOT NULL, + UNIQUE INDEX(WSKey), + INDEX(UsrCod), + INDEX(PlgCod), + INDEX(LastTime)); +-- -- Table IP_prefs: stores user's preferences for each IP address -- CREATE TABLE IF NOT EXISTS IP_prefs ( @@ -456,9 +468,9 @@ CREATE TABLE IF NOT EXISTS cty_countrs ( INDEX(Name_pl), INDEX(Name_pt)); -- --- Table debug: used for debugging purposes +-- Table dbg_debug: used for debugging purposes -- -CREATE TABLE IF NOT EXISTS debug ( +CREATE TABLE IF NOT EXISTS dbg_debug ( DebugTime DATETIME NOT NULL, Txt TEXT NOT NULL, INDEX(DebugTime)); @@ -1772,15 +1784,3 @@ CREATE TABLE IF NOT EXISTS usr_webs ( 'youtube') NOT NULL, URL VARCHAR(255) NOT NULL, UNIQUE INDEX(UsrCod,Web)); --- --- Table ws_keys: stores the keys used in plugins and web service --- -CREATE TABLE IF NOT EXISTS ws_keys ( - WSKey CHAR(43) NOT NULL, - UsrCod INT NOT NULL, - PlgCod INT NOT NULL, - LastTime DATETIME NOT NULL, - UNIQUE INDEX(WSKey), - INDEX(UsrCod), - INDEX(PlgCod), - INDEX(LastTime)); diff --git a/swad_API.c b/swad_API.c index 8921a9d50..a568b43a9 100644 --- a/swad_API.c +++ b/swad_API.c @@ -463,7 +463,10 @@ static int API_CheckWSKey (char WSKey[API_BYTES_WS_KEY + 1]) /***** Check that key does not exist in database *****/ if (DB_QuerySELECT (&mysql_res,"can not get existence of key", - "SELECT UsrCod,PlgCod FROM ws_keys WHERE WSKey='%s'", + "SELECT UsrCod," // row[0] + "PlgCod" // row[1] + " FROM API_keys" + " WHERE WSKey='%s'", WSKey)) // Session found in table of sessions { row = mysql_fetch_row (mysql_res); @@ -538,7 +541,7 @@ static int API_GenerateNewWSKey (struct soap *soap, /***** Check that key does not exist in database *****/ if (DB_QueryCOUNT ("can not get existence of key", - "SELECT COUNT(*) FROM ws_keys" + "SELECT COUNT(*) FROM API_keys" " WHERE WSKey='%s'", WSKey)) return soap_receiver_fault (soap, @@ -547,7 +550,7 @@ static int API_GenerateNewWSKey (struct soap *soap, /***** Insert key into database *****/ DB_QueryINSERT ("can not insert new key", - "INSERT INTO ws_keys" + "INSERT INTO API_keys" " (WSKey,UsrCod,PlgCod,LastTime)" " VALUES" " ('%s',%ld,%ld,NOW())", @@ -567,7 +570,7 @@ static int API_RemoveOldWSKeys (struct soap *soap) /***** Remove expired sessions *****/ /* A session expire when last click (LastTime) is too old, or when there was at least one refresh (navigator supports AJAX) and last refresh is too old (browser probably was closed) */ - sprintf (Query,"DELETE LOW_PRIORITY FROM ws_keys" + sprintf (Query,"DELETE LOW_PRIORITY FROM API_keys" " WHERE LastTimeroles = Gbl.Usrs.Me.Role.Available; +/* DB_QueryINSERT ("can not debug", - "INSERT INTO debug" + "INSERT INTO dbg_debug" " (DebugTime,Txt)" " VALUES" " (NOW(),'Gbl.Usrs.Me.Role.Available after Rol_SetMyRoles: %u')", Gbl.Usrs.Me.Role.Available); DB_QueryINSERT ("can not debug", - "INSERT INTO debug" + "INSERT INTO dbg_debug" " (DebugTime,Txt)" " VALUES" " (NOW(),'getAvailableRolesOut->roles: %d')", getAvailableRolesOut->roles); - +*/ return SOAP_OK; } diff --git a/swad_changelog.h b/swad_changelog.h index cc6c32916..108d81083 100644 --- a/swad_changelog.h +++ b/swad_changelog.h @@ -51,7 +51,7 @@ */ /* DB_QueryINSERT ("can not debug", // TODO: Remove - "INSERT INTO debug" + "INSERT INTO dbg_debug" " (DebugTime,Txt)" " VALUES" " (NOW(),'ActCod = %ld')", @@ -600,13 +600,21 @@ TODO: Salvador Romero Cort TODO: FIX BUG, URGENT! En las fechas como parámetro Dat_WriteParamsIniEndDates(), por ejemplo al cambiar el color de la gráfica de accesos por día y hora, no se respeta la zona horaria. */ -#define Log_PLATFORM_VERSION "SWAD 20.51.26 (2021-03-20)" +#define Log_PLATFORM_VERSION "SWAD 20.51.27 (2021-03-20)" #define CSS_FILE "swad20.45.css" #define JS_FILE "swad20.6.2.js" /* TODO: Rename CENTRE to CENTER in help wiki. TODO: Rename ASSESSMENT.Announcements to ASSESSMENT.Calls_for_exams + Version 20.51.27: Mar 20, 2021 API database table renamed. (308219 lines) + 1 change necessary in database: +RENAME TABLE debug TO dbg_debug; + + Version 20.51.27: Mar 20, 2021 API database table renamed. (308212 lines) + 1 change necessary in database: +RENAME TABLE ws_keys TO API_keys; + Version 20.51.26: Mar 20, 2021 Marks database table renamed. (308209 lines) 1 change necessary in database: RENAME TABLE marks_properties TO mrk_marks; diff --git a/swad_database.c b/swad_database.c index 9e8e465a4..87f87be0e 100644 --- a/swad_database.c +++ b/swad_database.c @@ -3691,9 +3691,9 @@ mysql> DESCRIBE usr_webs; "URL VARCHAR(255) NOT NULL," // Cns_MAX_BYTES_WWW "UNIQUE INDEX(UsrCod,Web))"); -/***** Table ws_keys *****/ +/***** Table API_keys *****/ /* -mysql> DESCRIBE ws_keys; +mysql> DESCRIBE API_keys; +----------+----------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +----------+----------+------+-----+---------+-------+ @@ -3704,7 +3704,7 @@ mysql> DESCRIBE ws_keys; +----------+----------+------+-----+---------+-------+ 4 rows in set (0.00 sec) */ - DB_CreateTable ("CREATE TABLE IF NOT EXISTS ws_keys (" + DB_CreateTable ("CREATE TABLE IF NOT EXISTS API_keys (" "WSKey CHAR(43) NOT NULL," // API_BYTES_WS_KEY "UsrCod INT NOT NULL," "PlgCod INT NOT NULL," diff --git a/swad_layout.c b/swad_layout.c index ee99d2813..3d0cfe487 100644 --- a/swad_layout.c +++ b/swad_layout.c @@ -1217,7 +1217,7 @@ static void Lay_ShowRightColumn (void) (tv2.tv_usec - tv1.tv_usec); DB_QueryINSERT ("can not debug", - "INSERT INTO debug" + "INSERT INTO dbg_debug" " (DebugTime,Txt)" " VALUES" " (NOW(),'Fol_SuggestUsrsToFollowMainZoneOnRightColumn: %ld us')",