-
Notifications
You must be signed in to change notification settings - Fork 4
/
sanityCheck.php
47 lines (39 loc) · 1.09 KB
/
sanityCheck.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
<?php
/**
* Pre-deployment sanity check.
*
* A quick integration test to be done during scap: execute a parser cache hit.
*/
// Use WikimediaCommandLine.inc instead of WikimediaMaintenance so that the code
// can be parsed after the autoloader is started, so that we can have
// SanityCheckRequest in the same file as the execution code.
require_once __DIR__ .'/WikimediaCommandLine.inc';
class SanityCheckRequest extends FauxRequest {
public $title;
function __construct() {
$this->title = Title::newMainPage();
parent::__construct( array(
'title' => $this->title->getPrefixedDBkey()
) );
}
function getRequestURL() {
return $this->title->getFullURL( '', false, PROTO_CANONICAL );
}
}
function doSanityCheck() {
$req = new SanityCheckRequest;
$context = new RequestContext;
$context->setRequest( $req );
$main = new MediaWiki( $context );
ob_start();
$main->run();
$result = ob_get_contents();
ob_end_clean();
if ( strpos( $result, '<!-- Served by' ) !== false ) {
exit( 0 );
} else {
echo "sanityCheck.php failed string match test\n";
exit( 1 );
}
}
doSanityCheck();