beta 2
This commit is contained in:
@@ -75,26 +75,6 @@ function change_perms($dir) {
|
||||
}
|
||||
}
|
||||
|
||||
function cronjob_process_updatenotification($mode, $data) {
|
||||
global $config;
|
||||
$retval = 0;
|
||||
switch ($mode) {
|
||||
case UPDATENOTIFY_MODE_NEW:
|
||||
case UPDATENOTIFY_MODE_MODIFIED:
|
||||
break;
|
||||
case UPDATENOTIFY_MODE_DIRTY:
|
||||
if (is_array($config['cron']['job'])) {
|
||||
$index = array_search_ex($data, $config['cron']['job'], "uuid");
|
||||
if (false !== $index) {
|
||||
unset($config['cron']['job'][$index]);
|
||||
write_config();
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
return $retval;
|
||||
}
|
||||
|
||||
if (isset($_POST['save']) && $_POST['save']) {
|
||||
unset($input_errors);
|
||||
if (empty($input_errors)) {
|
||||
@@ -104,141 +84,6 @@ if (isset($_POST['save']) && $_POST['save']) {
|
||||
if (!is_dir($config['onebuttoninstaller']['storage_path'])) mkdir($config['onebuttoninstaller']['storage_path'], 0775, true);
|
||||
change_perms($_POST['storage_path']);
|
||||
$config['onebuttoninstaller']['auto_update'] = isset($_POST['auto_update']) ? true : false;
|
||||
|
||||
if (isset($_POST['enable_schedule']) && ($_POST['startup'] == $_POST['closedown'])) { $input_errors[] = gettext("Startup and closedown hour must be different!"); }
|
||||
else {
|
||||
if (isset($_POST['enable_schedule'])) {
|
||||
$config['onebuttoninstaller']['enable_schedule'] = isset($_POST['enable_schedule']) ? true : false;
|
||||
$config['onebuttoninstaller']['schedule_startup'] = $_POST['startup'];
|
||||
$config['onebuttoninstaller']['schedule_closedown'] = $_POST['closedown'];
|
||||
|
||||
$cronjob = array();
|
||||
$a_cronjob = &$config['cron']['job'];
|
||||
$uuid = isset($config['onebuttoninstaller']['schedule_uuid_startup']) ? $config['onebuttoninstaller']['schedule_uuid_startup'] : false;
|
||||
if (isset($uuid) && (FALSE !== ($cnid = array_search_ex($uuid, $a_cronjob, "uuid")))) {
|
||||
$cronjob['enable'] = true;
|
||||
$cronjob['uuid'] = $a_cronjob[$cnid]['uuid'];
|
||||
$cronjob['desc'] = "OneButtonInstaller startup (@ {$config['onebuttoninstaller']['schedule_startup']}:00)";
|
||||
$cronjob['minute'] = $a_cronjob[$cnid]['minute'];
|
||||
$cronjob['hour'] = $config['onebuttoninstaller']['schedule_startup'];
|
||||
$cronjob['day'] = $a_cronjob[$cnid]['day'];
|
||||
$cronjob['month'] = $a_cronjob[$cnid]['month'];
|
||||
$cronjob['weekday'] = $a_cronjob[$cnid]['weekday'];
|
||||
$cronjob['all_mins'] = $a_cronjob[$cnid]['all_mins'];
|
||||
$cronjob['all_hours'] = $a_cronjob[$cnid]['all_hours'];
|
||||
$cronjob['all_days'] = $a_cronjob[$cnid]['all_days'];
|
||||
$cronjob['all_months'] = $a_cronjob[$cnid]['all_months'];
|
||||
$cronjob['all_weekdays'] = $a_cronjob[$cnid]['all_weekdays'];
|
||||
$cronjob['who'] = 'root';
|
||||
$cronjob['command'] = "{$config['onebuttoninstaller']['rootfolder']}onebuttoninstaller_start.php && logger onebuttoninstaller: scheduled startup";
|
||||
} else {
|
||||
$cronjob['enable'] = true;
|
||||
$cronjob['uuid'] = uuid();
|
||||
$cronjob['desc'] = "OneButtonInstaller startup (@ {$config['onebuttoninstaller']['schedule_startup']}:00)";
|
||||
$cronjob['minute'] = 0;
|
||||
$cronjob['hour'] = $config['onebuttoninstaller']['schedule_startup'];
|
||||
$cronjob['day'] = true;
|
||||
$cronjob['month'] = true;
|
||||
$cronjob['weekday'] = true;
|
||||
$cronjob['all_mins'] = 0;
|
||||
$cronjob['all_hours'] = 0;
|
||||
$cronjob['all_days'] = 1;
|
||||
$cronjob['all_months'] = 1;
|
||||
$cronjob['all_weekdays'] = 1;
|
||||
$cronjob['who'] = 'root';
|
||||
$cronjob['command'] = "{$config['onebuttoninstaller']['rootfolder']}onebuttoninstaller_start.php && logger onebuttoninstaller: scheduled startup";
|
||||
$config['onebuttoninstaller']['schedule_uuid_startup'] = $cronjob['uuid'];
|
||||
}
|
||||
if (isset($uuid) && (FALSE !== $cnid)) {
|
||||
$a_cronjob[$cnid] = $cronjob;
|
||||
$mode = UPDATENOTIFY_MODE_MODIFIED;
|
||||
} else {
|
||||
$a_cronjob[] = $cronjob;
|
||||
$mode = UPDATENOTIFY_MODE_NEW;
|
||||
}
|
||||
updatenotify_set("cronjob", $mode, $cronjob['uuid']);
|
||||
// write_config();
|
||||
|
||||
unset ($cronjob);
|
||||
$cronjob = array();
|
||||
$a_cronjob = &$config['cron']['job'];
|
||||
$uuid = isset($config['onebuttoninstaller']['schedule_uuid_closedown']) ? $config['onebuttoninstaller']['schedule_uuid_closedown'] : false;
|
||||
if (isset($uuid) && (FALSE !== ($cnid = array_search_ex($uuid, $a_cronjob, "uuid")))) {
|
||||
$cronjob['enable'] = true;
|
||||
$cronjob['uuid'] = $a_cronjob[$cnid]['uuid'];
|
||||
$cronjob['desc'] = "OneButtonInstaller closedown (@ {$config['onebuttoninstaller']['schedule_closedown']}:00)";
|
||||
$cronjob['minute'] = $a_cronjob[$cnid]['minute'];
|
||||
$cronjob['hour'] = $config['onebuttoninstaller']['schedule_closedown'];
|
||||
$cronjob['day'] = $a_cronjob[$cnid]['day'];
|
||||
$cronjob['month'] = $a_cronjob[$cnid]['month'];
|
||||
$cronjob['weekday'] = $a_cronjob[$cnid]['weekday'];
|
||||
$cronjob['all_mins'] = $a_cronjob[$cnid]['all_mins'];
|
||||
$cronjob['all_hours'] = $a_cronjob[$cnid]['all_hours'];
|
||||
$cronjob['all_days'] = $a_cronjob[$cnid]['all_days'];
|
||||
$cronjob['all_months'] = $a_cronjob[$cnid]['all_months'];
|
||||
$cronjob['all_weekdays'] = $a_cronjob[$cnid]['all_weekdays'];
|
||||
$cronjob['who'] = 'root';
|
||||
$cronjob['command'] = "{$config['onebuttoninstaller']['rootfolder']}onebuttoninstaller_stop.php && logger onebuttoninstaller: scheduled closedown";
|
||||
} else {
|
||||
$cronjob['enable'] = true;
|
||||
$cronjob['uuid'] = uuid();
|
||||
$cronjob['desc'] = "OneButtonInstaller closedown (@ {$config['onebuttoninstaller']['schedule_closedown']}:00)";
|
||||
$cronjob['minute'] = 0;
|
||||
$cronjob['hour'] = $config['onebuttoninstaller']['schedule_closedown'];
|
||||
$cronjob['day'] = true;
|
||||
$cronjob['month'] = true;
|
||||
$cronjob['weekday'] = true;
|
||||
$cronjob['all_mins'] = 0;
|
||||
$cronjob['all_hours'] = 0;
|
||||
$cronjob['all_days'] = 1;
|
||||
$cronjob['all_months'] = 1;
|
||||
$cronjob['all_weekdays'] = 1;
|
||||
$cronjob['who'] = 'root';
|
||||
$cronjob['command'] = "{$config['onebuttoninstaller']['rootfolder']}onebuttoninstaller_stop.php && logger onebuttoninstaller: scheduled closedown";
|
||||
$config['onebuttoninstaller']['schedule_uuid_closedown'] = $cronjob['uuid'];
|
||||
}
|
||||
if (isset($uuid) && (FALSE !== $cnid)) {
|
||||
$a_cronjob[$cnid] = $cronjob;
|
||||
$mode = UPDATENOTIFY_MODE_MODIFIED;
|
||||
} else {
|
||||
$a_cronjob[] = $cronjob;
|
||||
$mode = UPDATENOTIFY_MODE_NEW;
|
||||
}
|
||||
updatenotify_set("cronjob", $mode, $cronjob['uuid']);
|
||||
// write_config();
|
||||
} // end of enable_schedule
|
||||
else {
|
||||
$config['onebuttoninstaller']['enable_schedule'] = isset($_POST['enable_schedule']) ? true : false;
|
||||
updatenotify_set("cronjob", UPDATENOTIFY_MODE_DIRTY, $config['onebuttoninstaller']['schedule_uuid_startup']);
|
||||
if (is_array($config['cron']['job'])) {
|
||||
$index = array_search_ex($data, $config['cron']['job'], "uuid");
|
||||
if (false !== $index) {
|
||||
unset($config['cron']['job'][$index]);
|
||||
}
|
||||
}
|
||||
// write_config();
|
||||
updatenotify_set("cronjob", UPDATENOTIFY_MODE_DIRTY, $config['onebuttoninstaller']['schedule_uuid_closedown']);
|
||||
if (is_array($config['cron']['job'])) {
|
||||
$index = array_search_ex($data, $config['cron']['job'], "uuid");
|
||||
if (false !== $index) {
|
||||
unset($config['cron']['job'][$index]);
|
||||
}
|
||||
}
|
||||
// write_config();
|
||||
} // end of disable_schedule -> remove cronjobs
|
||||
$retval = 0;
|
||||
if (!file_exists($d_sysrebootreqd_path)) {
|
||||
$retval |= updatenotify_process("cronjob", "cronjob_process_updatenotification");
|
||||
config_lock();
|
||||
$retval |= rc_update_service("cron");
|
||||
config_unlock();
|
||||
}
|
||||
// $savemsg .= get_std_save_message($retval).'<br />';
|
||||
if ($retval == 0) {
|
||||
updatenotify_delete("cronjob");
|
||||
}
|
||||
} // end of schedule change
|
||||
|
||||
$savemsg .= get_std_save_message(write_config());
|
||||
} // end of empty input_errors
|
||||
}
|
||||
|
||||
@@ -44,26 +44,6 @@ if ($return_val == 0) {
|
||||
}
|
||||
else { $server_version = gettext("Unable to retrieve version from server!"); }
|
||||
|
||||
function cronjob_process_updatenotification($mode, $data) {
|
||||
global $config;
|
||||
$retval = 0;
|
||||
switch ($mode) {
|
||||
case UPDATENOTIFY_MODE_NEW:
|
||||
case UPDATENOTIFY_MODE_MODIFIED:
|
||||
break;
|
||||
case UPDATENOTIFY_MODE_DIRTY:
|
||||
if (is_array($config['cron']['job'])) {
|
||||
$index = array_search_ex($data, $config['cron']['job'], "uuid");
|
||||
if (false !== $index) {
|
||||
unset($config['cron']['job'][$index]);
|
||||
write_config();
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
return $retval;
|
||||
}
|
||||
|
||||
if (isset($_POST['ext_remove']) && $_POST['ext_remove']) {
|
||||
// remove start/stop commands
|
||||
if ( is_array($config['rc']['postinit'] ) && is_array( $config['rc']['postinit']['cmd'] ) ) {
|
||||
@@ -78,36 +58,6 @@ if (isset($_POST['ext_remove']) && $_POST['ext_remove']) {
|
||||
++$i;
|
||||
}
|
||||
}
|
||||
// remove cronjobs
|
||||
if (isset($config['onebuttoninstaller']['enable_schedule'])) {
|
||||
updatenotify_set("cronjob", UPDATENOTIFY_MODE_DIRTY, $config['onebuttoninstaller']['schedule_uuid_startup']);
|
||||
if (is_array($config['cron']['job'])) {
|
||||
$index = array_search_ex($data, $config['cron']['job'], "uuid");
|
||||
if (false !== $index) {
|
||||
unset($config['cron']['job'][$index]);
|
||||
}
|
||||
}
|
||||
write_config();
|
||||
updatenotify_set("cronjob", UPDATENOTIFY_MODE_DIRTY, $config['onebuttoninstaller']['schedule_uuid_closedown']);
|
||||
if (is_array($config['cron']['job'])) {
|
||||
$index = array_search_ex($data, $config['cron']['job'], "uuid");
|
||||
if (false !== $index) {
|
||||
unset($config['cron']['job'][$index]);
|
||||
}
|
||||
}
|
||||
write_config();
|
||||
$retval = 0;
|
||||
if (!file_exists($d_sysrebootreqd_path)) {
|
||||
$retval |= updatenotify_process("cronjob", "cronjob_process_updatenotification");
|
||||
config_lock();
|
||||
$retval |= rc_update_service("cron");
|
||||
config_unlock();
|
||||
}
|
||||
$savemsg = get_std_save_message($retval);
|
||||
if ($retval == 0) {
|
||||
updatenotify_delete("cronjob");
|
||||
}
|
||||
}
|
||||
// remove extension pages
|
||||
mwexec ("rm -rf /usr/local/www/ext/onebuttoninstaller");
|
||||
mwexec ("rm -rf /usr/local/www/onebuttoninstaller*");
|
||||
|
||||
@@ -103,7 +103,7 @@ function log_display($loginfo) {
|
||||
// check if current architecture, plattform is supported
|
||||
// architectures: x86, x64, rpi
|
||||
// platforms: embedded, full, livecd, liveusb
|
||||
if (!empty($result[6]) && ((strpos($result[6], $arch) >= 0) || (strpos($result[6], $platform) >= 0))) {
|
||||
if (!empty($result[6]) && (!(strpos($result[6], $arch) === false) || !(strpos($result[6], $platform) === false))) {
|
||||
echo "<td {$loginfo['columns'][$i]['param']} class='{$loginfo['columns'][$i]['class']}'> <img src='status_disabled.png' border='0' alt='' title='".gettext('Unsupported architecture/platform')."' /> </td>\n";
|
||||
}
|
||||
else {
|
||||
|
||||
Reference in New Issue
Block a user