diff options
author | Phil Davis <phil.davis@inf.org> | 2015-08-06 14:35:48 +0545 |
---|---|---|
committer | Phil Davis <phil.davis@inf.org> | 2015-08-06 14:35:48 +0545 |
commit | 05074a272afe59851788c3dd7c7a925fbfbc75ed (patch) | |
tree | 0ddb15c1e0794abd14093156262ad53a4acf87b2 /config/systempatches/patches.inc | |
parent | bad0f316bf513e8a7b61646ceb2e1ddb3bf2b03d (diff) | |
download | pfsense-packages-05074a272afe59851788c3dd7c7a925fbfbc75ed.tar.gz pfsense-packages-05074a272afe59851788c3dd7c7a925fbfbc75ed.tar.bz2 pfsense-packages-05074a272afe59851788c3dd7c7a925fbfbc75ed.zip |
Systen Patches package code style
Diffstat (limited to 'config/systempatches/patches.inc')
-rw-r--r-- | config/systempatches/patches.inc | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/config/systempatches/patches.inc b/config/systempatches/patches.inc index 60c9a391..f47324c4 100644 --- a/config/systempatches/patches.inc +++ b/config/systempatches/patches.inc @@ -55,10 +55,11 @@ function patch_commit($patch, $action, $test=false, $fulldetail=false) { $full_patch_command = "{$patch_cmd} --directory={$directory} {$force} {$pathstrip} {$filename} {$check} {$direction} {$whitespace}"; conf_mount_rw(); patch_write($patch); - if (!$fulldetail) + if (!$fulldetail) { $output = (mwexec($full_patch_command, true) == 0); - else + } else { $output = $full_patch_command . "\n\n" . shell_exec($full_patch_command . ' 2>&1'); + } patch_erase($patch); conf_mount_ro(); return $output; @@ -158,8 +159,9 @@ function bootup_apply_patches() { foreach ($a_patches as $patch) { /* Skip the patch if it should not be automatically applied. */ - if (!isset($patch['autoapply'])) + if (!isset($patch['autoapply'])) { continue; + } /* If the patch can be reverted it is already applied, so skip it. */ if (!patch_test_revert($patch)) { /* Only attempt to apply if it can be applied. */ @@ -173,12 +175,15 @@ function bootup_apply_patches() { function patch_add_shellcmd() { global $config; $a_earlyshellcmd = &$config['system']['earlyshellcmd']; - if (!is_array($a_earlyshellcmd)) + if (!is_array($a_earlyshellcmd)) { $a_earlyshellcmd = array(); + } $found = false; - foreach ($a_earlyshellcmd as $idx => $cmd) - if (stristr($cmd, "apply_patches.php")) + foreach ($a_earlyshellcmd as $idx => $cmd) { + if (stristr($cmd, "apply_patches.php")) { $found = true; + } + } if (!$found) { $a_earlyshellcmd[] = "/usr/local/bin/php -f /usr/local/bin/apply_patches.php"; write_config("System Patches package added a shellcmd"); @@ -188,8 +193,9 @@ function patch_add_shellcmd() { function patch_remove_shellcmd() { global $config; $a_earlyshellcmd = &$config['system']['earlyshellcmd']; - if (!is_array($a_earlyshellcmd)) + if (!is_array($a_earlyshellcmd)) { $a_earlyshellcmd = array(); + } $removed = false; foreach ($a_earlyshellcmd as $idx => $cmd) { if (stristr($cmd, "apply_patches.php")) { @@ -197,8 +203,9 @@ function patch_remove_shellcmd() { $removed = true; } } - if ($removed) + if ($removed) { write_config("System Patches package removed a shellcmd"); + } } ?> |