Open Carbonhell opened 6 years ago
As a work around until i get around to fixing this
ss13memo CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `ss13memo` AS select `ss13messages`.`targetckey` AS `ckey`,`ss13messages`.`text` AS `memotext`,`ss13messages`.`timestamp` AS `timestamp`,`ss13messages`.`lasteditor` AS `last_editor`,`ss13messages`.`edits` AS `edits` from `ss13messages` where `ss13messages`.`type` = 'memo' and `ss13messages`.`deleted` = 0
ss13notes CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `ss13notes` AS select `ss13messages`.`id` AS `id`,`ss13messages`.`targetckey` AS `ckey`,`ss13messages`.`adminckey` AS `adminckey`,`ss13messages`.`text` AS `notetext`,`ss13messages`.`timestamp` AS `timestamp`,`ss13messages`.`server` AS `server`,`ss13messages`.`secret` AS `secret`,`ss13messages`.`lasteditor` AS `last_editor`,`ss13messages`.`edits` AS `edits` from `ss13messages` where `ss13messages`.`type` = 'note'
ss13watch CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `ss13watch` AS select `ss13messages`.`targetckey` AS `ckey`,`ss13messages`.`adminckey` AS `adminckey`,`ss13messages`.`text` AS `reason`,`ss13messages`.`timestamp` AS `timestamp`,`ss13messages`.`lasteditor` AS `last_editor`,`ss13messages`.`edits` AS `edits` from `ss13messages` where `ss13messages`.`type` = 'watchlist entry'
It creates notes, memos and watch "views" from the messages table. they act like tables but are really just a window into data from another table.
Notes were merged into the messages table, so those lines need to be updated: https://github.com/tgstation/tgstation13.org/blob/master/tgdb/notes.php#L34 should be 'targetckey LIKE' instead of 'ckey LIKE'
https://github.com/tgstation/tgstation13.org/blob/master/tgdb/notes.php#L40 should be 'text LIKE' instead of 'notetext LIKE'
https://github.com/tgstation/tgstation13.org/blob/master/tgdb/notes.php#L53 should become $sqlwhere = " WHERE type LIKE 'note' AND ".join(" ".$sqlwheresep." ", $sqlwherea); to atleast get the notes, although this could be expanded to also get watchlist/messages/idk i guess
https://github.com/tgstation/tgstation13.org/blob/master/tgdb/notes.php#L58 $res = $mysqli->query("SELECT id, targetckey, timestamp, text, adminckey, server FROM ".fmttable("notes").$sqlwhere." ORDER BY timestamp DESC LIMIT ".$limit.";"); (although server doesn't work and i am not too sure why)
https://github.com/tgstation/tgstation13.org/blob/master/tgdb/notes.php#L63 should be $row['targetckey']
https://github.com/tgstation/tgstation13.org/blob/master/tgdb/notes.php#L67 should be $row['text']
server field doesn't appear,that's the only weird thing i've noticed, rest seems to work