$map->setScale(1); $map->mapDateStart = "2005-06-07"; $map->mapDateCrit = "2005-06-01"; $map->type_or_user = -1; } elseif (isset($_GET['years']) && $USER->hasPerm("admin")) { $map->setOrigin(0, -10); $map->setImageSize(900, 1300); $map->setScale(1); $map->type_or_user = -2; set_time_limit(3600 * 3); $root =& $_SERVER['DOCUMENT_ROOT']; $n = time() - 60 * 60 * 24 * 7; for ($t = 2000; $t < 2009; $t++) { foreach (range(1, 12) as $m) { $map->displayYear = sprintf("%04d-%02d", $t, $m); $target = $map->getImageFilename(); if (!file_exists($root . $target)) { $map->_renderMap(); } print "{$map->displayYear} DONE<BR>"; flush(); } } exit; } elseif (isset($_GET['dates']) && $USER->hasPerm("admin")) { $map->setOrigin(0, -10); $map->setImageSize(900, 1300); $map->setScale(1); $map->type_or_user = $_GET['dates'] == -2 ? -2 : -1; set_time_limit(3600 * 3); $root =& $_SERVER['DOCUMENT_ROOT'];
if ($param['load'] < 100) { while (get_loadavg() > $param['load']) { sleep($param['sleep']); if (time() > $end_time) { exit; } } } $map = new GeographMap(); foreach ($recordSet->fields as $name => $value) { if (!is_numeric($name)) { $map->{$name} = $value; } } $ok = $map->_renderMap(); echo ($ok ? 're-rendered ' : 'FAILED: ') . $map->getImageFilename() . "\n"; flush(); if (time() > $end_time) { $recordSet->Close(); //well come to the end of the scripts useful life exit; } $recordSet->MoveNext(); } } else { //nothing more to do here exit; } //sleep anyway for a bit sleep($param['sleep']); if (time() > $end_time) {
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ require_once 'geograph/global.inc.php'; require_once 'geograph/gridsquare.class.php'; require_once 'geograph/gridimage.class.php'; require_once 'geograph/map.class.php'; require_once 'geograph/mapmosaic.class.php'; require_once 'geograph/image.inc.php'; init_session(); $smarty = new GeographPage(); $map = new GeographMap(); $map->setOrigin(0, -10); $map->setImageSize(1200, 1700); $map->setScale(1.3); $map->type_or_user = -60; $target = $_SERVER['DOCUMENT_ROOT'] . $map->getImageFilename(); $template = 'stuff_thumbnail.tpl'; $cacheid = $map->type_or_user * -1; $smarty->caching = 2; // lifetime is per cache $smarty->cache_lifetime = 3600 * 7 * 24; //7 day cache (as search can be cached - and we manually refreshed anyway if (!empty($_GET['refresh']) && $USER->hasPerm("admin")) { unlink($target); $map->_renderMap(); $smarty->clear_cache($template, $cacheid); } //regenerate? if (!$smarty->is_cached($template, $cacheid)) { $imagemap = file_get_contents($target . ".html"); $smarty->assign_by_ref("imagemap", $imagemap);
if (isset($_POST['go'])) { if (isset($_POST['limit']) && preg_match("/^\\d+(,\\d+|)?\$/", $_POST['limit'])) { $limit = $_POST['limit']; } else { $limit = 10; } //this takes a long time, so we output a header first of all $smarty->display('_std_begin.tpl'); echo "<h3><a href=\"recreatemaps.php\"><<</a> Re-Creating Maps...</h3>"; flush(); $map = new GeographMap(); $recordSet =& $db->Execute("select * from mapcache where age > 0 order by pixels_per_km desc, age desc limit {$limit}"); while (!$recordSet->EOF) { foreach ($recordSet->fields as $name => $value) { if (!is_numeric($name)) { $map->{$name} = $value; } } $map->_renderMap(); echo "<li>re-rendered " . $map->getImageFilename() . "</li>"; flush(); $recordSet->MoveNext(); } $recordSet->Close(); $smarty->display('_std_end.tpl'); exit; } else { $smarty->assign('invalid_maps', $db->GetOne("select count(*) from mapcache where age > 0 and type_or_user >= 0")); } } $smarty->display('admin_recreatemaps.tpl');