eee
This commit is contained in:
+7
-5
@@ -255,12 +255,14 @@ class Router
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($appChangedFiles)) {
|
if (!empty($appChangedFiles) && (bool)($scanConfig['expand_dependencies'] ?? false)) {
|
||||||
$appChangedFiles = $scanner->expandDependentFiles($appChangedFiles, APP_PATH . 'app/');
|
$appChangedFiles = $scanner->expandDependentFiles($appChangedFiles, APP_PATH . 'app/');
|
||||||
}
|
}
|
||||||
|
|
||||||
$usedArtifact = false;
|
$usedArtifact = false;
|
||||||
if (($scanConfig['cache_enabled'] ?? false) && $artifactState->has(static::$type)) {
|
$canUseArtifact = $artifactState->has(static::$type)
|
||||||
|
&& (!empty($changedFiles) || ($scanConfig['cache_enabled'] ?? false));
|
||||||
|
if ($canUseArtifact) {
|
||||||
$artifact = $artifactState->load(static::$type);
|
$artifact = $artifactState->load(static::$type);
|
||||||
$router = $container->get(DataGrip::class)->get(static::$type);
|
$router = $container->get(DataGrip::class)->get(static::$type);
|
||||||
$usedArtifact = $router->importArtifact($artifact, $appChangedFiles);
|
$usedArtifact = $router->importArtifact($artifact, $appChangedFiles);
|
||||||
@@ -270,12 +272,12 @@ class Router
|
|||||||
// route artifact 只加速注解路由,不能替代 routes/*.php 的注册副作用。
|
// route artifact 只加速注解路由,不能替代 routes/*.php 的注册副作用。
|
||||||
$this->read_dir_file(APP_PATH . 'routes');
|
$this->read_dir_file(APP_PATH . 'routes');
|
||||||
|
|
||||||
if (!empty($appChangedFiles) && ($scanConfig['cache_enabled'] ?? false)) {
|
if (!empty($appChangedFiles) && (($scanConfig['cache_enabled'] ?? false) || $usedArtifact)) {
|
||||||
$scanner->scanFiles($appChangedFiles, APP_PATH . 'app/', null, true);
|
$scanner->scanFiles($appChangedFiles, APP_PATH . 'app/', null, true, !$usedArtifact);
|
||||||
} elseif (!$usedArtifact) {
|
} elseif (!$usedArtifact) {
|
||||||
$scanner->scan(APP_PATH . 'app/');
|
$scanner->scan(APP_PATH . 'app/');
|
||||||
} else {
|
} else {
|
||||||
$scanner->scanFiles([], APP_PATH . 'app/', null, false);
|
$scanner->scanFiles([], APP_PATH . 'app/', null, false, false);
|
||||||
}
|
}
|
||||||
$this->reset($container);
|
$this->reset($container);
|
||||||
$artifactState->store(static::$type, $container->get(DataGrip::class)->get(static::$type)->exportArtifact());
|
$artifactState->store(static::$type, $container->get(DataGrip::class)->get(static::$type)->exportArtifact());
|
||||||
|
|||||||
Reference in New Issue
Block a user