function cron_main() { global $config; // Mails sollen jedes mal gesendet werden! churchcore_sendMails(); if (isset($_GET["standby"])) { // E-Mail with feedback image if (isset($_GET["mailqueue_id"])) { db_query("update {cc_mail_queue} set reading_count=reading_count+1 where id=:id", array(":id" => $_GET["mailqueue_id"])); } // Check if is time to do a normal cron job if (isset($config["cronjob_delay"]) && $config["cronjob_delay"] > 0) { $last_cron = db_query("select value old, UNIX_TIMESTAMP() act from {cc_config} where name='last_cron'")->fetch(); if ($last_cron != false) { if ($last_cron->act - $config["cronjob_delay"] > $last_cron->old) { db_query("update {cc_config} set value= UNIX_TIMESTAMP() where name='last_cron'"); do_cron(); } } else { db_query("insert into {cc_config} (name, value) values ('last_cron', UNIX_TIMESTAMP())"); } } header('Content-Type: image/jpeg'); echo file_get_contents(ASSETS . '/img/1x1.png'); } else { do_cron(); if (isset($_GET["manual"])) { addInfoMessage(t("cronjob.succeed")); return " "; } } }
/** * main cron function * @return string */ function cron_main() { global $config; // always send reminders and reminders churchcore_sendReminders(); churchcore_sendMails(); if (getVar("standby")) { // email with feedback image if ($id = getVar("mailqueue_id")) { db_query("UPDATE {cc_mail_queue} \n SET reading_count = reading_count + 1 \n WHERE id=:id", array(":id" => $id)); } // Check if it's time to do a normal cron job if (getConf("cronjob_delay") > 0) { $last_cron = db_query("SELECT value old, UNIX_TIMESTAMP() act \n FROM {cc_config} \n WHERE name='last_cron'")->fetch(); if ($last_cron) { if ($last_cron->act - $config["cronjob_delay"] > $last_cron->old) { db_query("UPDATE {cc_config} \n SET VALUE= UNIX_TIMESTAMP() \n WHERE name='last_cron'"); do_cron(); } } } header('Content-Type: image/gif'); //tiniest transparent GIF, credit: http://probablyprogramming.com/2009/03/15/the-tiniest-gif-ever echo base64_decode('R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw=='); } else { do_cron(); if (getVar("manual")) { addInfoMessage(t("cronjob.succeed")); return " "; } } }
$offset = $start_idx; $length = !empty($end_idx) ? $end_idx - $start_idx : null; $query = "select blog_id from wp_blogs where blog_id >= 1"; $results = array_slice($wpdb->get_results($query, 'ARRAY_A'), $offset, $length); define('DOING_CRON', true); foreach ($results as $blog) { switch_to_blog($blog['blog_id']); print "Running cron for blog {$blog['blog_id']}... "; do_cron(); print "done.\n"; restore_current_blog(); } } else { define('DOING_CRON', true); sprintf("Running cron for %s\n", get_bloginfo('name')); do_cron(); } print "All done!\n"; function do_cron() { # Lifted from wp-cron.php because it can't handle multiple blogs if (false === ($crons = _get_cron_array())) { print "no crons.\n"; return; } $keys = array_keys($crons); $local_time = time(); if (isset($keys[0]) && $keys[0] > $local_time) { print "not yet time.\n"; return; }
| Here is where you can register all of the routes for an application. | It's a breeze. Simply tell Laravel the URIs it should respond to | and give it the Closure to execute when that URI is requested. | */ // TESTING ROUTE Route::get('/test', function () { $note = OrganizationNote::find(2); return Response::json($note->creator->getName()); // Header('Content-type: text/plain'); // var_dump(User::find(3)->isOrgAdmin($org)); // dd(); }); // CRON FOR UPDATING THE SITE Route::get('cron', array('as' => 'cron', function () { return do_cron(); })); // HOME AND ADMIN Route::get('/', array('as' => 'home', 'uses' => 'HomeController@showWelcome')); Route::get('not-allowed', array('as' => 'not-allowed', function () { msg('Sorry, you aren\'t allowed to do that.'); return Redirect::route('home'); })); // STATIC PAGES Route::get('info', array('as' => 'info', function () { return View::make('info'); })); // CONTACT FORMS Route::get('{object_type}/{id}/contact', array('as' => 'contact', function ($object_type, $id) { switch ($object_type) { case 'user':