function renderd_gen_conf() { global $root_path; global $lists_dir; $conf=fopen("$root_path/data/renderd.conf", "w"); if(file_exists("$root_path/data/renderd.conf.template")) $template=file_get_contents("$root_path/data/renderd.conf.template"); else $template=file_get_contents("$root_path/src/renderd.conf.template"); fwrite($conf, $template); if(file_exists("$root_path/data/renderd.conf.local")) { $template=file_get_contents("$root_path/data/renderd.conf.local"); fwrite($conf, $template); } foreach(category_list() as $f=>$tags) { print "check state of category '$f'\n"; $category=new category($f); $cat_version=$category->get_newest_version(); $recompile=false; if(!file_exists("$lists_dir/$f.renderd")) { $recompile=true; } else { $c=$category->get_renderd_config(); if((!isset($c['VERSION']))||($cat_version!=$c['VERSION'])) $recompile=true; } if($recompile) { print " (re-)compiling $f\n"; $category->compile(); } $conf_part=file_get_contents("$lists_dir/$f.renderd"); fwrite($conf, $conf_part); } global $renderd_files; if($renderd_files) foreach($renderd_files as $file) { if(file_exists($file)) { fwrite($conf, file_get_contents($file)); } } $renderd=array(); call_hooks("renderd_get_maps", &$renderd); foreach($renderd as $id=>$entry) { fwrite($conf, renderd_print_entry($id, $entry)); } // generate dummy entry in renderd.conf to avoid renderd-bug global $data_path; fwrite($conf, "[dummy]\n"); fwrite($conf, "URI=/tiles/dummy/\n"); fwrite($conf, "XML=/home/osm/data/render_dummy.xml\n"); fwrite($conf, "HOST=dummy.host\n"); fclose($conf); }
function categories_has_saved($id) { print "Detect saving of $id -> compile\n"; $cat=new category($id); $cat->compile(); renderd_restart(); }