Skip to content

Commit

Permalink
补充provider对应的监控目录和安全目录
Browse files Browse the repository at this point in the history
  • Loading branch information
titrxw committed Apr 16, 2020
1 parent bbcfe33 commit eaf4a25
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions src/Processor/Provider/Processor.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,37 @@
use W7\PackagePlugin\Processor\ProcessorAbstract;

class Processor extends ProcessorAbstract {
protected $autoReloadPaths = [];
protected $openBaseDirs = [];

public function process() {
$vendorProviders = $this->findVendorProviders();
$appProviders = $this->findAppProviders();
$this->generateConfigFiles('provider.php', array_merge($vendorProviders, $appProviders));
$this->generateConfigFiles('reload.php', ['path' => $this->autoReloadPaths, 'type' => []]);
$appConfig = [
'setting' => [
'basedir' => $this->openBaseDirs
]
];
$this->generateConfigFiles('app.php', $appConfig);
}

private function findVendorProviders() {
$providers = [];
foreach ($this->installedFileData as $item) {
if (!empty($item['extra']['rangine']['providers'])) {
$providers[str_replace('/', '.', $item['name'])] = $item['extra']['rangine']['providers'];
//添加autoload path
if ($item[$item['installation-source']]['type'] == 'path') {
$path = $this->basePath . '/' . $item[$item['installation-source']]['url'];
} else {
$path = $this->basePath . '/vendor/' . $item['name'];
}
$path .= '/';
$this->autoReloadPaths[] = $path;
//添加安全目录
$this->openBaseDirs[] = $path;
}
}

Expand Down

0 comments on commit eaf4a25

Please sign in to comment.