Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to support actuality of MySQL tables with Mercurial?

I use MODx, a CMF, and it stores all templates, snippets and user code in some MySQL tables. It makes usage of Mercurial for these projects very tiresome. Import/export of mysql dumps takes a lot of time.

So, is there an approach to avoid it?

like image 282
Argnist Avatar asked Dec 06 '25 20:12

Argnist


1 Answers

I'm not familiar with Mercurial but I edit all my MODx snippets and plugins on the file system.

The standard way to do this is to create a MODx snippet that simply returns the contents of a php file containing your main snippet code, which you can edit using an IDE and benefit from version control:

<?php
$file = include $modx->getOption('core_path') . 'path/to/your/snippet.php';
return $file;

Here's a method you can use to get file-based Chunks in your snippet code:

http://rtfm.modx.com/display/revolution20/Developing+an+Extra+in+MODX+Revolution#DevelopinganExtrainMODXRevolution-TheDoodlesclassgetChunkMethod

However both techniques will be redundant when the upcoming Revolution 2.2 is released as it introduces a new Static Element type allowing you to use file based elements natively:

http://rtfm.modx.com/display/revolution20/Upgrading+to+2.2.x#Upgradingto2.2.x-StaticElements

like image 104
okyanet Avatar answered Dec 09 '25 12:12

okyanet