Skip to content

Commit 60ef628

Browse files
fix: clear model object cache after package install
1 parent 5b423f0 commit 60ef628

File tree

1 file changed

+5
-2
lines changed
  • pfSense-pkg-RESTAPI/files/usr/local/pkg/RESTAPI/Models

1 file changed

+5
-2
lines changed

pfSense-pkg-RESTAPI/files/usr/local/pkg/RESTAPI/Models/Package.inc

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,10 +85,13 @@ class Package extends Model {
8585
/**
8686
* Installs the package assigned to the `name` field.
8787
*/
88-
public function _create() {
88+
public function _create(): void {
8989
# Install the package
9090
pkg_install($this->name->value);
9191

92+
# Clear the object cache to ensure we get fresh data
93+
$this->clear_object_cache();
94+
9295
# Locate this package's current ID and load info about the package installed
9396
$this->id = $this->query(name: $this->name->value)->first()->id;
9497
$this->from_internal();
@@ -97,7 +100,7 @@ class Package extends Model {
97100
/**
98101
* Deletes the package assigned to the `name` field.
99102
*/
100-
public function _delete() {
103+
public function _delete(): void {
101104
pkg_delete($this->name->value);
102105
}
103106
}

0 commit comments

Comments
 (0)