PageRenderTime 25ms CodeModel.GetById 2ms app.highlight 2ms RepoModel.GetById 1ms app.codeStats 0ms

/silverlining/mgr-scripts/master-runner.php

https://bitbucket.org/ianb/silverlining/
PHP | 43 lines | 33 code | 6 blank | 4 comment | 10 complexity | b4d0dcd66b9ac8b80da82cd8f9530a40 MD5 | raw file
 1<?php
 2  /*
 3  This command is like master-runner.py, and runs at the beginning of
 4  every PHP request.
 5   */
 6
 7if ($_SERVER['SILVER_SCRIPT_NAME']) {
 8    $_SERVER['SCRIPT_NAME'] = $_SERVER['SILVER_SCRIPT_NAME'];
 9}
10
11if ($_SERVER['SILVER_INSTANCE_DIR']) {
12    $silver_base = $_SERVER['SILVER_INSTANCE_DIR'];
13} else {
14    $silver_base = "/var/www/{$_SERVER[SILVER_INSTANCE_NAME]}";
15}
16if (! $_SERVER['SILVER_CANONICAL_HOSTNAME']) {
17    $_SERVER['SILVER_CANONICAL_HOSTNAME'] = $_SERVER['HTTP_HOST'];
18}
19
20$silver_app_ini = "$silver_base/app.ini";
21$silver_app_config = parse_ini_file($silver_app_ini, true);
22$silver_runner = $silver_app_config['production']['runner'];
23$silver_php_root = $silver_app_config['production']['php_root'];
24
25if ($_SERVER['SILVER_SECRET_FILE']) {
26    define('SILVER_SECRET', file_get_contents($_SERVER['SILVER_SECRET_FILE']));
27} else {
28    define('SILVER_SECRET', file_get_contents('/var/lib/silverlining/secret.txt'));
29}
30
31if ($_SERVER['SILVER_FUNCS']) {
32    require_once $_SERVER['SILVER_FUNCS'];
33} else {
34    require_once "/usr/local/share/silverlining/lib/silversupport/php/functions.php";
35}
36if ($_SERVER['SILVER_ENV_VARS']) {
37    include $_SERVER['SILVER_ENV_VARS'];
38} else {
39    include "{$silver_base}/silver-env-variables.php";
40}
41include "{$silver_base}/{$silver_runner}";
42
43?>