3

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?

sleske
  • 81,358
  • 34
  • 189
  • 227
Argnist
  • 535
  • 1
  • 5
  • 18
  • I'm afraid you won't be able to avoid dumping sql and checking that in. Why does it take a long time to import mysql dump? – favoretti Dec 13 '11 at 10:07
  • 2
    It appears there is no simple solution right now. Your problem is discussed e.g. here: http://forums.modx.com/thread/?thread=25133&page=1 – sleske Dec 13 '11 at 10:09
  • @favoretti What about automatic dumps of certain tables while commit? – Argnist Dec 14 '11 at 04:40
  • @Argnist: well, if dump of mysql is taking long time, I suppose you don't to wait every commit? :) – favoretti Dec 14 '11 at 19:55

1 Answers1

1

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

okyanet
  • 3,106
  • 1
  • 22
  • 16