2015-08-12, 00:29:09
Hi everyone, this is my first post. Thanks for this great CMS and the community behind.
(english is not my mother language so, please, forget me for my poor spelling)
I use GIT for versioning my sites and the problem are the XMLs in one big line, so I decide break it tag by tag.
In admin/inc/caching_functions.php, at the end of file after saving the data:
Now, every change made with de admin panel will write XMLs TAGs separated by lines and can be follow the diffs with GIT or another version control system.
I hope this will be useful to somebody.
Best.
(english is not my mother language so, please, forget me for my poor spelling)
I use GIT for versioning my sites and the problem are the XMLs in one big line, so I decide break it tag by tag.
In admin/inc/caching_functions.php, at the end of file after saving the data:
Code:
$xml->asXML($filem);
// PATCH XML line by line
$tmpXMLfile = file_get_contents($filem);
$tmpNTC = "###DONT_BREAK_CDADA###";
// insert between the opening TAG and CDATA, and the closing too.
$tmpXMLfile = str_replace("><![CDATA",">$tmpNTC<![CDATA",$tmpXMLfile);
$tmpXMLfile = str_replace("]]></","]]>$tmpNTC</",$tmpXMLfile);
// insert new line (linux) between ><
$tmpXMLfile = str_replace("><",">\n<",$tmpXMLfile);
// clean DONT_BREAK_CDATA and write the file again.
$tmpXMLfile = str_replace("$tmpNTC","",$tmpXMLfile);
file_put_contents($filem,$tmpXMLfile);
Now, every change made with de admin panel will write XMLs TAGs separated by lines and can be follow the diffs with GIT or another version control system.
I hope this will be useful to somebody.
Best.