From b3c4b3badcd3eb35a0ec0c469842a70905db881d Mon Sep 17 00:00:00 2001 From: Phil Davis Date: Thu, 6 Aug 2015 12:00:26 +0545 Subject: Cron package code style --- config/cron/cron.inc | 31 ++--- config/cron/cron.php | 240 ++++++++++++++++---------------- config/cron/cron.xml | 74 +++++----- config/cron/cron_edit.php | 339 +++++++++++++++++++++++----------------------- pkg_config.10.xml | 2 +- 5 files changed, 338 insertions(+), 348 deletions(-) diff --git a/config/cron/cron.inc b/config/cron/cron.inc index a457f013..0c7c6769 100644 --- a/config/cron/cron.inc +++ b/config/cron/cron.inc @@ -3,10 +3,10 @@ /* /* ========================================================================== */ /* - cron.inc - Copyright (C) 2008 Mark J Crane - All rights reserved. - */ + cron.inc + Copyright (C) 2008 Mark J Crane + All rights reserved. + */ /* ========================================================================== */ /* Redistribution and use in source and binary forms, with or without @@ -33,35 +33,31 @@ require_once("services.inc"); -function cron_pkg_is_service_running($servicename) -{ +function cron_pkg_is_service_running($servicename) { exec("/bin/ps ax | awk '{ print $5 }'", $psout); array_shift($psout); - foreach($psout as $line) { + foreach ($psout as $line) { $ps[] = trim(array_pop(explode(' ', array_pop(explode('/', $line))))); } - if(is_service_running($servicename, $ps) or is_process_running($servicename) ) { + if (is_service_running($servicename, $ps) or is_process_running($servicename)) { return true; - } - else { + } else { return false; } } -function cron_sync_package() -{ +function cron_sync_package() { - global $config; + global $config; //synch cron tab configure_cron(); exec("/usr/local/etc/rc.d/cron.sh stop"); exec("/usr/local/etc/rc.d/cron.sh start"); } - -function cron_install_command() -{ + +function cron_install_command() { global $config; conf_mount_rw(); @@ -88,8 +84,7 @@ function cron_install_command() } -function cron_deinstall_command() -{ +function cron_deinstall_command() { conf_mount_rw(); exec("/usr/local/etc/rc.d/cron.sh stop"); unlink_if_exists("/usr/local/etc/rc.d/cron.sh"); diff --git a/config/cron/cron.php b/config/cron/cron.php index b9666e01..d7ed1494 100644 --- a/config/cron/cron.php +++ b/config/cron/cron.php @@ -30,21 +30,21 @@ require_once("guiconfig.inc"); require_once("/usr/local/pkg/cron.inc"); -$a_cron = &$config['cron']['item']; +$a_cron = &$config['cron']['item']; if ($_GET['act'] == "del") { - if ($_GET['type'] == 'php') { - if ($a_cron[$_GET['id']]) { - unset($a_cron[$_GET['id']]); - write_config(); - header("Location: cron.php"); - exit; - } - } + if ($_GET['type'] == 'php') { + if ($a_cron[$_GET['id']]) { + unset($a_cron[$_GET['id']]); + write_config(); + header("Location: cron.php"); + exit; + } + } } -$pgtitle = array(gettext("Cron"),gettext("Settings")); +$pgtitle = array(gettext("Cron"), gettext("Settings")); include("head.inc"); ?> @@ -56,134 +56,133 @@ include("head.inc");
- - + - - - - - - - - - - - - - - - - - - - - - -
+
-"; //print_info_box_np("This is an info box."); //echo"
"; -//endif; +//endif; ?> - - - - -

- Cron controls the scheduling of commands. -

- For more information see: http://www.freebsd.org/doc/en/books/handbook/configtuning-cron.html -

-
- - - - - - - - - - - - +
minutehourmdaymonthwdaywhocommand - - - - - - -
edit
- -
+ + + +
+

+ Cron controls the scheduling of commands. +

+ For more information see: http://www.freebsd.org/doc/en/books/handbook/configtuning-cron.html +

+
+
+ + + + + + + + + + + + + + + 0) { + foreach ($a_cron as $ent) { + + ?> + + + + + + + + + + + + + + + + + + + + + + + +
minutehourmdaymonthwdaywhocommand + + + + + +
edit
+
+   + +   + +   + +   + +   + +   + +   + + + + + + +
editdelete
+
+ + + + + +
add
+
- - 0) { - - foreach ($a_cron as $ent) { - - ?> - -
-   - -   - -   - -   - -   - -   - -   - - - - - - -
editdelete
-
- - - - - -
add
-
- @@ -196,13 +195,12 @@ if ($config_change == 1) {

- - + + - diff --git a/config/cron/cron.xml b/config/cron/cron.xml index ba70e5e5..5a2b770b 100644 --- a/config/cron/cron.xml +++ b/config/cron/cron.xml @@ -2,44 +2,44 @@ - - + - - Cron - Describe your package requirements here - Currently there are no FAQ items provided. + ]]> + + Cron + Describe your package requirements here + Currently there are no FAQ items provided. Cron Settings 0.2.2 Settings @@ -62,32 +62,32 @@ Settings /packages/cron.php - + installedpackages->package->$packagename->configuration->cron /usr/local/pkg/ - 0755 + 0755 https://packages.pfsense.org/packages/config/cron/cron.xml /usr/local/pkg/ - 0755 + 0755 https://packages.pfsense.org/packages/config/cron/cron.inc /usr/local/www/packages/cron/ - 0755 + 0755 https://packages.pfsense.org/packages/config/cron/cron.php /usr/local/www/packages/cron/ - 0755 + 0755 https://packages.pfsense.org/packages/config/cron/cron_edit.php /usr/local/www/packages/cron/ - 0755 + 0755 https://packages.pfsense.org/packages/config/cron/index.php @@ -103,13 +103,13 @@ Enter the variable one here. input - + cron_sync_package(); - + cron_sync_package(); diff --git a/config/cron/cron_edit.php b/config/cron/cron_edit.php index 12fde39d..2b72a04d 100644 --- a/config/cron/cron_edit.php +++ b/config/cron/cron_edit.php @@ -1,21 +1,21 @@ - // @@ -121,162 +120,160 @@ function show_advanced_config() {
- - - + + +
- - -
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ".htmlspecialchars($pconfig['php'])."\n"; - ?> - - - - - - - - -
minute - -
hour - -
mday - -
month - -
wday - -
who - -
command - - -
  - - - - -
-
- -
-
-
-
-
-
- -
+ + +
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ".htmlspecialchars($pconfig['php'])."\n"; + ?> + + + + + + + + +
minute + +
hour + +
mday + +
month + +
wday + +
who + +
command + + +
  + + + + +
+
+ +
+
+
+
+
+
+ +
diff --git a/pkg_config.10.xml b/pkg_config.10.xml index 4e7e04b4..11fa3c12 100644 --- a/pkg_config.10.xml +++ b/pkg_config.10.xml @@ -369,7 +369,7 @@ Services https://packages.pfsense.org/packages/config/cron/cron.xml - 0.1.9 + 0.1.10 Beta 2.2 markjcrane@gmail.com -- cgit v1.2.3