| @@ -5,19 +5,16 @@ | ||
| 5 | 5 | * @package Packeta |
| 6 | 6 | */ |
| 7 | 7 | |
| 8 | 8 | use Packetery\Module\CompatibilityBridge; |
| 9 | -use Packetery\Module\ModuleHelper; | |
| 10 | -use Packetery\Module\Options\OptionNames; | |
| 11 | -use Packetery\Module\Plugin; | |
| 12 | 9 | use Packetery\Module\WpdbTracyPanel; |
| 13 | 10 | use Packetery\Nette\Bootstrap\Configurator; |
| 14 | 11 | use Packetery\Nette\Http\RequestFactory; |
| 15 | 12 | use Packetery\Nette\InvalidStateException; |
| 16 | -use Packetery\Nette\Utils\FileSystem; | |
| 17 | 13 | use Packetery\Tracy\Debugger; |
| 18 | 14 | |
| 19 | 15 | require_once __DIR__ . '/constants.php'; |
| 16 | + | |
| 20 | 17 | require_once __DIR__ . '/deps/scoper-autoload.php'; |
| 21 | 18 | |
| 22 | 19 | $disableGetPostCookieParsing = false; |
| 23 | 20 | if ( PHP_SAPI !== 'cli' ) { |
| @@ -27,51 +24,17 @@ | ||
| 27 | 24 | $disableGetPostCookieParsing = true; |
| 28 | 25 | } |
| 29 | 26 | } |
| 30 | 27 | |
| 31 | -$cacheBasePathConstantName = 'PACKETERY_CACHE_BASE_PATH'; | |
| 32 | - | |
| 33 | -if ( defined( $cacheBasePathConstantName ) ) { | |
| 34 | - $tempDir = constant( $cacheBasePathConstantName ); | |
| 35 | - Filesystem::createDir( $tempDir, 0775 ); | |
| 36 | - $logBaseDir = $tempDir; | |
| 37 | -} else { | |
| 38 | - $tempDir = __DIR__ . '/temp'; | |
| 39 | - $logBaseDir = PACKETERY_PLUGIN_DIR; | |
| 40 | -} | |
| 41 | - | |
| 42 | 28 | $configurator = new Configurator(); |
| 43 | - | |
| 44 | -$configurator->defaultExtensions = []; | |
| 45 | -$configurator->setDebugMode( PACKETERY_DEBUG ); | |
| 46 | -$configurator->setTempDirectory( $tempDir ); | |
| 47 | -$configurator->createRobotLoader() | |
| 48 | - ->addDirectory( __DIR__ . '/src' ) | |
| 49 | - ->setAutoRefresh( false ) | |
| 50 | - ->register(); | |
| 51 | - | |
| 52 | -$cacheDir = $tempDir . '/cache'; | |
| 53 | -Filesystem::createDir( $cacheDir, 0775 ); | |
| 54 | - | |
| 55 | -$oldVersion = get_option( OptionNames::VERSION ); | |
| 56 | -if ( $oldVersion !== Plugin::VERSION ) { | |
| 57 | - ModuleHelper::instantDelete( $cacheDir ); | |
| 58 | -} | |
| 59 | - | |
| 60 | -$configurator->addStaticParameters( | |
| 61 | - [ | |
| 62 | - 'cacheDir' => $cacheDir, | |
| 63 | - ] | |
| 64 | -); | |
| 65 | 29 | $configurator->addDynamicParameters( |
| 66 | 30 | [ |
| 67 | 31 | 'disableGetPostCookieParsing' => $disableGetPostCookieParsing, |
| 68 | 32 | ] |
| 69 | 33 | ); |
| 34 | +$configurator->setDebugMode( PACKETERY_DEBUG ); | |
| 70 | 35 | |
| 71 | -Debugger::$logDirectory = $logBaseDir . '/log'; | |
| 72 | -Filesystem::createDir( Debugger::$logDirectory, 0775 ); | |
| 73 | - | |
| 36 | +Debugger::$logDirectory = PACKETERY_PLUGIN_DIR . '/log'; | |
| 74 | 37 | if ( $configurator->isDebugMode() && wp_doing_cron() === false ) { |
| 75 | 38 | $configurator->enableDebugger( Debugger::$logDirectory ); |
| 76 | 39 | Debugger::$strictMode = false; |
| 77 | 40 | } |
| @@ -82,17 +45,12 @@ | ||
| 82 | 45 | if ( file_exists( $localConfigFile ) ) { |
| 83 | 46 | $configurator->addConfig( $localConfigFile ); // Local Development ENV only! |
| 84 | 47 | } |
| 85 | 48 | |
| 86 | -$wpContentConfigDir = WP_CONTENT_DIR . '/packeta/config/'; | |
| 87 | -if ( is_dir( $wpContentConfigDir ) ) { | |
| 88 | - $configFiles = glob( $wpContentConfigDir . '*.neon' ); | |
| 89 | - if ( $configFiles !== false ) { | |
| 90 | - foreach ( $configFiles as $configFile ) { | |
| 91 | - $configurator->addConfig( $configFile ); | |
| 92 | - } | |
| 93 | - } | |
| 94 | -} | |
| 49 | +$configurator->setTempDirectory( __DIR__ . '/temp' ); | |
| 50 | +$configurator->createRobotLoader()->addDirectory( __DIR__ . '/src' )->setAutoRefresh( false )->register(); | |
| 51 | + | |
| 52 | +$configurator->defaultExtensions = []; | |
| 95 | 53 | |
| 96 | 54 | $container = $configurator->createContainer(); |
| 97 | 55 | CompatibilityBridge::setContainer( $container ); |
| 98 | 56 | |