[ Index ]

PHP Cross Reference of phpBB-3.1.10-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_var('cron_type', '');
  46  
  47  // Comment this line out for debugging so the page does not return an image.
  48  output_image();
  49  
  50  $cron_lock = $phpbb_container->get('cron.lock_db');
  51  if ($cron_lock->acquire())
  52  {
  53      $cron = $phpbb_container->get('cron.manager');
  54  
  55      $task = $cron->find_task($cron_type);
  56      if ($task)
  57      {
  58          /**
  59           * This event enables you to catch the task before it runs
  60           *
  61           * @event core.cron_run_before
  62           * @var    \phpbb\cron\task\wrapper    task    Current Cron task
  63           * @since 3.1.8-RC1
  64           */
  65          $vars = array(
  66              'task',
  67          );
  68          extract($phpbb_dispatcher->trigger_event('core.cron_run_before', compact($vars)));
  69  
  70          if ($task->is_parametrized())
  71          {
  72              $task->parse_parameters($request);
  73          }
  74          if ($task->is_ready())
  75          {
  76              $task->run();
  77          }
  78      }
  79      $cron_lock->release();
  80  }
  81  
  82  garbage_collection();


Generated: Sun Feb 19 19:52:41 2017 Cross-referenced by PHPXref 0.7.1