From 683d00554cfdcc24b9b24b4c1ab36c51f7a7e967 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antonio=20Ca=C3=B1as=20Vargas?= Date: Tue, 12 Jan 2016 19:24:29 +0100 Subject: [PATCH] Version 15.110.4 --- sql/swad.sql | 2 +- swad_changelog.h | 9 +++++++-- swad_database.c | 6 +++--- swad_social.c | 34 +++++++++++++++++----------------- 4 files changed, 28 insertions(+), 23 deletions(-) diff --git a/sql/swad.sql b/sql/swad.sql index 4216d6e2f..3dbcf352b 100644 --- a/sql/swad.sql +++ b/sql/swad.sql @@ -917,7 +917,7 @@ CREATE TABLE IF NOT EXISTS sessions ( -- -- Table social_notes: stores the content of comments to social notes -- -CREATE TABLE IF NOT EXISTS social_comments_content ( +CREATE TABLE IF NOT EXISTS social_comments ( ComCod BIGINT NOT NULL, Content LONGTEXT NOT NULL, UNIQUE INDEX(ComCod), diff --git a/swad_changelog.h b/swad_changelog.h index 7e7ab3878..5054a463f 100644 --- a/swad_changelog.h +++ b/swad_changelog.h @@ -122,14 +122,19 @@ /****************************** Public constants *****************************/ /*****************************************************************************/ -#define Log_PLATFORM_VERSION "SWAD 15.110.3 (2016-01-12)" +#define Log_PLATFORM_VERSION "SWAD 15.110.4 (2016-01-12)" #define CSS_FILE "swad15.110.2.css" #define JS_FILE "swad15.107.2.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 15.110.3: Jan 12, 2016 Database table with publishings renamed. (192259 lines) + Version 15.110.4: Jan 12, 2016 Database table with social comments renamed. (192263 lines) + 2 changes necessary in database: +DROP TABLE social_comments; +RENAME TABLE social_comments_content TO social_comments; + + Version 15.110.3: Jan 12, 2016 Database table with social publishings renamed. (192259 lines) 1 change necessary in database: RENAME TABLE social_timeline TO social_pubs; diff --git a/swad_database.c b/swad_database.c index b11fb912e..09fb8d43d 100644 --- a/swad_database.c +++ b/swad_database.c @@ -1940,9 +1940,9 @@ mysql> DESCRIBE sessions; "UNIQUE INDEX(SessionId)," "INDEX(UsrCod))"); - /***** Table social_comments_content *****/ + /***** Table social_comments *****/ /* -mysql> DESCRIBE social_comments_content; +mysql> DESCRIBE social_comments; +---------+------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +---------+------------+------+-----+---------+-------+ @@ -1951,7 +1951,7 @@ mysql> DESCRIBE social_comments_content; +---------+------------+------+-----+---------+-------+ 2 rows in set (0.00 sec) */ - DB_CreateTable ("CREATE TABLE IF NOT EXISTS social_comments_content (" + DB_CreateTable ("CREATE TABLE IF NOT EXISTS social_comments (" "ComCod BIGINT NOT NULL," "Content LONGTEXT NOT NULL," "UNIQUE INDEX(ComCod)," diff --git a/swad_social.c b/swad_social.c index 206ed06d2..69ff7341c 100644 --- a/swad_social.c +++ b/swad_social.c @@ -1620,11 +1620,11 @@ static void Soc_WriteCommentsInSocialNote (long NotCod, sprintf (Query,"SELECT social_pubs.PubCod,social_pubs.PublisherCod," "social_pubs.NotCod," "UNIX_TIMESTAMP(social_pubs.TimePublish)," - "social_comments_content.Content" - " FROM social_pubs,social_comments_content" + "social_comments.Content" + " FROM social_pubs,social_comments" " WHERE social_pubs.NotCod='%ld'" " AND social_pubs.PubType='%u'" - " AND social_pubs.PubCod=social_comments_content.ComCod" + " AND social_pubs.PubCod=social_comments.ComCod" " ORDER BY social_pubs.PubCod", NotCod,(unsigned) Soc_PUB_COMMENT_TO_NOTE); NumComments = DB_QuerySELECT (Query,&mysql_res,"can not get social comments"); @@ -2010,7 +2010,7 @@ static void Soc_ReceiveComment (void) Soc_PublishSocialNoteInTimeline (&SocPub); // Set SocPub.PubCod /* Insert comment content in the database */ - sprintf (Query,"INSERT INTO social_comments_content (ComCod,Content)" + sprintf (Query,"INSERT INTO social_comments (ComCod,Content)" " VALUES ('%ld','%s')", SocPub.PubCod, Content); @@ -2374,11 +2374,11 @@ static void Soc_RemoveASocialNoteFromDB (struct SocialNote *SocNot) char Query[256]; /***** Remove content of the comments of this social note *****/ - sprintf (Query,"DELETE FROM social_comments_content" - " USING social_pubs,social_comments_content" + sprintf (Query,"DELETE FROM social_comments" + " USING social_pubs,social_comments" " WHERE social_pubs.NotCod='%ld'" " AND social_pubs.PubType='%u'" - " AND social_pubs.PubCod=social_comments_content.ComCod", + " AND social_pubs.PubCod=social_comments.ComCod", SocNot->NotCod,(unsigned) Soc_PUB_COMMENT_TO_NOTE); DB_QueryDELETE (Query,"can not remove social comments"); @@ -2555,7 +2555,7 @@ static void Soc_RemoveASocialCommentFromDB (struct SocialComment *SocCom) char Query[128]; /***** Remove content of this social comment *****/ - sprintf (Query,"DELETE FROM social_comments_content" + sprintf (Query,"DELETE FROM social_comments" " WHERE ComCod='%ld'", SocCom->ComCod); DB_QueryDELETE (Query,"can not remove a social comment"); @@ -2584,12 +2584,12 @@ void Soc_RemoveUsrSocialContent (long UsrCod) /***** Remove social comments *****/ /* Remove content of all the comments in all the social notes of the user */ - sprintf (Query,"DELETE FROM social_comments_content" - " USING social_pubs,social_comments_content" + sprintf (Query,"DELETE FROM social_comments" + " USING social_pubs,social_comments" " WHERE social_pubs.NotCod IN" " (SELECT NotCod FROM social_notes WHERE UsrCod='%ld')" " AND social_pubs.PubType='%u'" - " AND social_pubs.PubCod=social_comments_content.ComCod", + " AND social_pubs.PubCod=social_comments.ComCod", UsrCod,(unsigned) Soc_PUB_COMMENT_TO_NOTE); DB_QueryDELETE (Query,"can not remove social comments"); @@ -2602,11 +2602,11 @@ void Soc_RemoveUsrSocialContent (long UsrCod) DB_QueryDELETE (Query,"can not remove social comments"); /* Remove content of all the comments of the user in any social note */ - sprintf (Query,"DELETE FROM social_comments_content" - " USING social_pubs,social_comments_content" + sprintf (Query,"DELETE FROM social_comments" + " USING social_pubs,social_comments" " WHERE social_pubs.PublisherCod='%ld'" " AND social_pubs.PubType='%u'" - " AND social_pubs.PubCod=social_comments_content.ComCod", + " AND social_pubs.PubCod=social_comments.ComCod", UsrCod,(unsigned) Soc_PUB_COMMENT_TO_NOTE); DB_QueryDELETE (Query,"can not remove social comments"); @@ -2807,11 +2807,11 @@ static void Soc_GetDataOfSocialCommentByCod (struct SocialComment *SocCom) sprintf (Query,"SELECT social_pubs.PubCod,social_pubs.PublisherCod," "social_pubs.NotCod," "UNIX_TIMESTAMP(social_pubs.TimePublish)," - "social_comments_content.Content" - " FROM social_pubs,social_comments_content" + "social_comments.Content" + " FROM social_pubs,social_comments" " WHERE social_pubs.PubCod='%ld'" " AND social_pubs.PubType='%u'" - " AND social_pubs.PubCod=social_comments_content.ComCod", + " AND social_pubs.PubCod=social_comments.ComCod", SocCom->ComCod,(unsigned) Soc_PUB_COMMENT_TO_NOTE); if (DB_QuerySELECT (Query,&mysql_res,"can not get data of social comment")) {