Changeset 1351 for branches/1.2/content/plugins
- Timestamp:
- 03/19/10 04:09:05 (3 years ago)
- File:
-
- 1 edited
-
branches/1.2/content/plugins/cron/cron.php (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/1.2/content/plugins/cron/cron.php
r1339 r1351 44 44 $hook = "cron_hotaru_version"; 45 45 $this->cron_schedule_event($h, $timestamp, $recurrence, $hook); 46 47 if (SYS_FEEDBACK == 'true') { 48 $hook = "cron_hotaru_feedback"; 49 $this->cron_schedule_event($h, $timestamp, $recurrence, $hook); 50 } 46 51 } 47 52 … … 377 382 } 378 383 384 public function cron_hotaru_feedback($h) { 385 $query_vals = array( 386 'api_key' => '', 387 'format' => 'json', 388 'method' => 'hotaru.systemFeedback.add', 389 'version' => $h->version 390 ); 391 392 $info = $this->sendApiRequest($h, $query_vals); 393 394 } 395 379 396 public function cron_hotaru_version($h) { 380 397 $query_vals = array( … … 384 401 ); 385 402 403 $info = $this->sendApiRequest($h, $query_vals); 404 405 // save the updated version number to the local db so we can display it on the admin panel until it gets updated. 406 if (isset($info['version'])) 407 $h->updateSetting('hotaru_latest_version', serialize($info), 'cron'); 408 } 409 410 public function sendApiRequest($h, $query_vals) { 411 386 412 // Generate the POST string 387 413 $ret = ''; … … 398 424 $response = curl_exec($ch); 399 425 curl_close ($ch); 400 401 $info = json_decode($response, true); 402 403 // save the updated version number to the local db so we can display it on the admin panel until it gets updated. 404 if (isset($info['version'])) 405 $h->updateSetting('hotaru_latest_version', serialize($info), 'cron'); 406 } 426 427 return json_decode($response, true); 428 } 429 407 430 408 431 public function checkrunCron($h) { … … 444 467 { 445 468 $h->vars['cron_settings'] = $h->getSerializedSettings(); 446 447 $timestamp = $cron_data['timestamp']; 448 $recurrence = $cron_data['recurrence']; 449 $hook = $cron_data['hook']; 450 $args = $cron_data['args']; 451 $id = $cron_data['args']['id']; 469 470 $timestamp = (isset($cron_data['timestamp'])) ? $cron_data['timestamp'] : array(); 471 $recurrence = (isset($cron_data['recurrence'])) ? $cron_data['recurrence'] : array(); 472 $hook = (isset($cron_data['hook'])) ? $cron_data['hook'] : array(); 473 $args = (isset($cron_data['args'])) ? $cron_data['args'] : array(); 452 474 $cron_exists = false; 453 475 454 // check whether already have existing event for this job476 // check whether already have existing event for this job 455 477 // match against hook and args. note args must match 456 478 $current_crons = $this->_get_cron_array($h); 457 479 foreach ($current_crons as $current_timestamp => $current_cronhooks) { 458 480 foreach ($current_cronhooks as $current_hook => $current_keys) { 459 if ($current_hook == $hook && $current_keys = $args) { 481 if ($current_hook == $hook) { 482 foreach ($current_keys as $current_md5 => $current_job) { 483 //print_r( $current_job["args"]); print " ** "; print_r($args); 484 if ($current_job["args"] == $args) { 460 485 $this->cron_schedule_event($h, $timestamp, $recurrence, $hook, $args); 461 486 $this->cron_unschedule_event($h, $current_timestamp, $current_hook, $args); 462 487 $cron_exists = true; 463 } 488 }}} 464 489 } 465 490 } … … 471 496 { 472 497 //load current cron jobs from memory space 473 $h->vars['cron_settings'] = $h->getSerializedSettings(); 474 475 $hook = $cron_data['hook'];476 $args = $cron_data['args'];498 $h->vars['cron_settings'] = $h->getSerializedSettings(); 499 500 $hook = (isset($cron_data['hook'])) ? $cron_data['hook'] : array(); 501 $args = (isset($cron_data['args'])) ? $cron_data['args'] : array(); 477 502 478 503 $current_crons = $this->_get_cron_array($h); … … 495 520 $h->vars['cron_settings'] = $h->getSerializedSettings(); 496 521 497 $hook = $cron_data['hook'];522 $hook = (isset($cron_data['hook'])) ? $cron_data['hook'] : array(); 498 523 $flush_count = 0; 499 524
Note: See TracChangeset
for help on using the changeset viewer.