parent
dddeb1bbb5
commit
6be807cf9a
|
@ -29,7 +29,7 @@
|
|||
/**
|
||||
* Current PSM version
|
||||
*/
|
||||
define('PSM_VERSION', '3.2.0');
|
||||
define('PSM_VERSION', '3.2.1');
|
||||
|
||||
/**
|
||||
* URL to check for updates. Will not be checked if turned off on config page.
|
||||
|
|
|
@ -64,6 +64,8 @@ abstract class AbstractServerController extends AbstractController {
|
|||
`s`.`type`,
|
||||
`s`.`label`,
|
||||
`s`.`pattern`,
|
||||
`s`.`header_name`,
|
||||
`s`.`header_value`,
|
||||
`s`.`status`,
|
||||
`s`.`error`,
|
||||
`s`.`rtime`,
|
||||
|
|
|
@ -198,6 +198,8 @@ class ServerController extends AbstractServerController {
|
|||
'edit_value_timeout' => $edit_server['timeout'],
|
||||
'default_value_timeout' => PSM_CURL_TIMEOUT,
|
||||
'edit_value_pattern' => $edit_server['pattern'],
|
||||
'edit_value_header_name' => $edit_server['header_name'],
|
||||
'edit_value_header_value' => $edit_server['header_value'],
|
||||
'edit_value_warning_threshold' => $edit_server['warning_threshold'],
|
||||
'edit_website_username' => $edit_server['website_username'],
|
||||
'edit_website_password' => empty($edit_server['website_password']) ? '' : sha1($edit_server['website_password']),
|
||||
|
@ -263,6 +265,8 @@ class ServerController extends AbstractServerController {
|
|||
'port' => intval(psm_POST('port', 0)),
|
||||
'type' => psm_POST('type', ''),
|
||||
'pattern' => psm_POST('pattern', ''),
|
||||
'header_name' => psm_POST('header_name', ''),
|
||||
'header_value' => psm_POST('header_value', ''),
|
||||
'warning_threshold' => intval(psm_POST('warning_threshold', 0)),
|
||||
'active' => in_array($_POST['active'], array('yes', 'no')) ? $_POST['active'] : 'no',
|
||||
'email' => in_array($_POST['email'], array('yes', 'no')) ? $_POST['email'] : 'no',
|
||||
|
|
|
@ -126,7 +126,7 @@ class Installer {
|
|||
|
||||
$this->log('Populating database...');
|
||||
$queries = array();
|
||||
$queries[] = "INSERT INTO `" . PSM_DB_PREFIX . "servers` (`ip`, `port`, `label`, `type`, `pattern`, `status`, `error`, `rtime`, `last_online`, `last_check`, `active`, `email`, `sms`, `pushover`) VALUES ('http://sourceforge.net/index.php', 80, 'SourceForge', 'website', '', 'on', '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 'yes', 'yes', 'yes', 'yes'), ('smtp.gmail.com', 465, 'Gmail SMTP', 'service', '', 'on', '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 'yes', 'yes', 'yes', 'yes')";
|
||||
$queries[] = "INSERT INTO `" . PSM_DB_PREFIX . "servers` (`ip`, `port`, `label`, `type`, `pattern`,`status`, `error`, `rtime`, `last_online`, `last_check`, `active`, `email`, `sms`, `pushover`) VALUES ('http://sourceforge.net/index.php', 80, 'SourceForge', 'website', '', 'on', '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 'yes', 'yes', 'yes', 'yes'), ('smtp.gmail.com', 465, 'Gmail SMTP', 'service', '', 'on', '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 'yes', 'yes', 'yes', 'yes')";
|
||||
$queries[] = "INSERT INTO `" . PSM_DB_PREFIX . "users_servers` (`user_id`,`server_id`) VALUES (1, 1), (1, 2);";
|
||||
$queries[] = "INSERT INTO `" . PSM_DB_PREFIX . "config` (`key`, `value`) VALUE
|
||||
('language', 'en_US'),
|
||||
|
@ -224,6 +224,8 @@ class Installer {
|
|||
`label` varchar(255) NOT NULL,
|
||||
`type` enum('ping','service','website') NOT NULL default 'service',
|
||||
`pattern` varchar(255) NOT NULL,
|
||||
`header_name` varchar(255) NOT NULL default '',
|
||||
`header_value` varchar(255) NOT NULL default '',
|
||||
`status` enum('on','off') NOT NULL default 'on',
|
||||
`error` varchar(255) NULL,
|
||||
`rtime` FLOAT(9, 7) NULL,
|
||||
|
@ -294,6 +296,9 @@ class Installer {
|
|||
if(version_compare($version_from, '3.2.0', '<')) {
|
||||
$this->upgrade320();
|
||||
}
|
||||
if(version_compare($version_from, '3.2.1', '<')) {
|
||||
$this->upgrade321();
|
||||
}
|
||||
psm_update_conf('version', $version_to);
|
||||
}
|
||||
|
||||
|
@ -478,4 +483,13 @@ class Installer {
|
|||
// Drop old user_id('s) column
|
||||
$this->execSQL("ALTER TABLE `" . PSM_DB_PREFIX . "log` DROP COLUMN `user_id`;");
|
||||
}
|
||||
|
||||
/**
|
||||
* Upgrade for v3.2.1 release
|
||||
*/
|
||||
protected function upgrade321() {
|
||||
$queries = array();
|
||||
$queries[] = "ALTER TABLE `" . PSM_DB_PREFIX . "servers` ADD COLUMN `header_name` VARCHAR(255) AFTER `pattern`, ADD COLUMN `header_value` VARCHAR(255) AFTER `header_name`";
|
||||
$this->execSQL($queries);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -56,13 +56,13 @@ class UpdateManager extends ContainerAware {
|
|||
)";
|
||||
}
|
||||
|
||||
$sql = "SELECT `s`.`server_id`,`s`.`ip`,`s`.`port`,`s`.`label`,`s`.`type`,`s`.`pattern`,`s`.`status`,`s`.`active`,`s`.`email`,`s`.`sms`,`s`.`pushover`
|
||||
$sql = "SELECT `s`.`server_id`,`s`.`ip`,`s`.`port`,`s`.`label`,`s`.`type`,`s`.`pattern`,`s`.`header_name`,`s`.`header_value`,`s`.`status`,`s`.`active`,`s`.`email`,`s`.`sms`,`s`.`pushover`
|
||||
FROM `".PSM_DB_PREFIX."servers` AS `s`
|
||||
{$sql_join}
|
||||
WHERE `active`='yes' ";
|
||||
|
||||
$servers = $this->container->get('db')->query($sql);
|
||||
|
||||
|
||||
$updater = new Updater\StatusUpdater($this->container->get('db'));
|
||||
$notifier = new Updater\StatusNotifier($this->container->get('db'));
|
||||
|
||||
|
|
|
@ -121,7 +121,7 @@ class StatusNotifier {
|
|||
$this->server = $this->db->selectRow(PSM_DB_PREFIX . 'servers', array(
|
||||
'server_id' => $server_id,
|
||||
), array(
|
||||
'server_id', 'ip', 'port', 'label', 'type', 'pattern', 'status', 'error', 'active', 'email', 'sms', 'pushover',
|
||||
'server_id', 'ip', 'port', 'label', 'type', 'pattern', 'status', 'header_name', 'header_value', 'error', 'active', 'email', 'sms', 'pushover',
|
||||
));
|
||||
if(empty($this->server)) {
|
||||
return false;
|
||||
|
|
|
@ -82,7 +82,7 @@ class StatusUpdater {
|
|||
$this->server = $this->db->selectRow(PSM_DB_PREFIX . 'servers', array(
|
||||
'server_id' => $server_id,
|
||||
), array(
|
||||
'server_id', 'ip', 'port', 'label', 'type', 'pattern', 'status', 'active', 'warning_threshold',
|
||||
'server_id', 'ip', 'port', 'label', 'type', 'pattern', 'header_name', 'header_value', 'status', 'active', 'warning_threshold',
|
||||
'warning_threshold_counter', 'timeout', 'website_username', 'website_password'
|
||||
));
|
||||
if(empty($this->server)) {
|
||||
|
|
|
@ -65,6 +65,13 @@
|
|||
<input type="text" id="pattern" name="pattern" value="{{ edit_value_pattern }}" maxlength="255" data-toggle="tooltip" title="{{ label_pattern_description }}" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="control-group types typeWebsite">
|
||||
<label class="control-label" for="header_name">{{ label_header }}</label>
|
||||
<div class="controls">
|
||||
<input type="text" id="header_name" name="header_name" value="{{ edit_value_header_name }}" maxlength="255" data-toggle="tooltip" title="{{ label_header_name }}" />
|
||||
<input type="text" id="header_value" name="header_value" value="{{ edit_value_header_value }}" maxlength="255" data-toggle="tooltip" title="{{ label_header_value }}" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="control-group">
|
||||
<label class="control-label" for="warning_threshold">{{ label_warning_threshold }}</label>
|
||||
<div class="controls">
|
||||
|
|
Loading…
Reference in New Issue