//do_upgarde (true); if (isset($_REQUEST['do_upgrade']) && $_REQUEST['do_upgrade'] == 'Y') { JB_do_upgrade(true); JB_cache_flush(); } if (JB_do_upgrade(false)) { echo "<p><input style='font-size: 24px;' type='button' value='Upgrade Database' onclick=\"window.location='" . htmlentities($_SERVER['PHP_SELF']) . "?do_upgrade=Y'\" ></p>"; } } JBPLUG_do_callback('admin_main', $A = false); if ($_REQUEST['clear_cache']) { if (!function_exists('jb_search_category_tree_for_posts')) { require_once jb_basedirpath() . 'include/posts.inc.php'; } JB_init_category_tables(0); JB_update_post_count(); // update the total, eg. number of approved posts, number of expired posts, premium approved, expired & waiting JB_build_post_count(); JB_cache_flush(); $JBMarkup->ok_msg('Cache refreshed.'); } echo "<p> </p><div>"; JB_theme_check_compatibility(); if (JB_DEMO_MODE != 'YES') { if (JB_CRON_EMULATION_ENABLED == 'YES') { echo '<p><font color="maroon">- Attention: Cron Emulation - The system has detected that you have Cron Emulation enabled. Cron Emulation is intended for testing purposes and not recommended for live sites. Please go to <A href="edit_config.php#cron">Admin->Main Config</a> and see the Cron options</p></font>'; } if (is_writable(jb_get_config_dir() . 'config.php')) { //echo "- config.php is writeable.<br>"; } else { echo "<p><font color='maroon'>- config.php is not writable. Give write permissions to config.php if you want to save any changes</p></font>";
function JB_finalize_post_updates() { JB_update_post_count(); // update the total, eg. number of approved posts, number of expired posts, premium approved, expired & waiting // refresh the category cache JB_cache_del_keys_for_all_cats(1); // refresh the rss feed require_once JB_basedirpath() . "rss.php"; JBPLUG_do_callback('finalize_post_updates', $A = false); }
function update_counters() { // rebuild categories count... JB_build_post_count(); JB_update_post_count(); // update the total, eg. number of approved posts, number of expired posts, premium approved, expired & waiting // clear categories cache JB_cache_del_keys_for_all_cats(1); }
function JB_do_cron_job() { if (is_numeric(JB_CRON_LIMIT)) { // check load averge. Do not do cron if load avg is larger than the limit JB_exec("w", $out); preg_match('#load average: (\\d+\\.\\d+)#', $out[0], $m); $load_av = $m[1]; if ($load_av > JB_CRON_LIMIT) { return false; } } $unix_time = time(); $dir = JB_basedirpath(); // process the email queue JB_process_mail_queue(JB_EMAILS_PER_BATCH); // scan inbox if (!function_exists('JB_monitor_mail_box')) { require_once $dir . "include/mail_monitor_functions.php"; } JB_load_monitor_constants(); if (MON_ENABLED == 'YES') { JB_monitor_mail_box(); } // get the time of last HOURLY run $sql = "SELECT * FROM `jb_variables` where `key` = 'LAST_HOURLY_RUN' "; $result = @JB_mysql_query($sql) or $DB_ERROR = mysql_error(); $t_row = @mysql_fetch_array($result, MYSQL_ASSOC); JBPLUG_do_callback('do_cron_job', $A = false); // queue email alerts if ($unix_time > $t_row['val'] + 3600) { // did 1 hour elapse since last run? 3600 if (JB_JOB_ALERTS_ENABLED == 'YES') { // need to init jobs tag_to_field define('JB_JOB_ALERTS_DO_SEND', true); require $dir . 'admin/jobalerts.php'; } if (JB_RESUME_ALERTS_ENABLED == 'YES') { // need to init resume tag_to_field define('JB_RESUME_ALERTS_DO_SEND', true); require $dir . 'admin/resumealerts.php'; } JB_update_employer_subscriptions(); JB_update_memberships(); // update timestamp $sql = "REPLACE INTO jb_variables (`key`, `val`) VALUES ('LAST_HOURLY_RUN', '{$unix_time}') "; $result = @JB_mysql_query($sql) or $DB_ERROR = mysql_error(); if (!function_exists('JB_search_category_tree_for_posts')) { require_once $dir . "include/posts.inc.php"; } JB_expire_posts('PREMIUM'); JB_expire_posts('STANDARD'); JB_cache_del_keys_for_all_cats(1); JB_cache_del_keys_for_all_cats(2); JB_cache_del_keys_for_all_cats(3); JB_cache_del_keys_for_all_cats(4); JB_cache_del_keys_for_all_cats(5); // JB_update_post_count(); JB_update_resume_count(); JB_update_profile_count(); JB_update_employer_count(); JB_update_user_count(); if (EMAIL_URL_SHORTEN == 'YES') { JB_expire_short_URLs(); } // run the import tool JB_process_xml_import(); JBPLUG_do_callback('do_cron_hourly', $A = false); } }