forked from SimpleMachines/SMF
/
bootstrap.php
62 lines (51 loc) · 1.34 KB
/
bootstrap.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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
<?php
require_once('./SSI.php');
require_once "./vendor/autoload.php";
$db_show_debug = true;
$cache_memcached = 'localhost';
$pg_cache_server = 'localhost';
$pg_cache_user = 'postgres';
$pg_cache_passwd = '';
$_SERVER['REMOTE_ADDR'] = '127.0.0.1';
ob_end_clean();
add_integration_function('integrate_verify_user', 'FeignLoginIntegration');
function FeignLoginIntegration()
{
global $mem;
return $mem;
}
$pi = 0;
prof_print('s' . $pi++);
function FeignLogin($id = 1): void
{
global $mem;
$mem = $id;
reloadSettings();
loadUserSettings();
loadPermissions();
$GLOBALS['txt']['time_format'] = '';
$GLOBALS['settings']['theme_id'] = 0;
loadTheme();
}
$smcFunc['db_query']('', '
UPDATE {db_prefix}scheduled_tasks
SET disabled = 1');
$smcFunc['db_query']('truncate_table', '
TRUNCATE {db_prefix}mail_queue');
prof_print('s' . $pi++);
FeignLogin(1);
prof_print('s' . $pi++);
add_integration_function('integrate_outgoing_email', 'SendMailToQueue');
function SendMailToQueue(&$subject, &$message, &$headers, &$to_array)
{
return AddMailQueue(false, $to_array, $subject, $message, $headers);
//return true;
}
// Call this at each point of interest, passing a descriptive string
function prof_print($str): void
{
static $time_begin = 0;
if ($time_begin != 0)
echo sprintf("%s: %f\n", $str, microtime(true) - $time_begin);
$time_begin = microtime(true);
}