Skip to content

Commit

Permalink
fix: correct api sync/restore bug
Browse files Browse the repository at this point in the history
fixes issue that prevented a persistent backup from being
captured for ha peers
  • Loading branch information
jaredhendrickson13 committed Oct 17, 2022
1 parent 307607d commit 4dc178b
Showing 1 changed file with 12 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ require_once("api/framework/APIResponse.inc");


class APISystemAPISyncUpdate extends APIModel {
public $pkg_index;
public $pkg_conf;
# Create our method constructor
public function __construct() {
parent::__construct();
Expand All @@ -27,12 +29,14 @@ class APISystemAPISyncUpdate extends APIModel {
$this->retain_read_mode = false;
$this->ignore_enabled = true;
$this->ignore_ifs = true;
$this->pkg_index = APITools\get_api_config()[0];
$this->pkg_conf = APITools\get_api_config()[1];
}

public function action() {
$pkg_index = APITools\get_api_config()[0];
$this->config["installedpackages"]["package"][$pkg_index]["conf"] = $this->validated_data;
$this->config["installedpackages"]["package"][$this->pkg_index]["conf"] = $this->validated_data;
$this->write_config();
$this->backup();
return APIResponse\get(0, $this->validated_data);
}

Expand All @@ -53,4 +57,10 @@ class APISystemAPISyncUpdate extends APIModel {
$this->errors[] = APIResponse\get(1);
}
}

public function backup() {
if (isset($this->pkg_conf["persist"])) {
shell_exec("/usr/local/share/pfSense-pkg-API/manage.php backup");
}
}
}

0 comments on commit 4dc178b

Please sign in to comment.