 {"id":36,"date":"2007-03-29T00:39:48","date_gmt":"2007-03-29T05:39:48","guid":{"rendered":"http:\/\/www.networkjack.info\/blog\/archives\/36"},"modified":"2007-03-29T10:53:22","modified_gmt":"2007-03-29T15:53:22","slug":"wordpress-post-mangling-quick-change-to-keep-2-past-rev-of-a-post","status":"publish","type":"post","link":"http:\/\/www.networkjack.info\/blog\/2007\/03\/29\/wordpress-post-mangling-quick-change-to-keep-2-past-rev-of-a-post\/","title":{"rendered":"WordPress Post mangling &#8211; quick change to keep 2 past revs of a post"},"content":{"rendered":"<p>I had been working really hard on my post on our super duper mail server and at some point I started having some really weird interactions with the tinymce editor. I was switching back and forth between the raw HTML editor and all of a sudden I only had the middle 60% of my post. Stupidly I hit Save and lost a good chunk of my valuable words of wisdom. I was able to recover most of the text from the original email, but I was a bit perturbed there wasn&#8217;t a revert feature.<\/p>\n<p>So, I added one:<\/p>\n<blockquote><p><span class=\"syntax\"><span class=\"syntax_alpha syntax_alpha_reservedWord\">ALTER<\/span>  <span class=\"syntax_alpha syntax_alpha_reservedWord\">TABLE<\/span>  <span class=\"syntax_quote syntax_quote_backtick\">`posts`<\/span>  <span class=\"syntax_alpha syntax_alpha_reservedWord\">ADD<\/span>  <span class=\"syntax_quote syntax_quote_backtick\">`post_content_bkp1`<\/span> <span class=\"syntax_alpha syntax_alpha_columnType\">LONGTEXT<\/span> <span class=\"syntax_alpha syntax_alpha_reservedWord\">AFTER<\/span>  <span class=\"syntax_quote syntax_quote_backtick\">`post_content`<\/span> <span class=\"syntax_punct syntax_punct_listsep\">,<\/span><br \/>\n<span class=\"syntax_alpha syntax_alpha_reservedWord\">ADD<\/span>  <span class=\"syntax_quote syntax_quote_backtick\">`post_content_bkp2`<\/span> <span class=\"syntax_alpha syntax_alpha_columnType\">LONGTEXT<\/span> <span class=\"syntax_alpha syntax_alpha_reservedWord\">AFTER<\/span>  <span class=\"syntax_quote syntax_quote_backtick\">`post_content_bkp1`<\/span> <span class=\"syntax_punct syntax_punct_queryend\">;<\/span><\/span><\/p><\/blockquote>\n<p>or actually two revisions.<\/p>\n<p>I then altered the sql for updating posts like so:<\/p>\n<blockquote><p><span class=\"syntax\"><span class=\"syntax_quote syntax_quote_backtick\">post_content_bkp2 = <\/span><\/span><span class=\"syntax\"><span class=\"syntax_quote syntax_quote_backtick\">post_content_bkp1,<br \/>\npost_content_bkp1 = <\/span><\/span><span class=\"syntax\"><span class=\"syntax_quote syntax_quote_backtick\">post_content<\/span><\/span>,<\/p><\/blockquote>\n<p>so, there may not be any interface for this, but at least if I or the software mangles a post while I&#8217;m editing, I should be able to go to the db and recover something.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I had been working really hard on my post on our super duper mail server and at some point I started having some really weird&#8230;<\/p>\n<div class=\"more-link-wrapper\"><a class=\"more-link\" href=\"http:\/\/www.networkjack.info\/blog\/2007\/03\/29\/wordpress-post-mangling-quick-change-to-keep-2-past-rev-of-a-post\/\">Continue reading<span class=\"screen-reader-text\">WordPress Post mangling &#8211; quick change to keep 2 past revs of a post<\/span><\/a><\/div>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[12,11,4],"tags":[],"class_list":["post-36","post","type-post","status-publish","format-standard","hentry","category-database","category-general","category-web-software","entry"],"_links":{"self":[{"href":"http:\/\/www.networkjack.info\/blog\/wp-json\/wp\/v2\/posts\/36"}],"collection":[{"href":"http:\/\/www.networkjack.info\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.networkjack.info\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.networkjack.info\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.networkjack.info\/blog\/wp-json\/wp\/v2\/comments?post=36"}],"version-history":[{"count":0,"href":"http:\/\/www.networkjack.info\/blog\/wp-json\/wp\/v2\/posts\/36\/revisions"}],"wp:attachment":[{"href":"http:\/\/www.networkjack.info\/blog\/wp-json\/wp\/v2\/media?parent=36"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.networkjack.info\/blog\/wp-json\/wp\/v2\/categories?post=36"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.networkjack.info\/blog\/wp-json\/wp\/v2\/tags?post=36"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}