if (in_array('wrap', $argv)) { $input = $argv[1]; $hook = $argv[2]; $plan = $argv[3]; $wrap = $argv[4] == 'wrap' ? TRUE : FALSE; $types = array_slice($argv, 5); } else { $input = $argv[1]; $hook = $argv[2]; $plan = $argv[3]; $wrap = FALSE; $types = array_slice($argv, 4); } // load input include_once $input; $deploy_hook = $hook . '_uuid_default_entities'; $entities = $deploy_hook(); // Export all objects from one plan if ($wrap) { echo export_header($hook); } foreach ($entities[$plan] as $entity) { $type = $entity->__metadata['type']; if (in_array($type, $types)) { $object = '$entities[\'' . $plan . '\'][] = ' . improved_var_export($entity, true) . ";\n\n"; echo $object; } } if ($wrap) { echo export_footer(); }
echo " module for entities deployed as part of the 'structure' module\n\n"; echo "\n* run from the structure directory, and the entities exported to 'export_staging'\n"; echo "will be merged/updated into the specified module_name and deploy_plan\n\n"; echo "usage: php uuid-update.php input_file module_name deploy_plan_name entity_types\n\n"; echo "module_name\tmachine name of module\n"; echo "entity_types\tmachine names of entity_types (e.g. 'node','menu_link','taxonomy_term')\n"; echo "\n\n"; exit; } // arguments $module = $argv[1]; $types = array_slice($argv, 2); // import $current = get_uuid_entities($module); $updates = get_updated_entities(); // update update_current($current, $updates, $types); // export $export = fopen($module . '/' . $module . '.features.uuid_entities.inc', 'w+'); fwrite($export, export_header($module)); foreach ($current['entities'] as $i => $entity) { $type = $entity->__metadata['type']; $object = '$entities[\'' . $current['plan'] . '\'][] = ' . improved_var_export($entity, true) . ";\n\n"; fwrite($export, $object); } fwrite($export, export_footer()); fclose($export); fclose($stderr); ?>