Pages: 1
Make personal sticky

gennady gurov






this has been driving me freaking nuts. really pisses me off i missed it
old code:
/*!50003 CREATE */ /*!50017 DEFINER=`root`@`localhost` */ /*!50003 TRIGGER `edit_capture` AFTER UPDATE ON `rev_posts` FOR EACH ROW begin
if (OLD.message != NEW.message) then
insert into post_edits (post_id, poster_id, topic_id, posted, edited, old_message, new_message)
values (OLD.id, OLD.poster_id, OLD.topic_id, OLD.posted, unix_timestamp(), OLD.message, NEW.message);
insert into fti_update(id) values (OLD.id);
end if;
end */;;
DELIMITER ;new code
/*!50003 CREATE */ /*!50017 DEFINER=`root`@`localhost` */ /*!50003 TRIGGER `edit_capture` AFTER UPDATE ON `rev_posts` FOR EACH ROW begin
if (OLD.message != NEW.message) then
insert into post_edits (post_id, poster_id, topic_id, posted, edited, old_message, new_message)
values (OLD.id, OLD.poster_id, OLD.topic_id, OLD.posted, unix_timestamp(), OLD.message, NEW.message);
replace into fti_update(id) values (OLD.id);
end if;
end */;;
DELIMITER ;fti_update is defined with id as primary key. and fti_update is cleaned out every 5 minutes. this trigger would bail out if you tried to edit the same post within 5 minutes of it clearing out (fti_update drives the full text search engine that's being used by the new search feature.
changing insert to a replace fixed the white screen of failure after edit.
woops

Offline
Pages: 1