Failed Conditions
Push — TaskRunner ( b413fb )
by Michael
05:21
created

indexer.php ➔ runSitemapper()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 6
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 5
nc 2
nop 0
dl 0
loc 6
rs 9.4285
c 0
b 0
f 0
1
<?php
2
/**
3
 * DokuWiki indexer
4
 *
5
 * @license    GPL 2 (http://www.gnu.org/licenses/gpl.html)
6
 * @author     Andreas Gohr <[email protected]>
7
 */
8
if(!defined('DOKU_INC')) define('DOKU_INC',dirname(__FILE__).'/../../');
9
define('DOKU_DISABLE_GZIP_OUTPUT',1);
10
require_once(DOKU_INC.'inc/init.php');
11
session_write_close();  //close session
12
if(!defined('NL')) define('NL',"\n");
13
14
// keep running after browser closes connection
15
@ignore_user_abort(true);
1 ignored issue
show
Security Best Practice introduced by
It seems like you do not handle an error condition here. This can introduce security issues, and is generally not recommended.

If you suppress an error, we recommend checking for the error condition explicitly:

// For example instead of
@mkdir($dir);

// Better use
if (@mkdir($dir) === false) {
    throw new \RuntimeException('The directory '.$dir.' could not be created.');
}
Loading history...
16
17
// check if user abort worked, if yes send output early
18
$defer = !@ignore_user_abort() || $conf['broken_iua'];
19
$output = $INPUT->has('debug') && $conf['allowdebug'];
20
if(!$defer && !$output){
21
    sendGIF(); // send gif
22
}
23
24
$ID = cleanID($INPUT->str('id'));
25
26
// Catch any possible output (e.g. errors)
27
if(!$output) ob_start();
28
else header('Content-Type: text/plain');
29
30
$taskRunner = new \dokuwiki\TaskRunner();
31
$taskRunner->run();
32
33
if(!$output) {
34
    ob_end_clean();
35
    if($defer) sendGIF();
36
}
37
38
exit;
39
40
// --------------------------------------------------------------------
41
42
/**
43
 * Just send a 1x1 pixel blank gif to the browser
44
 *
45
 * @author Andreas Gohr <[email protected]>
46
 * @author Harry Fuecks <[email protected]>
47
 */
48
function sendGIF(){
49
    $img = base64_decode('R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAEALAAAAAABAAEAAAIBTAA7');
50
    header('Content-Type: image/gif');
51
    header('Content-Length: '.strlen($img));
52
    header('Connection: Close');
53
    print $img;
54
    tpl_flush();
55
    // Browser should drop connection after this
56
    // Thinks it's got the whole image
57
}
58
59
//Setup VIM: ex: et ts=4 :
60
// No trailing PHP closing tag - no output please!
61
// See Note at http://php.net/manual/en/language.basic-syntax.instruction-separation.php
62