本文整理汇总了PHP中cron_log函数的典型用法代码示例。如果您正苦于以下问题:PHP cron_log函数的具体用法?PHP cron_log怎么用?PHP cron_log使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了cron_log函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: update
function update($key)
{
// give lots of time for processing
set_time_limit(0);
// if wget times out, or the user stops requesting, don't end the cron processing
// http://stackoverflow.com/questions/2291524/does-wget-timeout
ignore_user_abort(TRUE);
if ($this->config->item('cron_key') != $key) {
die('Invalid key.');
}
$this->load->helper('cron_log');
cron_log('Cron processes triggered.');
$this->app_hooks->trigger('cron');
cron_log('Cron processes complete.');
// update cron update setting
if (setting('cron_last_update') === FALSE) {
$this->settings_model->new_setting(1, 'cron_last_update', date('Y-m-d H:i:s'), 'When did the cron job last run?', 'text', '', FALSE, TRUE);
} else {
$this->settings_model->update_setting('cron_last_update', date('Y-m-d H:i:s'));
}
}
示例2: hook_cron
function hook_cron()
{
cron_log('Beginning the PayPal charge date fixes.');
// only run once at 5am
if (date('H') != 5) {
cron_log('Cronjob should only run once between 5:03 and 5:11. Exiting (1).');
return TRUE;
}
if (date('i') < 3 or date('i') > 11) {
cron_log('Cronjob should only run once between 5:03 and 5:11. Exiting (2).');
return TRUE;
}
set_time_limit(0);
$this->CI->db->select('*');
$this->CI->db->from('subscriptions');
$this->CI->db->join('gateways', 'gateways.gateway_id = subscriptions.gateway_id', 'inner');
$this->CI->db->join('external_apis', 'external_apis.external_api_id = gateways.external_api_id', 'inner');
$this->CI->db->where('(`external_apis`.`name` = \'paypal\' or `external_apis`.`name` = \'paypal_standard\')', NULL, FALSE);
$this->CI->db->where('subscriptions.active', '1');
$this->CI->db->where('subscriptions.next_charge <', date('Y-m-d', strtotime('now +4 days')));
$this->CI->db->where('subscriptions.next_charge >', date('Y-m-d', strtotime('tomorrow')));
$result = $this->CI->db->get();
$updated = 0;
if ($result->num_rows() > 0) {
foreach ($result->result_array() as $sub) {
$profile = $this->_get_profile($sub['gateway_id'], $sub['api_customer_reference']);
if (isset($profile['NEXTBILLINGDATE']) and !empty($profile['NEXTBILLINGDATE'])) {
$paypal_date = $profile['NEXTBILLINGDATE'];
$local_date = $sub['next_charge'];
$formatted_paypal_date = date('Y-m-d', strtotime($profile['NEXTBILLINGDATE']));
// update local
$this->CI->db->update('subscriptions', array('next_charge' => $formatted_paypal_date), array('subscription_id' => $sub['subscription_id']));
$updated++;
}
}
}
cron_log('Fixed PayPal subscription next_charge dates: ' . $updated);
return TRUE;
}
示例3: exec
if (!is_file($laskut . "/" . $file)) {
continue;
}
$nimi = $laskut . "/" . $file;
// Muutetaan oikeaan merkistöön
$encoding = exec("file -b --mime-encoding '{$nimi}'");
if (!PUPE_UNICODE and $encoding != "" and strtoupper($encoding) != 'ISO-8859-15') {
exec("recode -f {$encoding}..ISO-8859-15 '{$nimi}'");
} elseif (PUPE_UNICODE and $encoding != "" and strtoupper($encoding) != 'UTF-8') {
exec("recode -f {$encoding}..UTF8 '{$nimi}'");
}
$luotiinlaskuja = erittele_laskut($nimi);
// Jos tiedostosta luotiin laskuja siirretään se tieltä pois
if ($luotiinlaskuja > 0) {
// Logitetaan ajo
cron_log($origlaskut . "/" . $file);
rename($laskut . "/" . $file, $origlaskut . "/" . $file);
}
}
}
if ($handle = opendir($laskut)) {
while (($file = readdir($handle)) !== FALSE) {
if (!is_file($laskut . "/" . $file)) {
continue;
}
// $yhtiorow ja $xmlstr
unset($yhtiorow);
unset($xmlstr);
$nimi = $laskut . "/" . $file;
$laskuvirhe = verkkolasku_in($nimi, TRUE);
if ($laskuvirhe == "") {
示例4: call_job
/**
* Call a cron job.
*
* @param string Key of the job
* @param string Params for the job:
* 'ctsk_ID' - task ID
* 'ctsk_name' - task name
* @return string Error message
*/
function call_job($job_key, $job_params = array())
{
global $DB, $inc_path, $Plugins, $admin_url;
global $result_message, $result_status, $timestop, $time_difference;
$error_message = '';
$result_message = NULL;
$result_status = 'error';
$job_ctrl = get_cron_jobs_config('ctrl', $job_key);
if (preg_match('~^plugin_(\\d+)_(.*)$~', $job_ctrl, $match)) {
// Cron job provided by a plugin:
if (!is_object($Plugins)) {
load_class('plugins/model/_plugins.class.php', 'Plugins');
$Plugins = new Plugins();
}
$Plugin =& $Plugins->get_by_ID($match[1]);
if (!$Plugin) {
$result_message = 'Plugin for controller [' . $job_ctrl . '] could not get instantiated.';
cron_log($result_message, 2);
return $result_message;
}
// CALL THE PLUGIN TO HANDLE THE JOB:
$tmp_params = array('ctrl' => $match[2], 'params' => $job_params);
$sub_r = $Plugins->call_method($Plugin->ID, 'ExecCronJob', $tmp_params);
$error_code = (int) $sub_r['code'];
$result_message = $sub_r['message'];
} else {
$controller = $inc_path . $job_ctrl;
if (!is_file($controller)) {
$result_message = 'Controller [' . $job_ctrl . '] does not exist.';
cron_log($result_message, 2);
return $result_message;
}
// INCLUDE THE JOB FILE AND RUN IT:
$error_code = (require $controller);
}
if (is_array($result_message)) {
// If result is array (we should store it as serialized data later)
// array keys: 'message' - Result message
// 'table_cols' - Columns names of the table to display on the Execution details of the cron job log
// 'table_data' - Array
$result_message_text = $result_message['message'];
} else {
// Result is text string
$result_message_text = $result_message;
}
if ($error_code != 1) {
// We got an error
$result_status = 'error';
$result_message_text = '[Error code: ' . $error_code . ' ] ' . $result_message_text;
if (is_array($result_message)) {
// If result is array
$result_message['message'] = $result_message_text;
}
$cron_log_level = 2;
$error_message = $result_message_text;
} else {
$result_status = 'finished';
$cron_log_level = 1;
}
$timestop = time() + $time_difference;
cron_log('Task finished at ' . date('H:i:s', $timestop) . ' with status: ' . $result_status . "\nMessage: {$result_message_text}", $cron_log_level);
return $error_message;
}
示例5: hook_cron
function hook_cron()
{
cron_log('Beginning Twitter cronjob.');
if (setting('twitter_enabled') != '1') {
cron_log('Twitter is disabled. Exiting.');
$this->settings_model->update_setting('twitter_last_tweet', date('Y-m-d H:i:s'));
return FALSE;
}
if (setting('twitter_content_types') == '') {
cron_log('No content types have been configured for tweeting. Exiting.');
$this->settings_model->update_setting('twitter_last_tweet', date('Y-m-d H:i:s'));
return FALSE;
}
// load libraries
$CI =& get_instance();
$CI->load->model('publish/content_model');
require APPPATH . 'modules/twitter/libraries/twitteroauth.php';
// only process last hour
$start_date = date('Y-m-d', strtotime('now - 1 hour'));
$types = unserialize(setting('twitter_content_types'));
$topics = setting('twitter_topics') == '' ? NULL : unserialize(setting('twitter_topics'));
// if they have all topics...
if (is_int($topics) && ($topics = 0) || is_array($topics) && in_array(0, $topics)) {
$topics = NULL;
}
foreach ($types as $type) {
$filter = array('type' => $type, 'start_date' => $start_date, 'limit' => '50');
if (is_int($topics) && $topics != 0 || is_array($topics) && !in_array(0, $topics)) {
$filter['topics'] = $topics;
}
$contents = $CI->content_model->get_contents($filter);
if (!empty($contents)) {
// flip so that the latest posts are tweeted last
$contents = array_reverse($contents);
foreach ($contents as $content) {
// have we already tweeted this?
if ($this->db->select('link_id')->from('links')->where('link_module', 'twitter')->where('link_parameter', $content['link_id'])->get()->num_rows() > 0) {
continue;
}
if (!isset($connection)) {
$connection = new TwitterOAuth(setting('twitter_consumer_key'), setting('twitter_consumer_secret'), setting('twitter_oauth_token'), setting('twitter_oauth_token_secret'));
cron_log('Connected to Twitter via OAuth.');
}
// build $status
// shorten URL
$CI->load->model('link_model');
$CI->load->helper('string');
$string = random_string('alnum', 5);
// make sure it's unique
$url_path = $CI->link_model->get_unique_url_path($string);
$url = site_url($url_path);
$this->load->model('twitter/bitly_model', 'bitly');
$bitlyUrl = $this->bitly->shorten_url($url);
if ($bitlyUrl) {
$url = $bitlyUrl;
}
// start with URL
$status = $url;
// how many characters remain?
$chars_remain = 140 - strlen($status);
// shorten title to fit before link
$CI->load->helper('shorten');
$shortened_title = shorten($content['title'], $chars_remain - 5, FALSE);
$shortened_title = str_replace('&hellip', '...', $shortened_title);
$status = $shortened_title . ' ' . $status;
// insert into links table
$CI->link_model->new_link($url_path, FALSE, $content['title'], 'Twitter Link', 'twitter', 'twitter', 'redirect', $content['link_id']);
//insert tweet content into tweets_sent
$this->twitter_log($status, $content['id'], $type);
cron_log('Posting status: ' . $status);
$result = $connection->post('statuses/update', array('status' => $status));
if ($connection->http_code != 200) {
cron_log('Connection to Twitter failed. Exiting.');
return FALSE;
}
}
}
}
// update cron run
$this->settings_model->update_setting('twitter_last_tweet', date('Y-m-d H:i:s'));
return TRUE;
}
示例6: mail_queue
/**
* Send Mail from the Queue
*
* @return void
*/
function mail_queue()
{
$CI =& get_instance();
set_time_limit(500);
if (!function_exists('cron_log')) {
$CI->load->helper('cron_log');
}
cron_log('Beginning the Mail Queue cronjob.');
$mail_queue_limit = setting('mail_queue_limit');
if (empty($mail_queue_limit) or !is_numeric($mail_queue_limit) or $mail_queue_limit > 5000) {
$mail_queue_limit = 450;
}
// get mail from queue
$this->db->select('*');
$this->db->from('mail_queue');
$this->db->order_by('date', 'ASC');
$this->db->limit($mail_queue_limit);
$result = $this->db->get();
if ($result->num_rows() == 0) {
// nothing in the queue
// delete all mail queue files
$mail_queue_folder = setting('path_writeable') . 'mail_queue';
$CI->load->helper('directory');
$files = directory_map($mail_queue_folder);
if (is_array($files)) {
foreach ($files as $file) {
// is this a queue file?
if (strpos($file, '.email') !== FALSE) {
// unnecessary but basic checks to make sure we won't wipe out the entire file system
if (!empty($mail_queue_folder) and strpos($mail_queue_folder, '.') !== 0 and $file != '.' and strpos($file, '.') !== 0) {
unlink($mail_queue_folder . '/' . $file);
}
}
}
}
cron_log('No emails found to send. Exiting.');
return FALSE;
}
// store the previous body here, so we don't keep having to access the
// writeable/mail_queue/*.email files
$previous_body = '';
$previous_body_file = '';
$sent_count = 0;
$failed_count = 0;
foreach ($result->result_array() as $mail) {
$config = array();
$config['mailtype'] = $mail['is_html'] == '1' ? 'html' : 'text';
$config['wordwrap'] = $mail['wordwrap'] == '1' ? FALSE : TRUE;
$CI->email->initialize($config);
// To:
if (strpos($mail['to'], ',') !== FALSE) {
// we have multiple emails
$emails = explode(',', $mail['to']);
$mail['to'] = array();
foreach ($emails as $email) {
$mail['to'][] = $email;
}
}
$CI->email->to($mail['to']);
// From:
$CI->email->from($mail['from_email'], $mail['from_name']);
// Build Subject
$subject = $mail['subject'];
$CI->email->subject($subject);
// Build Body
if (empty($previous_body_file) or empty($previous_body) or $mail['body'] != $previous_body_file) {
// read body from file
$CI->load->helper('file');
$mail_queue_folder = setting('path_writeable') . 'mail_queue';
$body = read_file($mail_queue_folder . '/' . $mail['body']);
$previous_body_file = $mail['body'];
$previous_body = $body;
} else {
$body = $previous_body;
}
$CI->email->message((string) $body);
// Send!
if ($CI->email->send()) {
log_message('debug', '[Send Mail] Email sent to: ' . $mail['to']);
$sent_count++;
} else {
log_message('debug', '[Send Mail] Unable to send mail to: ' . $mail['to'] . '. DEBUGGER: ' . $CI->email->print_debugger());
$failed_count++;
}
$CI->email->clear();
$this->db->delete('mail_queue', array('mail_queue_id' => $mail['mail_queue_id']));
}
cron_log("{$sent_count} emails sent. {$failed_count} failed emails.");
return;
}
示例7: call_job
/**
* Call a cron job.
*
* @param string Name of the job
* @param string Params for the job
*/
function call_job($job_name, $job_params = array())
{
global $DB, $inc_path, $Plugins;
global $result_message, $result_status, $timestop, $time_difference;
$result_message = NULL;
$result_status = 'error';
if (preg_match('~^plugin_(\\d+)_(.*)$~', $job_name, $match)) {
// Cron job provided by a plugin:
if (!is_object($Plugins)) {
load_class('plugins/model/_plugins.class.php');
$Plugins =& new Plugins();
}
$Plugin =& $Plugins->get_by_ID($match[1]);
if (!$Plugin) {
$result_message = 'Plugin for controller [' . $job_name . '] could not get instantiated.';
cron_log($result_message);
return;
}
// CALL THE PLUGIN TO HANDLE THE JOB:
$tmp_params = array('ctrl' => $match[2], 'params' => $job_params);
$sub_r = $Plugins->call_method($Plugin->ID, 'ExecCronJob', $tmp_params);
$error_code = (int) $sub_r['code'];
$result_message = $sub_r['message'];
} else {
$controller = $inc_path . $job_name;
if (!is_file($controller)) {
$result_message = 'Controller [' . $job_name . '] does not exist.';
cron_log($result_message);
return;
}
// INCLUDE THE JOB FILE AND RUN IT:
$error_code = (require $controller);
}
if ($error_code != 1) {
// We got an error
$result_status = 'error';
$result_message = '[Error code: ' . $error_code . ' ] ' . $result_message;
} else {
$result_status = 'finished';
}
$timestop = time() + $time_difference;
cron_log('Task finished at ' . date('H:i:s', $timestop) . ' with status: ' . $result_status . "\nMessage: {$result_message}");
}
示例8: ini_set
if (!isset($argv[1]) or $argv[1] != 'perl') {
echo "Parametri väärin!!!\n";
die;
}
if (!isset($argv[2]) or $argv[2] == '') {
echo "Anna tiedosto!!!\n";
die;
}
// otetaan includepath aina rootista
ini_set("include_path", ini_get("include_path") . PATH_SEPARATOR . dirname(__FILE__) . PATH_SEPARATOR . "/usr/share/pear");
error_reporting(E_ALL ^ E_WARNING ^ E_NOTICE);
ini_set("display_errors", 0);
require "inc/connect.inc";
require "inc/functions.inc";
// Logitetaan ajo
cron_log($argv[2]);
$userfile = trim($argv[2]);
$filenimi = $userfile;
$ok = 1;
$palvelin2 = "";
ob_start();
} else {
require "inc/parametrit.inc";
echo "<font class='head'>Tiliotteen, LMP:n, kurssien, verkkolaskujen ja viitemaksujen käsittely</font><hr><br>\n<br>\n";
echo "<form enctype='multipart/form-data' name='sendfile' method='post'>";
echo "<table>";
echo " <tr>\n <th>" . t("Pankin aineisto") . ":</th>\n <td><input type='file' name='userfile'></td>\n <td class='back'><input type='submit' value='" . t("Käsittele tiedosto") . "'></td>\n </tr>";
echo "</table>";
echo "</form><br>\n<br>\n";
echo " <script type='text/javascript' language='JavaScript'>\n <!--\n function verify() {\n msg = '" . t("Oletko varma?") . "';\n\n if (confirm(msg)) {\n return true;\n }\n else {\n skippaa_tama_submitti = true;\n return false;\n }\n }\n -->\n </script>";
}
示例9: sleep
// End foreach
//#############################################################################
//# END Scan Ini File #
//#############################################################################
//print_r($dummy); // Test line displays cron page output
$loop = 0;
// Reset loop counter
}
$loop = $loop + 1;
// Increment loop counter
}
sleep(1);
// Base delay one second allows stop to be checked
}
if ($logging) {
cron_log("### Log Ended ===========================\n");
}
//=== Log =====================================================================
// Logs Cron actions to a log file
// Input: String to be logged
// $file Path to file including file name
function cron_log($str)
{
global $log_file;
// path and name to log file
$str = date('Y-m-d H:i') . " " . $str . "\n";
$fh = fopen($log_file, 'a') or die("can't open file");
fwrite($fh, $str);
fclose($fh);
}
//=== END Log =================================================================
示例10: hook_cron
function hook_cron()
{
$CI =& get_instance();
cron_log('Beginning billing cronjob.');
$run_cron = TRUE;
// cron run time?
if ($CI->config->item('billing_cron_time')) {
$run_time = (int) $CI->config->item('billing_cron_time');
} else {
$run_time = 11;
}
// we only need this to run once per day
if (setting('cron_billing_last_update') === FALSE) {
cron_log('Created billing last update setting to track billing cron runs and limit them to once per day.');
$this->settings_model->new_setting(1, 'cron_billing_last_update', date('Y-m-d H:i:s'), 'When did the billing cron job last run?', 'text', '', FALSE, TRUE);
} elseif (date('Y-m-d') == date('Y-m-d', strtotime(setting('cron_billing_last_update')))) {
cron_log('Billing cronjob has already run today. Exiting.');
$run_cron = FALSE;
} elseif ((int) date('H') < $run_time) {
cron_log('Billing cronjob is configured not to run until ' . $run_time . ' hours. Exiting.');
$run_cron = FALSE;
} else {
cron_log('Updated billing last update setting to current time. We\'re running it!');
$this->settings_model->update_setting('cron_billing_last_update', date('Y-m-d H:i:s'));
}
if ($run_cron == FALSE) {
return;
}
// subscription maintenance
$CI->load->model('billing/gateway_model');
$CI->load->model('billing/recurring_model');
// cancel subscriptions if end_date is today or earlier and they are still active
$cancelled = array();
$subscriptions = $this->get_subscriptions(array('end_date_before' => date('Y-m-d', strtotime('now')), 'active' => '1'));
if (!empty($subscriptions)) {
foreach ($subscriptions as $subscription) {
$response = $this->cancel_subscription($subscription['id']);
if ($response) {
$this->app_hooks->data('subscription', $subscription['id']);
$this->app_hooks->trigger('subscription_cancel', $subscription['id']);
$this->app_hooks->reset();
$cancelled[] = $subscription['id'];
}
}
}
// expire subscriptions with an end_date of today or earlier and expiry_processed == 0
$expired = array();
$subscriptions = $this->get_subscriptions(array('end_date_before' => date('Y-m-d', strtotime('now')), 'expiry_processed' => '0'));
if (!empty($subscriptions)) {
foreach ($subscriptions as $subscription) {
$this->expire_subscription($subscription['id']);
if ($subscription['is_renewed'] == TRUE or $subscription['is_updated'] == TRUE) {
// don't send confusing notices
continue;
}
$this->app_hooks->data('subscription', $subscription['id']);
$this->app_hooks->trigger('subscription_expire', $subscription['id']);
$this->app_hooks->reset();
$expired[] = $subscription['id'];
}
}
// charge subscriptions that need to be charged today
$today = date('Y-m-d');
$subscriptions = $CI->recurring_model->GetAllSubscriptionsForCharging($today);
$charge_success = array();
$charge_failure = array();
if ($subscriptions) {
foreach ($subscriptions as $subscription) {
// try and make the charge
$response = $CI->gateway_model->ChargeRecurring($subscription);
if ($response) {
$charge_success[] = $subscription['subscription_id'];
} else {
$charge_failure[] = $subscription['subscription_id'];
}
}
}
// Check for emails to send
// Get all the recurring charge emails to send in one week
$sent_emails['subscription_autorecur_in_week'] = array();
$next_week = mktime(0, 0, 0, date('m'), date('d') + 7, date('Y'));
$charges = $CI->recurring_model->GetChargesByDate($next_week);
if ($charges) {
foreach ($charges as $charge) {
$this->app_hooks->data('subscription', $charge['subscription_id']);
$this->app_hooks->trigger('subscription_renew_1_week', $charge['subscription_id']);
$this->app_hooks->reset();
$sent_emails['subscription_autorecur_in_week'][] = $charge['subscription_id'];
}
}
// Get all the recurring charge emails to send in one month
$sent_emails['subscription_autorecur_in_month'] = array();
$next_month = mktime(0, 0, 0, date('m') + 1, date('d'), date('Y'));
$charges = $CI->recurring_model->GetChargesByDate($next_month);
if ($charges) {
foreach ($charges as $charge) {
if ($charge['renewed'] == '1' or $charge['updated'] == '1') {
// don't send confusing notices
continue;
}
//.........这里部分代码省略.........
示例11: list
} else {
if (isset($xml->Package->Package)) {
$element = $xml->Package->Package;
} else {
$element = $xml->Package;
}
list($_sscc, $_laatikkoind) = teccom_asn_paketti($element, $tavarantoimittajanumero, $asn_numero);
$parameters['sscc'] = $_sscc;
$parameters['laatikkoind'] = $_laatikkoind;
// loop_packet funktio tekee kaikki lisäykset asn-sanomatauluun ja palauttaa viimeisen lisätyn rivin mysql_id() joka laitetaan liitetiedostoon.
$tunnus_liitetiedostoon = loop_packet($xml, $parameters);
$tecquery = "INSERT INTO liitetiedostot SET\n yhtio = '{$kukarow['yhtio']}',\n liitos = 'asn_sanomat',\n liitostunnus = '{$tunnus_liitetiedostoon}',\n data = '{$tiedosto_sisalto}',\n selite = '{$tavarantoimittajanumero} ASN_sanoman {$asn_numero} tiedosto',\n filename = '{$file}',\n filesize = length(data),\n filetype = 'text/xml',\n image_width = '',\n image_height = '',\n image_bits = '',\n image_channels = '',\n kayttotarkoitus = 'TECCOM-ASN',\n jarjestys = '1',\n laatija = '{$kukarow['kuka']}',\n luontiaika = now()";
$Xresult = pupe_query($tecquery);
rename($teccomkansio . "/" . $file, $teccomkansio_valmis . "/" . $file);
// Logitetaan ajo
cron_log($teccomkansio_valmis . "/" . $file);
}
} else {
echo t("Virhe! Tavarantoimittajan numero puuttuu sekä ASN-numero puuttuu, tai materiaali ei ole ASN-sanoma") . "\n";
rename($teccomkansio . "/" . $file, $teccomkansio_error . "/" . $file);
}
} else {
echo t("Tiedosto ei ole XML-sanoma") . ": {$tiedosto}\n\n";
rename($teccomkansio . "/" . $file, $teccomkansio_error . "/" . $file);
}
}
}
require "inc/asn_kohdistus.inc";
asn_kohdistus($tavarantoimittajanumero);
} else {
echo "Hakemistoa {$teccomkansio} ei löydy\n";
示例12: pupe_query
$rivin_tuoteno[$valmis_era_chk_row['tilausrivi']] = $varattu_row['tuoteno'];
$vertaus_hylly[$valmis_era_chk_row['tilausrivi']] = $varattu_row['varastopaikka_rekla'];
$keraysera_vyohyke = $valmis_era_chk_row["keraysvyohyke"];
}
$query = "SELECT printteri1, printteri3\n FROM keraysvyohyke\n WHERE yhtio = '{$kukarow['yhtio']}'\n AND tunnus = '{$keraysera_vyohyke}'";
$printteri_res = pupe_query($query);
$printteri_row = mysql_fetch_assoc($printteri_res);
// setataan muuttujat keraa.php:ta varten
$tee = "P";
$toim = "";
$id = $keraysera_nro;
$keraajanro = "";
// vakadr-tulostin on aina sama kuin lähete-tulostin
$valittu_tulostin = $vakadr_tulostin = $printteri_row['printteri1'];
$valittu_oslapp_tulostin = $printteri_row['printteri3'];
$lahetekpl = $vakadrkpl = $yhtiorow["oletus_lahetekpl"];
$oslappkpl = $yhtiorow["oletus_oslappkpl"];
$lasku_yhtio = "";
$real_submit = "Merkkaa kerätyksi";
require 'tilauskasittely/keraa.php';
}
}
}
fclose($_fh);
rename($ftpget_dest[$operaattori] . "/" . $file, $ftpget_dest[$operaattori] . "/ok/" . $file);
// Logitetaan ajo
cron_log($ftpget_dest[$operaattori] . "/ok/" . $file);
}
}
}
closedir($kardex_handle);
示例13: while
if ($handle = opendir($kansio)) {
while (($lasku = readdir($handle)) !== FALSE) {
// Ei käsitellä kun Apix tiedostoja
if (!preg_match("/Apix_(.*?)_invoices_([0-9]*?)_/", $lasku, $matsit)) {
continue;
}
$yhtio = $matsit[1];
$yhtiorow = hae_yhtion_parametrit($yhtio);
$kukarow = hae_kukarow('admin', $yhtio);
$laskunro = $matsit[2];
// Jos lasku on liian vanha, ei käsitellä, lähetetään maililla
if (onko_lasku_liian_vanha($kansio . $lasku)) {
continue;
}
// Logitetaan ajo
cron_log("{$pupe_root_polku}/dataout/{$lasku}");
$status = apix_invoice_put_file($lasku, $laskunro);
echo "APIX-lähetys {$status}<br>\n";
}
closedir($handle);
}
function onko_lasku_liian_vanha($filename)
{
global $kukarow, $yhtiorow;
// Otetaan filen koko polku
$filename = realpath($filename);
// Jos file ollut alle vuorokauden error kansiossa, niin ei ole liian vanha
if (time() - filemtime($filename) < 86400) {
return false;
}
// Muuten on liian vanha ja lähetetään meili
示例14: rand
// Note: we use the current time for 2 reasons: 1) prevent scheduling something in the past AND 2) introduce variety so that everyone doesn't run his repeated tasks at the same exact time, especially pings, pollings...
if ($task->ctsk_controller == 'cron/_antispam_poll.job.php') {
// THIS IS A HACK. Guess why we need that!? :P Please do not override or you'll kill our server :(
$new_start_datetime = $localtimenow + rand(43200, 86400);
// 12 to 24 hours
} else {
// Normal
$new_start_datetime = $localtimenow + $task->ctsk_repeat_after;
}
$sql = 'INSERT INTO T_cron__task( ctsk_start_datetime, ctsk_repeat_after, ctsk_name, ctsk_controller, ctsk_params )
VALUES( ' . $DB->quote(date2mysql($new_start_datetime)) . ', ' . $DB->quote($task->ctsk_repeat_after) . ', ' . $DB->quote($ctsk_name) . ', ' . $DB->quote($task->ctsk_controller) . ', ' . $DB->quote($task->ctsk_params) . ' )';
$DB->query($sql, 'Schedule repeated task.');
}
$DB->show_errors = true;
$DB->halt_on_error = true;
cron_log('Starting task #' . $ctsk_ID . ' [' . $ctsk_name . '] at ' . date('H:i:s', $localtimenow) . '.');
if (empty($task->ctsk_params)) {
$cron_params = array();
} else {
$cron_params = unserialize($task->ctsk_params);
}
// The job may need to know its ID (to set logical locks for example):
$cron_params['ctsk_ID'] = $ctsk_ID;
// EXECUTE
call_job($task->ctsk_controller, $cron_params);
// Record task as finished:
if (empty($timestop)) {
$timestop = time() + $time_difference;
}
$sql = ' UPDATE T_cron__log
SET clog_status = ' . $DB->quote($result_status) . ',
示例15: hook_cron
function hook_cron()
{
cron_log('Beginning Content Publish/Unpublish cronjob.');
// load libraries
//$CI =& get_instance();
//$CI->load->model('content_model');
cron_log('Unpublished Posts: ' . $this->update_unpublish_content());
cron_log('Published Posts: ' . $this->update_publish_content());
return TRUE;
}