Changeset View
Changeset View
Standalone View
Standalone View
support/PhabricatorStartup.php
| Show All 35 Lines | |||||
| * @task ratelimit Rate Limiting | * @task ratelimit Rate Limiting | ||||
| */ | */ | ||||
| final class PhabricatorStartup { | final class PhabricatorStartup { | ||||
| private static $startTime; | private static $startTime; | ||||
| private static $globals = array(); | private static $globals = array(); | ||||
| private static $capturingOutput; | private static $capturingOutput; | ||||
| private static $rawInput; | private static $rawInput; | ||||
| private static $oldMemoryLimit; | |||||
| // TODO: For now, disable rate limiting entirely by default. We need to | // TODO: For now, disable rate limiting entirely by default. We need to | ||||
| // iterate on it a bit for Conduit, some of the specific score levels, and | // iterate on it a bit for Conduit, some of the specific score levels, and | ||||
| // to deal with NAT'd offices. | // to deal with NAT'd offices. | ||||
| private static $maximumRate = 0; | private static $maximumRate = 0; | ||||
| /* -( Accessing Request Information )-------------------------------------- */ | /* -( Accessing Request Information )-------------------------------------- */ | ||||
| ▲ Show 20 Lines • Show All 253 Lines • ▼ Show 20 Lines | |||||
| /* -( Validation )--------------------------------------------------------- */ | /* -( Validation )--------------------------------------------------------- */ | ||||
| /** | /** | ||||
| * @task validation | * @task validation | ||||
| */ | */ | ||||
| private static function setupPHP() { | private static function setupPHP() { | ||||
| error_reporting(E_ALL | E_STRICT); | error_reporting(E_ALL | E_STRICT); | ||||
| self::$oldMemoryLimit = ini_get('memory_limit'); | |||||
| ini_set('memory_limit', -1); | ini_set('memory_limit', -1); | ||||
| // If we have libxml, disable the incredibly dangerous entity loader. | // If we have libxml, disable the incredibly dangerous entity loader. | ||||
| if (function_exists('libxml_disable_entity_loader')) { | if (function_exists('libxml_disable_entity_loader')) { | ||||
| libxml_disable_entity_loader(true); | libxml_disable_entity_loader(true); | ||||
| } | } | ||||
| } | } | ||||
| /** | |||||
| * @task validation | |||||
| */ | |||||
| public static function getOldMemoryLimit() { | |||||
| return self::$oldMemoryLimit; | |||||
| } | |||||
| /** | /** | ||||
| * @task validation | * @task validation | ||||
| */ | */ | ||||
| private static function normalizeInput() { | private static function normalizeInput() { | ||||
| // Replace superglobals with unfiltered versions, disrespect php.ini (we | // Replace superglobals with unfiltered versions, disrespect php.ini (we | ||||
| // filter ourselves) | // filter ourselves) | ||||
| $filter = array(INPUT_GET, INPUT_POST, | $filter = array(INPUT_GET, INPUT_POST, | ||||
| INPUT_SERVER, INPUT_ENV, INPUT_COOKIE); | INPUT_SERVER, INPUT_ENV, INPUT_COOKIE); | ||||
| ▲ Show 20 Lines • Show All 452 Lines • Show Last 20 Lines | |||||