[ Index ]

PHP Cross Reference of phpBB-3.2.0-deutsch

title

Body

[close]

/ -> cron.php (source)

   1  <?php
   2  /**
   3  *
   4  * This file is part of the phpBB Forum Software package.
   5  *
   6  * @copyright (c) phpBB Limited <https://www.phpbb.com>
   7  * @license GNU General Public License, version 2 (GPL-2.0)
   8  *
   9  * For full copyright and license information, please see
  10  * the docs/CREDITS.txt file.
  11  *
  12  */
  13  
  14  /**
  15  */
  16  define('IN_PHPBB', true);
  17  define('IN_CRON', true);
  18  $phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './';
  19  $phpEx = substr(strrchr(__FILE__, '.'), 1);
  20  include($phpbb_root_path . 'common.' . $phpEx);
  21  
  22  // Do not update users last page entry
  23  $user->session_begin(false);
  24  $auth->acl($user->data);
  25  
  26  function output_image()
  27  {
  28      // Output transparent gif
  29      header('Cache-Control: no-cache');
  30      header('Content-type: image/gif');
  31      header('Content-length: 43');
  32  
  33      echo base64_decode('R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==');
  34  
  35      // Flush here to prevent browser from showing the page as loading while
  36      // running cron.
  37      flush();
  38  }
  39  
  40  // Thanks to various fatal errors and lack of try/finally, it is quite easy to leave
  41  // the cron lock locked, especially when working on cron-related code.
  42  //
  43  // Attempt to alleviate the problem by doing setup outside of the lock as much as possible.
  44  
  45  $cron_type = $request->variable('cron_type', '');
  46  
  47  // Comment this line out for debugging so the page does not return an image.
  48  output_image();
  49  
  50  /* @var $cron_lock \phpbb\lock\db */
  51  $cron_lock = $phpbb_container->get('cron.lock_db');
  52  if ($cron_lock->acquire())
  53  {
  54      /* @var $cron \phpbb\cron\manager */
  55      $cron = $phpbb_container->get('cron.manager');
  56  
  57      $task = $cron->find_task($cron_type);
  58      if ($task)
  59      {
  60          /**
  61           * This event enables you to catch the task before it runs
  62           *
  63           * @event core.cron_run_before
  64           * @var    \phpbb\cron\task\wrapper    task    Current Cron task
  65           * @since 3.1.8-RC1
  66           */
  67          $vars = array(
  68              'task',
  69          );
  70          extract($phpbb_dispatcher->trigger_event('core.cron_run_before', compact($vars)));
  71  
  72          if ($task->is_parametrized())
  73          {
  74              $task->parse_parameters($request);
  75          }
  76          if ($task->is_ready())
  77          {
  78              $task->run();
  79          }
  80      }
  81      $cron_lock->release();
  82  }
  83  
  84  garbage_collection();


Generated: Sun Feb 19 19:47:08 2017 Cross-referenced by PHPXref 0.7.1