This repository has been archived by the owner on Jan 24, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor auto start code into \Tideways\Profiler::autoStart(); Cleanu…
…p script. Remove usage of layer mode.
- Loading branch information
Showing
2 changed files
with
46 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,3 @@ | ||
<?php | ||
|
||
/** Check for auto starting the Profiler in Web and CLI (via Env Variable) */ | ||
if (ini_get("tideways.auto_start") || isset($_SERVER["TIDEWAYS_AUTO_START"])) { | ||
if (\Tideways\Profiler::isStarted() === false) { | ||
if (php_sapi_name() !== "cli") { | ||
/** | ||
* In Web context we auto start with the framework transaction name | ||
* configured in INI or ENV variable. | ||
*/ | ||
if (ini_get("tideways.framework")) { | ||
\Tideways\Profiler::detectFramework(ini_get("tideways.framework")); | ||
} else if (isset($_SERVER['TIDEWAYS_FRAMEWORK'])) { | ||
\Tideways\Profiler::detectFramework($_SERVER["TIDEWAYS_FRAMEWORK"]); | ||
} | ||
\Tideways\Profiler::start(); | ||
} else if (php_sapi_name() === "cli" && !empty($_SERVER["TIDEWAYS_SESSION"]) && isset($_SERVER['argv'])) { | ||
\Tideways\Profiler::start(); | ||
\Tideways\Profiler::setTransactionName("cli:" . basename($_SERVER['argv'][0])); | ||
} | ||
} | ||
} | ||
// auto-starts the profiler if that is configured | ||
\Tideways\Profiler::autoStart(); |