xref: /dokuwiki/lib/exe/indexer.php (revision 9493c275054ef649b724c083fdac46388e6e1361)
1<?php
2/**
3 * DokuWiki indexer
4 *
5 * @license    GPL 2 (http://www.gnu.org/licenses/gpl.html)
6 * @author     Andreas Gohr <andi@splitbrain.org>
7 */
8if(!defined('DOKU_INC')) define('DOKU_INC',dirname(__FILE__).'/../../');
9define('DOKU_DISABLE_GZIP_OUTPUT',1);
10require_once(DOKU_INC.'inc/init.php');
11session_write_close();  //close session
12if(!defined('NL')) define('NL',"\n");
13
14// keep running after browser closes connection
15@ignore_user_abort(true);
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'];
20if(!$defer && !$output){
21    sendGIF(); // send gif
22}
23
24$ID = cleanID($INPUT->str('id'));
25
26// Catch any possible output (e.g. errors)
27if(!$output) ob_start();
28else header('Content-Type: text/plain');
29
30$taskRunner = new \dokuwiki\TaskRunner();
31$taskRunner->run();
32
33if(!$output) {
34    ob_end_clean();
35    if($defer) sendGIF();
36}
37
38exit;
39
40// --------------------------------------------------------------------
41
42/**
43 * Just send a 1x1 pixel blank gif to the browser
44 *
45 * @author Andreas Gohr <andi@splitbrain.org>
46 * @author Harry Fuecks <fuecks@gmail.com>
47 */
48function 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