mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-22 06:42:42 +01:00
Merge __init_env__.php into __init_script__.php
Summary: There are currently two files, but all scripts require both of them, which is clearly silly. In the longer term I want to rewrite all of this init stuff to be more structured (e.g., merge webroot/index.php and __init_script__ better) but this reduces the surface area of the ad-hoc "include files" API we have now, at least. Test Plan: - Grepped for __init_env__.php (no hits) - Ran a unit test (to test unit changes) - Ran a daemon (to test daemon changes) Reviewers: jungejason, nh, tuomaspelkonen, aran Reviewed By: jungejason CC: aran, jungejason Differential Revision: 976
This commit is contained in:
parent
ceceb47033
commit
e4e5c39457
18 changed files with 35 additions and 20 deletions
|
@ -33,3 +33,36 @@ phutil_load_library(dirname(__FILE__).'/../src/');
|
|||
// NOTE: This is dangerous in general, but we know we're in a script context and
|
||||
// are not vulnerable to CSRF.
|
||||
AphrontWriteGuard::allowDangerousUnguardedWrites(true);
|
||||
|
||||
$include_path = ini_get('include_path');
|
||||
ini_set('include_path', $include_path.':'.dirname(__FILE__).'/../../');
|
||||
|
||||
require_once dirname(dirname(__FILE__)).'/conf/__init_conf__.php';
|
||||
|
||||
$env = isset($_SERVER['PHABRICATOR_ENV'])
|
||||
? $_SERVER['PHABRICATOR_ENV']
|
||||
: getenv('PHABRICATOR_ENV');
|
||||
if (!$env) {
|
||||
echo "Define PHABRICATOR_ENV before running this script.\n";
|
||||
exit(1);
|
||||
}
|
||||
|
||||
$conf = phabricator_read_config_file($env);
|
||||
$conf['phabricator.env'] = $env;
|
||||
|
||||
phutil_require_module('phabricator', 'infrastructure/env');
|
||||
PhabricatorEnv::setEnvConfig($conf);
|
||||
|
||||
phutil_load_library('arcanist/src');
|
||||
|
||||
foreach (PhabricatorEnv::getEnvConfig('load-libraries') as $library) {
|
||||
phutil_load_library($library);
|
||||
}
|
||||
|
||||
PhutilErrorHandler::initialize();
|
||||
PhabricatorEventEngine::initialize();
|
||||
|
||||
$tz = PhabricatorEnv::getEnvConfig('phabricator.timezone');
|
||||
if ($tz) {
|
||||
date_default_timezone_set($tz);
|
||||
}
|
||||
|
|
|
@ -75,7 +75,6 @@ $package_spec = array(
|
|||
|
||||
|
||||
require_once dirname(__FILE__).'/__init_script__.php';
|
||||
require_once dirname(__FILE__).'/__init_env__.php';
|
||||
|
||||
if ($argc != 2) {
|
||||
$self = basename($argv[0]);
|
||||
|
|
|
@ -19,7 +19,6 @@
|
|||
|
||||
$root = dirname(dirname(dirname(__FILE__)));
|
||||
require_once $root.'/scripts/__init_script__.php';
|
||||
require_once $root.'/scripts/__init_env__.php';
|
||||
|
||||
phutil_require_module('phutil', 'console');
|
||||
phutil_require_module('phutil', 'parser/xhpast/bin');
|
||||
|
|
|
@ -19,7 +19,6 @@
|
|||
|
||||
$root = dirname(dirname(dirname(__FILE__)));
|
||||
require_once $root.'/scripts/__init_script__.php';
|
||||
require_once $root.'/scripts/__init_env__.php';
|
||||
|
||||
if ($argc !== 2) {
|
||||
echo phutil_console_format(
|
||||
|
|
|
@ -19,7 +19,6 @@
|
|||
|
||||
$root = dirname(dirname(dirname(__FILE__)));
|
||||
require_once $root.'/scripts/__init_script__.php';
|
||||
require_once $root.'/scripts/__init_env__.php';
|
||||
|
||||
phutil_require_module('phabricator', 'infrastructure/daemon/control');
|
||||
$control = new PhabricatorDaemonControl();
|
||||
|
|
|
@ -23,7 +23,6 @@ if ($argc > 1) {
|
|||
|
||||
$root = dirname(dirname(dirname(__FILE__)));
|
||||
require_once $root.'/scripts/__init_script__.php';
|
||||
require_once $root.'/scripts/__init_env__.php';
|
||||
require_once $root.'/externals/mimemailparser/MimeMailParser.class.php';
|
||||
|
||||
phutil_require_module(
|
||||
|
|
|
@ -19,7 +19,6 @@
|
|||
|
||||
$root = dirname(dirname(dirname(__FILE__)));
|
||||
require_once $root.'/scripts/__init_script__.php';
|
||||
require_once $root.'/scripts/__init_env__.php';
|
||||
|
||||
phutil_require_module('phutil', 'symbols');
|
||||
PhutilSymbolLoader::loadClass('PhabricatorRepository');
|
||||
|
|
|
@ -19,7 +19,6 @@
|
|||
|
||||
$root = dirname(dirname(dirname(__FILE__)));
|
||||
require_once $root.'/scripts/__init_script__.php';
|
||||
require_once $root.'/scripts/__init_env__.php';
|
||||
|
||||
phutil_require_module('phutil', 'console');
|
||||
|
||||
|
|
|
@ -19,7 +19,6 @@
|
|||
|
||||
$root = dirname(dirname(dirname(__FILE__)));
|
||||
require_once $root.'/scripts/__init_script__.php';
|
||||
require_once $root.'/scripts/__init_env__.php';
|
||||
|
||||
phutil_require_module('phutil', 'console');
|
||||
phutil_require_module('phutil', 'future/exec');
|
||||
|
|
|
@ -19,7 +19,6 @@
|
|||
|
||||
$root = dirname(dirname(dirname(__FILE__)));
|
||||
require_once $root.'/scripts/__init_script__.php';
|
||||
require_once $root.'/scripts/__init_env__.php';
|
||||
|
||||
if (empty($argv[1])) {
|
||||
echo "usage: index_one_commit.php <commit_name>\n";
|
||||
|
|
|
@ -19,7 +19,6 @@
|
|||
|
||||
$root = dirname(dirname(dirname(__FILE__)));
|
||||
require_once $root.'/scripts/__init_script__.php';
|
||||
require_once $root.'/scripts/__init_env__.php';
|
||||
|
||||
$users = id(new PhabricatorUser())->loadAll();
|
||||
echo "Indexing ".count($users)." users";
|
||||
|
|
|
@ -19,7 +19,6 @@
|
|||
|
||||
$root = dirname(dirname(dirname(__FILE__)));
|
||||
require_once $root.'/scripts/__init_script__.php';
|
||||
require_once $root.'/scripts/__init_env__.php';
|
||||
|
||||
// TODO: Get rid of this script eventually, once this stuff is better-formalized
|
||||
// in Timeline consumers.
|
||||
|
|
|
@ -19,7 +19,6 @@
|
|||
|
||||
$root = dirname(dirname(dirname(__FILE__)));
|
||||
require_once $root.'/scripts/__init_script__.php';
|
||||
require_once $root.'/scripts/__init_env__.php';
|
||||
|
||||
ini_set('memory_limit', -1);
|
||||
$tasks = id(new ManiphestTask())->loadAll();
|
||||
|
|
|
@ -19,7 +19,6 @@
|
|||
|
||||
$root = dirname(dirname(dirname(__FILE__)));
|
||||
require_once $root.'/scripts/__init_script__.php';
|
||||
require_once $root.'/scripts/__init_env__.php';
|
||||
|
||||
phutil_require_module('phutil', 'console');
|
||||
phutil_require_module('phabricator', 'infrastructure/setup/sql');
|
||||
|
|
|
@ -19,7 +19,6 @@
|
|||
|
||||
$root = dirname(dirname(dirname(__FILE__)));
|
||||
require_once $root.'/scripts/__init_script__.php';
|
||||
require_once $root.'/scripts/__init_env__.php';
|
||||
|
||||
phutil_require_module('phutil', 'console');
|
||||
phutil_require_module('phutil', 'future/exec');
|
||||
|
|
|
@ -30,9 +30,6 @@ abstract class PhabricatorDaemon extends PhutilDaemon {
|
|||
|
||||
$phabricator = phutil_get_library_root('phabricator');
|
||||
$root = dirname($phabricator);
|
||||
require_once $root.'/scripts/__init_env__.php';
|
||||
|
||||
// Daemons may perform writes.
|
||||
AphrontWriteGuard::allowDangerousUnguardedWrites(true);
|
||||
require_once $root.'/scripts/__init_script__.php';
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
|
||||
phutil_require_module('phabricator', 'aphront/console/plugin/errorlog/api');
|
||||
phutil_require_module('phabricator', 'aphront/console/plugin/event/api');
|
||||
phutil_require_module('phabricator', 'aphront/writeguard');
|
||||
|
||||
phutil_require_module('phutil', 'daemon/base');
|
||||
phutil_require_module('phutil', 'moduleutils');
|
||||
|
|
|
@ -44,7 +44,7 @@ abstract class PhabricatorTestCase extends ArcanistPhutilTestCase {
|
|||
|
||||
protected function willRunTests() {
|
||||
$root = dirname(phutil_get_library_root('phabricator'));
|
||||
require_once $root.'/scripts/__init_env__.php';
|
||||
require_once $root.'/scripts/__init_script__.php';
|
||||
|
||||
$config = $this->getComputedConfiguration();
|
||||
|
||||
|
|
Loading…
Reference in a new issue