diff --git a/sql/swad.sql b/sql/swad.sql index a5a19c3f1..9c9db25f4 100644 --- a/sql/swad.sql +++ b/sql/swad.sql @@ -1087,10 +1087,10 @@ CREATE TABLE IF NOT EXISTS sessions ( -- CREATE TABLE IF NOT EXISTS social_comments ( PubCod BIGINT NOT NULL, - Content LONGTEXT NOT NULL, + Txt LONGTEXT NOT NULL, MedCod INT NOT NULL DEFAULT -1, UNIQUE INDEX(PubCod), - FULLTEXT(Content), + FULLTEXT(Txt), INDEX(MedCod)) ENGINE = MYISAM; -- -- Table social_comments_fav: stores users who marked social comments as favourite diff --git a/swad_changelog.h b/swad_changelog.h index e2f56fc38..e3c33e849 100644 --- a/swad_changelog.h +++ b/swad_changelog.h @@ -490,7 +490,7 @@ enscript -2 --landscape --color --file-align=2 --highlight --line-numbers -o - * En OpenSWAD: ps2pdf source.ps destination.pdf */ -#define Log_PLATFORM_VERSION "SWAD 19.76.7 (2019-11-24)" +#define Log_PLATFORM_VERSION "SWAD 19.76.8 (2019-11-25)" #define CSS_FILE "swad19.74.3.css" #define JS_FILE "swad19.70.js" /* @@ -498,6 +498,13 @@ ps2pdf source.ps destination.pdf // TODO: Impedir la creación y edición de proyectos si no son editables. // TODO: En cada juego, poder listar los resultados en una tabla como la de resultados globales + Version 19.76.8: Nov 25, 2019 Changes in database related to timeline. (246885 lines) + 4 changes necessary in database: +ALTER TABLE social_comments CHANGE COLUMN Content Txt LONGTEXT NOT NULL,DROP FULLTEXT Content,ADD FULLTEXT (Txt); +ALTER TABLE social_comments DROP INDEX Content; +ALTER TABLE social_posts CHANGE COLUMN Content Txt LONGTEXT NOT NULL,DROP FULLTEXT Content,ADD FULLTEXT (Txt); +ALTER TABLE social_posts DROP INDEX Content; + Version 19.76.7: Nov 24, 2019 Code refactoring in timeline. (246879 lines) Version 19.76.6: Nov 22, 2019 Code refactoring in forums and strings. (246845 lines) Version 19.76.5: Nov 22, 2019 Code refactoring related to vectors. (246852 lines) @@ -534,7 +541,7 @@ ps2pdf source.ps destination.pdf Version 19.70.1: Nov 17, 2019 Converting links to buttons. Fixed bug in agenda. (247061 lines) Version 19.70: Nov 17, 2019 Hidden comments in timeline are loaded on request using AJAX. (247028 lines) - 1 change necessary in database: + 2 changes necessary in database: INSERT INTO actions (ActCod,Language,Obsolete,Txt) VALUES ('1806','es','N','Ver comentarios ocultos (global)'); INSERT INTO actions (ActCod,Language,Obsolete,Txt) VALUES ('1807','es','N','Ver comentarios ocultos (usuario)'); diff --git a/swad_database.c b/swad_database.c index ecdda4170..6f536c54c 100644 --- a/swad_database.c +++ b/swad_database.c @@ -2310,21 +2310,21 @@ mysql> DESCRIBE sessions; /***** Table social_comments *****/ /* mysql> DESCRIBE social_comments; -+---------+------------+------+-----+---------+-------+ -| Field | Type | Null | Key | Default | Extra | -+---------+------------+------+-----+---------+-------+ -| PubCod | bigint(20) | NO | PRI | NULL | | -| Content | longtext | NO | MUL | NULL | | -| MedCod | int(11) | NO | MUL | -1 | | -+---------+------------+------+-----+---------+-------+ ++--------+------------+------+-----+---------+-------+ +| Field | Type | Null | Key | Default | Extra | ++--------+------------+------+-----+---------+-------+ +| PubCod | bigint(20) | NO | PRI | NULL | | +| Txt | longtext | NO | MUL | NULL | | +| MedCod | int(11) | NO | MUL | -1 | | ++--------+------------+------+-----+---------+-------+ 3 rows in set (0.00 sec) */ DB_CreateTable ("CREATE TABLE IF NOT EXISTS social_comments (" "PubCod BIGINT NOT NULL," - "Content LONGTEXT NOT NULL," // TODO: Rename as Txt + "Content Txt NOT NULL," "MedCod INT NOT NULL DEFAULT -1," "UNIQUE INDEX(PubCod)," - "FULLTEXT(Content)," // TODO: Rename as Txt + "FULLTEXT(Txt)," "INDEX(MedCod)) ENGINE = MYISAM;"); /***** Table social_comments_fav *****/ @@ -2403,21 +2403,21 @@ mysql> DESCRIBE social_notes_fav; /***** Table social_posts *****/ /* mysql> DESCRIBE social_posts; -+---------+----------+------+-----+---------+----------------+ -| Field | Type | Null | Key | Default | Extra | -+---------+----------+------+-----+---------+----------------+ -| PstCod | int(11) | NO | PRI | NULL | auto_increment | -| Content | longtext | NO | MUL | NULL | | -| MedCod | int(11) | NO | MUL | -1 | | -+---------+----------+------+-----+---------+----------------+ -3 rows in set (0.01 sec) ++--------+----------+------+-----+---------+----------------+ +| Field | Type | Null | Key | Default | Extra | ++--------+----------+------+-----+---------+----------------+ +| PstCod | int(11) | NO | PRI | NULL | auto_increment | +| Txt | longtext | NO | MUL | NULL | | +| MedCod | int(11) | NO | MUL | -1 | | ++--------+----------+------+-----+---------+----------------+ +3 rows in set (0.00 sec) */ DB_CreateTable ("CREATE TABLE IF NOT EXISTS social_posts (" "PubCod INT NOT NULL AUTO_INCREMENT," - "Content LONGTEXT NOT NULL," // TODO: Rename as Txt + "Txt LONGTEXT NOT NULL," "MedCod INT NOT NULL DEFAULT -1," "UNIQUE INDEX(PubCod)," - "FULLTEXT(Content)," // TODO: Rename as Txt + "FULLTEXT(Txt)," "INDEX(MedCod)) ENGINE = MYISAM;"); /***** Table social_pubs *****/ diff --git a/swad_timeline.c b/swad_timeline.c index a114e9b9a..65e785c63 100644 --- a/swad_timeline.c +++ b/swad_timeline.c @@ -1847,7 +1847,7 @@ static void TL_GetAndWritePost (long PstCod) /***** Get post from database *****/ NumRows = DB_QuerySELECT (&mysql_res,"can not get the content" " of a post", - "SELECT Content," // row[0] // TODO: Rename as Txt + "SELECT Txt," // row[0] "MedCod" // row[1] " FROM social_posts" " WHERE PstCod=%ld", @@ -2459,7 +2459,7 @@ static long TL_ReceivePost (void) PstCod = DB_QueryINSERTandReturnCode ("can not create post", "INSERT INTO social_posts" - " (Content,MedCod)" // TODO: Rename Content as Txt + " (Txt,MedCod)" " VALUES" " ('%s',%ld)", Content.Txt, @@ -2608,7 +2608,7 @@ static void TL_WriteCommentsInNote (const struct TL_Note *SocNot, "social_pubs.NotCod," // row[2] "UNIX_TIMESTAMP(" "social_pubs.TimePublish)," // row[3] - "social_comments.Content," // row[4] // TODO: Rename as Txt + "social_comments.Txt," // row[4] "social_comments.MedCod" // row[5] " FROM social_pubs,social_comments" " WHERE social_pubs.NotCod=%ld" @@ -2820,7 +2820,7 @@ static unsigned TL_WriteHiddenComments (long NotCod, "social_pubs.NotCod," // row[2] "UNIX_TIMESTAMP(" "social_pubs.TimePublish)," // row[3] - "social_comments.Content," // row[4] // TODO: Rename as Txt + "social_comments.Txt," // row[4] "social_comments.MedCod" // row[5] " FROM social_pubs,social_comments" " WHERE social_pubs.NotCod=%ld" @@ -3394,7 +3394,7 @@ static long TL_ReceiveComment (void) /* Insert comment content in the database */ DB_QueryINSERT ("can not store comment content", "INSERT INTO social_comments" - " (PubCod,Content,MedCod)" // TODO: Rename Content as Txt + " (PubCod,Txt,MedCod)" " VALUES" " (%ld,'%s',%ld)", SocPub.PubCod, @@ -4934,7 +4934,7 @@ static void TL_GetDataOfCommByCod (struct TL_Comment *SocCom) "social_pubs.PublisherCod," // row[1] "social_pubs.NotCod," // row[2] "UNIX_TIMESTAMP(social_pubs.TimePublish)," // row[3] - "social_comments.Content," // row[4] // TODO: Rename as Txt + "social_comments.Txt," // row[4] "social_comments.MedCod" // row[5] " FROM social_pubs,social_comments" " WHERE social_pubs.PubCod=%ld" @@ -5064,7 +5064,7 @@ static void TL_GetDataOfCommentFromRow (MYSQL_ROW row,struct TL_Comment *SocCom) row[1]: PublisherCod row[2]: NotCod row[3]: TimePublish - row[4]: Content // TODO: Rename as Txt + row[4]: Txt row[5]: MedCod */ /***** Get code of comment (row[0]) *****/ @@ -5211,9 +5211,8 @@ void TL_GetNotifPublication (char SummaryStr[Ntf_MAX_BYTES_SUMMARY + 1], if (SocNot.NoteType == TL_NOTE_POST) { /***** Get content of post from database *****/ - // TODO: What happens if content is empty and an image is attached? if (DB_QuerySELECT (&mysql_res,"can not get the content of a post", - "SELECT Content" // TODO: Rename as Txt + "SELECT Txt" // row[0] " FROM social_posts" " WHERE PstCod=%ld", SocNot.Cod) == 1) // Result should have a unique row @@ -5251,10 +5250,9 @@ void TL_GetNotifPublication (char SummaryStr[Ntf_MAX_BYTES_SUMMARY + 1], break; case TL_PUB_COMMENT_TO_NOTE: /***** Get content of post from database *****/ - // TODO: What happens if content is empty and an image is attached? if (DB_QuerySELECT (&mysql_res,"can not get the content" " of a comment to a note", - "SELECT Content" // TODO: Rename as Txt + "SELECT Txt" // row[0] " FROM social_comments" " WHERE PubCod=%ld", SocPub.PubCod) == 1) // Result should have a unique row