[development] Distilling distributions from configured sites.

Bèr Kessels ber at webschuur.com
Thu Aug 10 08:28:03 UTC 2006

Op woensdag 9 augustus 2006 13:50, schreef Adrian Rossouw:
> for export :
> $result = db_query("select nid from node order by nid asc");
> print drupal_export($result, 'node_load', 'nid')); // or rather save into a

What I do in the fixtures is a lot simpler and a lot more general. The hardes 
part is finding what APIs store stuff, and what load "stuff". "Stuff" is here 
something like a node, a term, and so on. 

The idea is: 
$result = db_query('select nid from node where uid = 1');
while ($row = db_fetch_object($result)) {
	$nodes[$row->nid] = node_load($row->nid);
$out = var_export ($nodes, TRUE);
file_put_content(... $out);

viola! simple! works!

a include_once($file) and then a foreach($nodes as $node) which node_save()s 
all the objects is all you need!



More information about the development mailing list