| @@ -1,12 +1,14 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | defined( 'ABSPATH' ) || exit; |
| 3 | 3 | |
| 4 | 4 | use WPIDE\App\Services\Storage\LocalFileSystem; |
| 5 | +use WPIDE\App\Classes\Freemius; | |
| 5 | 6 | |
| 6 | 7 | use const WPIDE\Constants\DIR; |
| 7 | 8 | use const WPIDE\Constants\SLUG; |
| 8 | 9 | use const WPIDE\Constants\TMP_DIR; |
| 10 | +use const WPIDE\Constants\WP_PATH; | |
| 9 | 11 | |
| 10 | 12 | return [ |
| 11 | 13 | 'WPIDE\App\Services\Logger\LoggerInterface' => [ |
| 12 | 14 | 'handler' => '\WPIDE\App\Services\Logger\Adapters\MonoLogger', |
| @@ -12,10 +14,22 @@ | ||
| 12 | 14 | 'handler' => '\WPIDE\App\Services\Logger\Adapters\MonoLogger', |
| 13 | 15 | 'config' => [ |
| 14 | 16 | 'monolog_handlers' => [ |
| 15 | 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 | + | |
| 16 | 30 | return new \Monolog\Handler\StreamHandler( |
| 17 | - ini_get('error_log'), | |
| 31 | + $logPath, | |
| 18 | 32 | \Monolog\Logger::DEBUG |
| 19 | 33 | ); |
| 20 | 34 | }, |
| 21 | 35 | ], |
| @@ -47,49 +61,18 @@ | ||
| 47 | 61 | 'config' => [], |
| 48 | 62 | ], |
| 49 | 63 | 'WPIDE\App\Services\Storage\Filesystem' => [ |
| 50 | 64 | 'handler' => '\WPIDE\App\Services\Storage\Filesystem', |
| 51 | - 'config' => LocalFileSystem::getConfig( | |
| 52 | - null, | |
| 53 | - [ | |
| 54 | - 'dirs' => LocalFileSystem::excludedDirs(), | |
| 55 | - 'files' => LocalFileSystem::excludedFiles() | |
| 56 | - ] | |
| 57 | - ), | |
| 65 | + 'config' => LocalFileSystem::getConfig(), | |
| 58 | 66 | ], |
| 59 | -// 'WPIDE\App\Services\Storage\Filesystem' => [ | |
| 60 | -// 'handler' => '\WPIDE\App\Services\Storage\Filesystem', | |
| 61 | -// 'config' => [ | |
| 62 | -// 'separator' => '/', | |
| 63 | -// 'config' => [], | |
| 64 | -// 'adapter' => function () { | |
| 65 | -// $client = new \Aws\S3\S3Client([ | |
| 66 | -// 'credentials' => [ | |
| 67 | -// 'key' => AWS_ACCESS_KEY, | |
| 68 | -// 'secret' => AWS_SECRET_KEY | |
| 69 | -// ], | |
| 70 | -// 'region' => 'us-east-1', | |
| 71 | -// 'version' => 'latest', | |
| 72 | -// ]); | |
| 73 | -// | |
| 74 | -// return new \League\Flysystem\AwsS3v3\AwsS3Adapter($client, 'bervana'); | |
| 75 | -// }, | |
| 76 | -// ], | |
| 77 | -// ], | |
| 78 | 67 | 'WPIDE\App\Services\Database\Database' => [ |
| 79 | - 'handler' => '\WPIDE\App\Services\Database\Database', | |
| 68 | + 'handler' => Freemius::sdk()->can_use_premium_code__premium_only() ? '\WPIDE\App\Services\Database\Database' : null, | |
| 80 | 69 | 'config' => [], |
| 81 | 70 | ], |
| 82 | -// 'WPIDE\App\Services\Database\DatabaseApi' => [ | |
| 83 | -// 'handler' => '\WPIDE\App\Services\Database\DatabaseApi', | |
| 84 | -// 'config' => [ | |
| 85 | -// 'username' => DB_USER, | |
| 86 | -// 'password' => DB_PASSWORD, | |
| 87 | -// 'database' => DB_NAME, | |
| 88 | -// 'address' => DB_HOST | |
| 89 | -// ] | |
| 90 | -// ], | |
| 91 | - | |
| 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 | + ], | |
| 92 | 75 | 'WPIDE\App\Services\Cache\Cache' => [ |
| 93 | 76 | 'handler' => '\WPIDE\App\Services\Cache\Cache', |
| 94 | 77 | 'config' => [ |
| 95 | 78 | 'group' => SLUG |
| @@ -107,9 +90,9 @@ | ||
| 107 | 90 | ], |
| 108 | 91 | 'WPIDE\App\Services\Auth\AuthInterface' => [ |
| 109 | 92 | 'handler' => '\WPIDE\App\Services\Auth\Adapters\WPAuth', |
| 110 | 93 | 'config' => [ |
| 111 | - 'wp_dir' => ABSPATH, | |
| 94 | + 'wp_dir' => WP_PATH, | |
| 112 | 95 | 'permissions' => ['read', 'write', 'upload', 'download', 'batchdownload', 'zip'], |
| 113 | 96 | 'private_repos' => false, |
| 114 | 97 | ], |
| 115 | 98 | ], |