Version 16.142

This commit is contained in:
Antonio Cañas Vargas 2017-02-27 01:41:46 +01:00
parent 926d730fc8
commit dffae1b8b5
7 changed files with 48 additions and 2 deletions

View File

@ -11685,10 +11685,13 @@ ALTER TABLE surveys ADD UNIQUE INDEX(Scope,Cod);
SELECT SUBSTRING_INDEX(E_mail,'@',-1) AS mail_domain,COUNT(*) AS N FROM usr_emails WHERE SUBSTRING_INDEX(E_mail,'@',-1) NOT IN (SELECT Domain COLLATE latin1_general_ci FROM mail_domains) GROUP BY mail_domain ORDER BY N DESC;
----- swad-core 16.142 (2017/02/27) -----
CREATE TABLE IF NOT EXISTS log_search (LogCod INT NOT NULL,SearchStr VARCHAR(255) NOT NULL,UNIQUE INDEX(LogCod));
----- TODO: Eliminar columnas sin uso en futuras versiones -----
ALTER TABLE surveys DROP COLUMN DegCod;
ALTER TABLE surveys DROP COLUMN CrsCod;

View File

@ -202,13 +202,17 @@
/****************************** Public constants *****************************/
/*****************************************************************************/
#define Log_PLATFORM_VERSION "SWAD 16.141.2 (2017-02-26)"
#define Log_PLATFORM_VERSION "SWAD 16.142 (2017-02-27)"
#define CSS_FILE "swad16.139.6.css"
#define JS_FILE "swad16.141.1.js"
// Number of lines (includes comments but not blank lines) has been got with the following command:
// nl swad*.c swad*.h css/swad*.css py/swad*.py js/swad*.js soap/swad*?.h sql/swad*.sql | tail -1
/*
Version 16.142: Feb 27, 2017 Searches are registered anonymously. (213077 lines)
1 change necessary in database:
CREATE TABLE IF NOT EXISTS log_search (LogCod INT NOT NULL,SearchStr VARCHAR(255) NOT NULL,UNIQUE INDEX(LogCod));
Version 16.141.2: Feb 26, 2017 Search from top of page always uses system scope. (213039 lines)
Version 16.141.1: Feb 26, 2017 Fixed bug in range of dates. (213056 lines)
Version 16.141 : Feb 26, 2017 Default range of dates for stats starts at HH:MM:SS=00:00:00 and ends at HH:MM:SS=23:59:59. (213053 lines)

View File

@ -1456,6 +1456,22 @@ mysql> DESCRIBE log_recent;
"INDEX(UsrCod),"
"INDEX(ClickTime,Role))");
/***** Table log_search *****/
/*
mysql> DESCRIBE log_search;
+-----------+--------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-----------+--------------+------+-----+---------+-------+
| LogCod | int(11) | NO | PRI | NULL | |
| SearchStr | varchar(255) | NO | | NULL | |
+-----------+--------------+------+-----+---------+-------+
2 rows in set (0,00 sec)
*/
DB_CreateTable ("CREATE TABLE IF NOT EXISTS log_search ("
"LogCod INT NOT NULL,"
"SearchStr VARCHAR(255) NOT NULL,"
"UNIQUE INDEX(LogCod))");
/***** Table log_ws *****/
/*
mysql> DESCRIBE log_ws;

View File

@ -343,6 +343,7 @@ void Gbl_InitializeGlobals (void)
Gbl.Search.WhatToSearch = Sch_WHAT_TO_SEARCH_DEFAULT;
Gbl.Search.Str[0] = '\0';
Gbl.Search.LogSearch = false;
Gbl.Asgs.LstIsRead = false; // List is not read
Gbl.Asgs.Num = 0;

View File

@ -267,6 +267,7 @@ struct Globals
{
Sch_WhatToSearch_t WhatToSearch;
char Str[Sch_MAX_LENGTH_STRING_TO_FIND + 1];
bool LogSearch;
} Search;
struct
{

View File

@ -563,6 +563,8 @@ static void Sch_SearchInDB (void)
char RangeQuery[256];
unsigned NumResults = 0; // Initialized to avoid warning
Gbl.Search.LogSearch = true;
/***** Select courses in all the degrees or in current degree *****/
switch (Gbl.Scope.Current)
{

View File

@ -347,6 +347,25 @@ void Sta_LogAccess (const char *Comments)
DB_QueryINSERT (Query,"can not log access (comments)");
}
if (Gbl.Search.LogSearch && Gbl.Search.Str[0])
{
/* Log search string */
sprintf (Query,"INSERT INTO log_search (LogCod,SearchStr)"
" VALUES ('%ld','",
LogCod);
Str_AddStrToQuery (Query,Gbl.Search.Str,sizeof (Query));
Str_Concat (Query,"')",
Sta_MAX_LENGTH_QUERY_LOG);
if (Gbl.WebService.IsWebService)
{
if (mysql_query (&Gbl.mysql,Query))
Svc_Exit ("can not log access (search)");
}
else
DB_QueryINSERT (Query,"can not log access (search)");
}
if (Gbl.WebService.IsWebService)
{
/* Log web service plugin and function */