1 | <?php |
||
0 ignored issues
–
show
|
|||
2 | |||
3 | /** |
||
4 | * scheduler.php |
||
5 | * Built-in autorun scheduler |
||
6 | * |
||
7 | * @package statistics |
||
8 | * @version 2 |
||
9 | * |
||
10 | * Revision History |
||
11 | * ================ |
||
12 | * 2 - copyright (c) 2009-2010 by Gorlum for http://supernova.ws |
||
13 | * [+] Added locking mechanic made impossible to run several updates at once |
||
14 | * [~] Complies to PCG1 |
||
15 | * |
||
16 | * 1 - copyright (c) 2009-2010 by Gorlum for http://supernova.ws |
||
17 | * [!] Initial revision wrote from scratch |
||
18 | * |
||
19 | */ |
||
20 | |||
21 | require_once('includes/init.php'); |
||
22 | |||
23 | define('IN_AJAX', true); |
||
24 | |||
25 | if(($result = StatUpdateLauncher::scheduler_process()) && !defined('IN_ADMIN')) { |
||
26 | $result = htmlspecialchars($result, ENT_QUOTES, 'UTF-8'); |
||
27 | print(json_encode($result)); |
||
28 | } |
||
29 | |||
30 | if(!defined('IN_ADMIN')) { |
||
31 | die(); |
||
32 | } |
||
33 |
The PSR-1: Basic Coding Standard recommends that a file should either introduce new symbols, that is classes, functions, constants or similar, or have side effects. Side effects are anything that executes logic, like for example printing output, changing ini settings or writing to a file.
The idea behind this recommendation is that merely auto-loading a class should not change the state of an application. It also promotes a cleaner style of programming and makes your code less prone to errors, because the logic is not spread out all over the place.
To learn more about the PSR-1, please see the PHP-FIG site on the PSR-1.