PluginProbe
Packeta / 2.0.9
Packeta v2.0.9
2.3.2 2.3.1 trunk 1.2.2 1.2.3 1.2.4 1.2.5 1.2.6 1.3.0 1.3.1 1.3.2 1.4 1.4.1 1.4.2 1.4.3 1.5.0 1.5.1 1.5.2 1.5.3 1.5.4 1.6.0 1.6.1 1.6.2 1.6.3 1.6.4 All 56 releases
← All changes | bootstrap.php +35 -6 1.2.62.0.9 View file →
@@ -5,23 +5,48 @@
5 5 * @package Packeta
6 6 */
7 7
8 8 use Packetery\Module\CompatibilityBridge;
9 -use PacketeryNette\Bootstrap\Configurator;
9 +use Packetery\Module\WpdbTracyPanel;
10 +use Packetery\Nette\Bootstrap\Configurator;
11 +use Packetery\Nette\Http\RequestFactory;
12 +use Packetery\Nette\InvalidStateException;
13 +use Packetery\Tracy\Debugger;
10 14
11 -defined( 'PACKETERY_PLUGIN_DIR' ) || define( 'PACKETERY_PLUGIN_DIR', __DIR__ );
12 -defined( 'PACKETERY_DEBUG' ) || define( 'PACKETERY_DEBUG', false );
15 +require_once __DIR__ . '/constants.php';
13 16
14 -require_once __DIR__ . '/packetery_vendor/autoload.php';
17 +require_once __DIR__ . '/deps/scoper-autoload.php';
15 18
19 +$disableGetPostCookieParsing = false;
20 +if ( PHP_SAPI !== 'cli' ) {
21 + try {
22 + ( new RequestFactory() )->fromGlobals();
23 + } catch ( InvalidStateException $invalidStateException ) {
24 + $disableGetPostCookieParsing = true;
25 + }
26 +}
27 +
16 28 $configurator = new Configurator();
29 +$configurator->addDynamicParameters(
30 + [
31 + 'disableGetPostCookieParsing' => $disableGetPostCookieParsing,
32 + ]
33 +);
17 34 $configurator->setDebugMode( PACKETERY_DEBUG );
18 35
19 -if ( PACKETERY_DEBUG ) {
20 - $configurator->enableDebugger( PACKETERY_PLUGIN_DIR . '/log' );
36 +Debugger::$logDirectory = PACKETERY_PLUGIN_DIR . '/log';
37 +if ( $configurator->isDebugMode() && wp_doing_cron() === false ) {
38 + $configurator->enableDebugger( Debugger::$logDirectory );
39 + Debugger::$strictMode = false;
21 40 }
22 41
23 42 $configurator->addConfig( __DIR__ . '/config/config.neon' );
43 +
44 +$localConfigFile = __DIR__ . '/config/config.local.neon';
45 +if ( file_exists( $localConfigFile ) ) {
46 + $configurator->addConfig( $localConfigFile ); // Local Development ENV only!
47 +}
48 +
24 49 $configurator->setTempDirectory( __DIR__ . '/temp' );
25 50 $configurator->createRobotLoader()->addDirectory( __DIR__ . '/src' )->setAutoRefresh( false )->register();
26 51
27 52 $configurator->defaultExtensions = [];
@@ -27,6 +52,10 @@
27 52 $configurator->defaultExtensions = [];
28 53
29 54 $container = $configurator->createContainer();
30 55 CompatibilityBridge::setContainer( $container );
56 +
57 +if ( Debugger::isEnabled() ) {
58 + Debugger::getBar()->addPanel( $container->getByType( WpdbTracyPanel::class ) );
59 +}
31 60
32 61 return $container;