1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-22 14:52:41 +01:00
phorge-phorge/scripts/fpm/warmup.php
vrana ef85f49adc Delete license headers from files
Summary:
This commit doesn't change license of any file. It just makes the license implicit (inherited from LICENSE file in the root directory).

We are removing the headers for these reasons:

- It wastes space in editors, less code is visible in editor upon opening a file.
- It brings noise to diff of the first change of any file every year.
- It confuses Git file copy detection when creating small files.
- We don't have an explicit license header in other files (JS, CSS, images, documentation).
- Using license header in every file is not obligatory: http://www.apache.org/dev/apply-license.html#new.

This change is approved by Alma Chao (Lead Open Source and IP Counsel at Facebook).

Test Plan: Verified that the license survived only in LICENSE file and that it didn't modify externals.

Reviewers: epriestley, davidrecordon

Reviewed By: epriestley

CC: aran, Korvin

Maniphest Tasks: T2035

Differential Revision: https://secure.phabricator.com/D3886
2012-11-05 11:16:51 -08:00

38 lines
1.5 KiB
PHP

<?php
/**
* NOTE: This is an ADVANCED feature that improves performance but adds a lot
* of complexity! This is only suitable for production servers because workers
* won't pick up changes between when they spawn and when they handle a request.
*
* Phabricator spends a significant portion of its runtime loading classes
* and functions, even with APC enabled. Since we have very rigidly-defined
* rules about what can go in a module (specifically: no side effects), it
* is safe to load all the libraries *before* we receive a request.
*
* Normally, SAPIs don't provide a way to do this, but with a patched PHP-FPM
* SAPI you can provide a warmup file that it will execute before a request
* is received.
*
* We're limited in what we can do here, since request information won't
* exist yet, but we can load class and function definitions, which is what
* we're really interested in.
*
* Once this file exists, the FCGI process will drop into its normal accept loop
* and eventually process a request.
*/
function __warmup__() {
$root = dirname(dirname(dirname(dirname(__FILE__))));
require_once $root.'/libphutil/src/__phutil_library_init__.php';
require_once $root.'/arcanist/src/__phutil_library_init__.php';
require_once $root.'/phabricator/src/__phutil_library_init__.php';
// Load every symbol. We could possibly refine this -- we don't need to load
// every Controller, for instance.
$loader = new PhutilSymbolLoader();
$loader->selectAndLoadSymbols();
define('__WARMUP__', true);
}
__warmup__();