[ Index ]
 

Code source de SugarCRM 5.0.0beta1

Accédez au Source d'autres logiciels libresSoutenez Angelica Josefina !

title

Body

[fermer]

/ -> cron.php (source)

   1  <?php
   2   if(!defined('sugarEntry'))define('sugarEntry', true);
   3  /*********************************************************************************

   4   * SugarCRM is a customer relationship management program developed by

   5   * SugarCRM, Inc. Copyright (C) 2004 - 2007 SugarCRM Inc.

   6   * 

   7   * This program is free software; you can redistribute it and/or modify it under

   8   * the terms of the GNU General Public License version 3 as published by the

   9   * Free Software Foundation.

  10   * 

  11   * This program is distributed in the hope that it will be useful, but WITHOUT

  12   * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS

  13   * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more

  14   * details.

  15   * 

  16   * You should have received a copy of the GNU General Public License along with

  17   * this program; if not, see http://www.gnu.org/licenses or write to the Free

  18   * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA

  19   * 02110-1301 USA.

  20   * 

  21   * You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,

  22   * SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.

  23   * 

  24   * The interactive user interfaces in modified source and object code versions

  25   * of this program must display Appropriate Legal Notices, as required under

  26   * Section 5 of the GNU General Public License version 3.

  27   * 

  28   * In accordance with Section 7(b) of the GNU General Public License version 3,

  29   * these Appropriate Legal Notices must retain the display of the "Powered by

  30   * SugarCRM" logo. If the display of the logo is not reasonably feasible for

  31   * technical reasons, the Appropriate Legal Notices must display the words

  32   * "Powered by SugarCRM".

  33   ********************************************************************************/
  34  require_once ('include/entryPoint.php');
  35  
  36  if(empty($current_language)) {
  37      $current_language = $sugar_config['default_language'];
  38  }
  39  
  40  ///////////////////////////////////////////////////////////////////////////////

  41  ////    PREP FOR SCHEDULER PID

  42  $GLOBALS['log']->debug('--------------------------------------------> at cron.php <--------------------------------------------');
  43  
  44  $cachePath = 'cache/modules/Schedulers';
  45  $pid = 'pid.php';
  46  if(!is_dir($cachePath)) {
  47      mkdir_recursive($cachePath);
  48  }
  49  if(!is_file($cachePath.'/'.$pid)) {
  50      if(is_writable($cachePath)) { // the "file" does not yet exist
  51          write_array_to_file('timestamp', array(strtotime(date('H:i'))) , $cachePath.'/'.$pid);
  52          require_once($cachePath.'/'.$pid);
  53      } else {
  54          $GLOBALS['log']->fatal('Scheduler cannot write PID file.  Please check permissions on '.$cachePath);
  55      }
  56  } else {
  57      if(is_writable($cachePath.'/'.$pid)) {
  58          require_once($cachePath.'/'.$pid);
  59      } else {
  60          $GLOBALS['log']->fatal('Scheduler cannot read the PID file.  Please check permissions on '.$cachePath);
  61      }
  62  }
  63  ////    END PREP FOR SCHEDULER PID

  64  ///////////////////////////////////////////////////////////////////////////////

  65  
  66  ///////////////////////////////////////////////////////////////////////////////

  67  ////    EXECUTE IF VALID TIME (NOT DDOS)

  68  
  69  
  70  
  71  
  72  if($timestamp[0] < strtotime(date('H:i'))) {
  73      if(is_writable($cachePath.'/'.$pid)) {
  74          write_array_to_file('timestamp', array(strtotime(date('H:i'))) , $cachePath.'/'.$pid);
  75          require ('modules/Schedulers/Scheduler.php');
  76          $s = new Scheduler();
  77          $s->flushDeadJobs();
  78          $s->checkPendingJobs();
  79      } else {
  80          $GLOBALS['log']->fatal('Scheduler cannot write PID file.  Please check permissions on '.$cachePath);
  81      }
  82  } else {
  83      $GLOBALS['log']->fatal('If you see a whole string of these, there is a chance someone is attacking your system.');
  84  
  85  
  86  
  87  }
  88  sugar_cleanup(true);
  89  ?>


Généré le : Tue Sep 11 10:48:47 2007 par Balluche grâce à PHPXref 0.7