| @@ -6,8 +6,9 @@ | ||
| 6 | 6 | |
| 7 | 7 | use const WPIDE\Constants\DIR; |
| 8 | 8 | use const WPIDE\Constants\SLUG; |
| 9 | 9 | use const WPIDE\Constants\TMP_DIR; |
| 10 | +use const WPIDE\Constants\WP_PATH; | |
| 10 | 11 | |
| 11 | 12 | return [ |
| 12 | 13 | 'WPIDE\App\Services\Logger\LoggerInterface' => [ |
| 13 | 14 | 'handler' => '\WPIDE\App\Services\Logger\Adapters\MonoLogger', |
| @@ -13,10 +14,22 @@ | ||
| 13 | 14 | 'handler' => '\WPIDE\App\Services\Logger\Adapters\MonoLogger', |
| 14 | 15 | 'config' => [ |
| 15 | 16 | 'monolog_handlers' => [ |
| 16 | 17 | function () { |
| 18 | + $logPath = ini_get('error_log'); | |
| 19 | + | |
| 20 | + if (! is_string($logPath) || $logPath === '' || is_dir($logPath)) { | |
| 21 | + $logPath = defined('WP_CONTENT_DIR') | |
| 22 | + ? WP_CONTENT_DIR . '/debug.log' | |
| 23 | + : TMP_DIR . '/wpide.log'; | |
| 24 | + } | |
| 25 | + | |
| 26 | + if (is_dir($logPath)) { | |
| 27 | + $logPath = TMP_DIR . '/wpide.log'; | |
| 28 | + } | |
| 29 | + | |
| 17 | 30 | return new \Monolog\Handler\StreamHandler( |
| 18 | - ini_get('error_log'), | |
| 31 | + $logPath, | |
| 19 | 32 | \Monolog\Logger::DEBUG |
| 20 | 33 | ); |
| 21 | 34 | }, |
| 22 | 35 | ], |
| @@ -48,20 +61,18 @@ | ||
| 48 | 61 | 'config' => [], |
| 49 | 62 | ], |
| 50 | 63 | 'WPIDE\App\Services\Storage\Filesystem' => [ |
| 51 | 64 | 'handler' => '\WPIDE\App\Services\Storage\Filesystem', |
| 52 | - 'config' => LocalFileSystem::getConfig( | |
| 53 | - null, | |
| 54 | - [ | |
| 55 | - 'dirs' => LocalFileSystem::excludedDirs(), | |
| 56 | - 'files' => LocalFileSystem::excludedFiles() | |
| 57 | - ] | |
| 58 | - ), | |
| 65 | + 'config' => LocalFileSystem::getConfig(), | |
| 59 | 66 | ], |
| 60 | 67 | 'WPIDE\App\Services\Database\Database' => [ |
| 61 | 68 | 'handler' => Freemius::sdk()->can_use_premium_code__premium_only() ? '\WPIDE\App\Services\Database\Database' : null, |
| 62 | 69 | 'config' => [], |
| 63 | 70 | ], |
| 71 | + 'WPIDE\App\Services\ConfigManager\ConfigManager' => [ | |
| 72 | + 'handler' => Freemius::sdk()->can_use_premium_code__premium_only() ? '\WPIDE\App\Services\ConfigManager\ConfigManager' : null, | |
| 73 | + 'config' => [], | |
| 74 | + ], | |
| 64 | 75 | 'WPIDE\App\Services\Cache\Cache' => [ |
| 65 | 76 | 'handler' => '\WPIDE\App\Services\Cache\Cache', |
| 66 | 77 | 'config' => [ |
| 67 | 78 | 'group' => SLUG |
| @@ -79,9 +90,9 @@ | ||
| 79 | 90 | ], |
| 80 | 91 | 'WPIDE\App\Services\Auth\AuthInterface' => [ |
| 81 | 92 | 'handler' => '\WPIDE\App\Services\Auth\Adapters\WPAuth', |
| 82 | 93 | 'config' => [ |
| 83 | - 'wp_dir' => ABSPATH, | |
| 94 | + 'wp_dir' => WP_PATH, | |
| 84 | 95 | 'permissions' => ['read', 'write', 'upload', 'download', 'batchdownload', 'zip'], |
| 85 | 96 | 'private_repos' => false, |
| 86 | 97 | ], |
| 87 | 98 | ], |