function generateCache($file, $content) { $cache_file = getCache($file); $dir = dirname($cache_file); mkdir($dir, 0777, true); file_put_contents($cache_file, $content); touchCache($file); }
<?php header('Content-Type: text/javascript'); if (!hasCache($file)) { $cache_file = getCache($file); system("tsc --outFile {$cache_file} {$file}"); touchCache($file); } outputCache($file);
// do not use slave server for the next time ... db_slave_exclude(); // delete old cache-attributes sql("DELETE FROM `caches_attributes` WHERE `cache_id`='&1'", $cache_id); // insert new cache-attributes for ($i = 0; $i < count($cache_attribs); $i++) { if ($cache_attribs[$i] + 0 > 0) { sql("INSERT IGNORE INTO `caches_attributes` (`cache_id`, `attrib_id`) VALUES('&1', '&2')", $cache_id, $cache_attribs[$i] + 0); } } //call eventhandler require_once $rootpath . 'lib/eventhandler.inc.php'; event_edit_cache($cache_id, $usr['userid'] + 0); // if old status is not yet published and new status is published => notify-event if ($status_old == 5 && $status != 5) { touchCache($cache_id); // send new cache event event_notify_new_cache($cache_id); } //display cache-page tpl_redirect('viewcache.php?cacheid=' . urlencode($cache_id)); exit; } } elseif (isset($_POST['show_all_countries_submit'])) { $show_all_countries = 1; } //here we only set up the template variables //build countrylist $countriesoptions = ''; //check if selected country is in list_default if ($show_all_countries == 0) {
Ggf. muss die Location des php-Binaries angepasst werden. Prueft auf wartende Caches, deren Veröffentlichungszeitpunkt gekommen ist und veröffentlicht sie. * ************************************************************************* */ //ini_set ('display_errors', On); $rootpath = '../../'; require_once $rootpath . 'lib/clicompatbase.inc.php'; require_once 'settings.inc.php'; require_once $rootpath . 'lib/eventhandler.inc.php'; /* begin db connect */ db_connect(); if ($dblink === false) { echo 'Unable to connect to database'; exit; } /* end db connect */ $rsPublish = sql(" SELECT `cache_id`, `user_id`\n FROM `caches`\n WHERE `status` = 5\n AND `date_activate` <= NOW()"); while ($rPublish = sql_fetch_array($rsPublish)) { $userid = $rPublish['user_id']; $cacheid = $rPublish['cache_id']; // update cache status to active sql("UPDATE `caches` SET `status`=1, `date_activate`=NULL, `last_modified`=NOW() WHERE `cache_id`='&1'", $cacheid); // send events touchCache($cacheid); event_new_cache($userid); event_notify_new_cache($cacheid); } mysql_free_result($rsPublish);