Fixed bug that watcher does not work for v2.2. (#3845)

This commit is contained in:
李铭昕 2021-07-20 21:49:49 +08:00 committed by GitHub
parent 410e3dabda
commit 6300efaf81
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 10 deletions

View File

@ -3,6 +3,7 @@
## Fixed
- [#3828](https://github.com/hyperf/hyperf/pull/3828) Fixed bug that lazy inject does not work for `Hyperf\Redis\Redis` in `PHP8.0`.
- [#3845](https://github.com/hyperf/hyperf/pull/3845) Fixed bug that `watcher` does not work for `v2.2`.
# v2.2.0 - 2021-07-19

View File

@ -54,7 +54,7 @@ class Process
/**
* @var string
*/
protected $path = BASE_PATH . '/runtime/container/collectors.cache';
protected $path = BASE_PATH . '/runtime/container/scan.cache';
public function __construct(string $file)
{
@ -73,7 +73,7 @@ class Process
}
$class = $meta->toClassName();
$collectors = $this->config->getCollectors();
$data = unserialize(file_get_contents($this->path));
[$data] = unserialize(file_get_contents($this->path));
foreach ($data as $collector => $deserialized) {
/** @var MetadataCollector $collector */
if (in_array($collector, $collectors)) {
@ -99,16 +99,10 @@ class Process
$data[$collector] = $collector::serialize();
}
if ($data) {
$this->putCache($this->path, serialize($data));
}
// Reload the proxy class.
$manager = new ProxyManager([$class => $this->file], BASE_PATH . '/runtime/container/proxy/');
$ref = new ReflectionClass($manager);
$method = $ref->getMethod('generateProxyFiles');
$method->setAccessible(true);
$method->invokeArgs($manager, [$class => []]);
$proxies = $manager->getProxies();
$this->putCache($this->path, serialize([$data, $proxies]));
}
public function collect($className, ReflectionClass $reflection)