/** * @return string * @throws \Exception */ public function createNewConfig() { $file_system = new \Amp\Util\Filesystem(); $new_config_file_path = Path::join($this->tmp_path, basename($this->app_armor_config_file_path)); $file_system->copy($this->app_armor_config_file_path, $new_config_file_path); $new_config_file = FileExt::open($new_config_file_path, 'a'); FileExt::write($new_config_file, "\n"); foreach ($this->getFormattedAppArmorLines() as $app_armor_line) { FileExt::write($new_config_file, $app_armor_line); } FileExt::close($new_config_file); return $new_config_file_path; }
public function configure() { $file_system = new \Amp\Util\Filesystem(); $new_config_file_path = Path::join($this->tmp_path, basename($this->app_armor_config_file_path)); $file_system->copy($this->app_armor_config_file_path, $new_config_file_path); $new_config_file = FileExt::open($new_config_file_path, 'a'); FileExt::write($new_config_file, "\n"); foreach ($this->getFormattedAppArmorLines() as $app_armor_line) { FileExt::write($new_config_file, $app_armor_line); } FileExt::close($new_config_file); $this->runCommand("sudo mv {$new_config_file_path} {$this->app_armor_config_file_path}"); $this->runCommand("sudo /etc/init.d/apparmor restart", array('throw_exception_on_nonzero' => FALSE)); }