Skip to content

Commit 3137d10

Browse files
committed
Release v1.3.5
1 parent 1f51e24 commit 3137d10

14 files changed

+56
-37
lines changed

Makefile

+3
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,9 @@ newmigration:
3535
newseed:
3636
read -p "Enter CamelCase seed name : " migname ; ./vendor/bin/phinx seed:create $$migname -c ./phinx-adapter.php
3737

38+
migrate:
39+
./vendor/bin/phinx migrate -c ./phinx-adapter.php
40+
3841
doc:
3942
apigen generate --source src --destination docs --title "Icinga Editor" --charset UTF-8 --access-levels public --access-levels protected --php --tree
4043

db/migrations/20180815115557_ssh_port_configurator.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,6 @@ class SshPortConfigurator extends AbstractMigration
1010
public function change()
1111
{
1212
$this->execute("UPDATE `service` SET `configurator` = 'ssh' WHERE `service`.`service_description` = 'SSH'");
13-
$this->execute("UPDATE `command` SET `command_line` = '/usr/lib/nagios/plugins/check_ssh -p \'$ARG1$\' \'$HOSTADDRESS$\'' WHERE `command`.`command_name` = 'check_ssh' ");
13+
$this->execute("UPDATE `command` SET `command_line` = '/usr/lib/nagios/plugins/check_ssh -p \'\$ARG1$\' \'\$HOSTADDRESS$\'' WHERE `command`.`command_name` = 'check_ssh' ");
1414
}
1515
}

debian/changelog

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
icinga-editor (1.3.4) UNRELEASED; urgency=medium
1+
icinga-editor (1.3.5) UNRELEASED; urgency=medium
22

33
[ vitex ]
44
* Merge origin/master
@@ -11,5 +11,6 @@ icinga-editor (1.3.4) UNRELEASED; urgency=medium
1111
* Regenerate All fixed
1212
* Release v1.3.2
1313
* HostgroupSelect updated
14+
* Release v1.3.4
1415

15-
-- CyberVitexus <vitex@exiv.jinonice.czf> Sat, 13 Jun 2020 14:17:19 +0200
16+
-- CyberVitexus <vitex@exiv.jinonice.czf> Thu, 18 Jun 2020 15:34:24 +0200

debian/conf/composer.json

+5-4
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,18 @@
1414
"vendor-dir": "/var/lib/icinga-editor"
1515
},
1616
"require": {
17+
"deb/ease-fluentpdo": "*",
1718
"deb/ease-bootstrap": "*",
1819
"league/commonmark": "^0.15.0",
1920
"pear/mail": ">=1.3.0",
2021
"pear/mail_mime": ">=1.10.0"
2122
},
2223
"autoload": {
2324
"psr-4": {
24-
"Icinga\\Editor\\": "classes/",
25-
"Icinga\\Editor\\Engine\\": "classes/engine/",
26-
"Icinga\\Editor\\UI\\": "classes/UI",
27-
"Icinga\\Editor\\modules\\": "modules"
25+
"Icinga\\Editor\\": "../../share/icinga-editor/classes/",
26+
"Icinga\\Editor\\Engine\\": "../../share/icinga-editor/classes/engine/",
27+
"Icinga\\Editor\\UI\\": "../../share/icinga-editor/classes/UI",
28+
"Icinga\\Editor\\modules\\": "../../share/icinga-editor/modules"
2829
}
2930
},
3031
"repositories": [

debian/files

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
icinga-editor_1.3.4_all.deb web optional
2-
icinga-editor_1.3.4_amd64.buildinfo monitoring optional
1+
icinga-editor_1.3.5_all.deb web optional
2+
icinga-editor_1.3.5_amd64.buildinfo monitoring optional

debian/install

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ src/classes/UI/*.php usr/share/icinga-editor/classes/UI
1313
src/classes/engine/*.php usr/share/icinga-editor/classes/engine
1414
src/modules/*.php usr/share/icinga-editor/modules
1515
debian/sql/install/* usr/share/dbconfig-common/data/icinga-editor/install
16-
debian/conf/composer.json usr/share/icinga-editor/
16+
debian/conf/composer.json usr/lib/icinga-editor/
1717
debian/conf/icinga-editor.conf etc/apache2/conf-available
1818
debian/conf/icinga-editor.service etc/avahi/services
1919
debian/conf/icinga-editor etc/sudoers.d

debian/postinst

+11-9
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,24 @@
11
#!/bin/sh
22
# postinst script for icinga-editor
3-
43
set -e
54

6-
WEBUSER=www-data
5+
. /usr/share/debconf/confmodule
6+
7+
db_get composer/WEB_USER
8+
WEBUSER=$RET
9+
mkdir -p /usr/lib/icinga-editor
10+
chown $WEBUSER /var/lib/icinga-editor /var/lib/composer -R
11+
echo '{}' > /usr/lib/icinga-editor/composer.lock
12+
chown $WEBUSER /usr/lib/icinga-editor/composer.lock
13+
su - $WEBUSER -s /bin/bash -c 'COMPOSER_HOME="/var/lib/composer" composer -o install -d /usr/lib/icinga-editor/'
14+
715

816
replaceJSON() {
917
cfg="/etc/icinga-editor/config.json"
1018
sed -i "/${1}/c\ \"${1}\": \"${2}\"," $cfg
1119
}
1220

1321

14-
. /usr/share/debconf/confmodule
1522

1623
db_input critical icinga-editor/SEND_MAILS_FROM || true
1724
db_go || true
@@ -75,12 +82,7 @@ fi
7582

7683
cd /usr/share/icinga-editor
7784

78-
mkdir -p /var/lib/composer
79-
chown $WEBUSER:$WEBUSER /var/lib/composer
80-
su - $WEBUSER -s /bin/bash -c 'COMPOSER_HOME="/var/lib/composer" composer --no-dev -o install -d /usr/share/icinga-editor/'
81-
82-
83-
. /etc/icinga-editor/config-db.sh
85+
. /etc/icinga-editor/config-db.sh
8486

8587
replaceJSON "DB_TYPE" "mysql"
8688
replaceJSON "DB_HOST" "localhost"

debian/rules

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@
55

66
override_dh_install:
77
dh_install
8-
sed -i -e 's/\.\.\//.\//g' debian/icinga-editor/usr/share/icinga-editor/about.php
8+
sed -i -e 's/\.\.\//\/usr\/lib\/icinga-editor\//g' debian/icinga-editor/usr/share/icinga-editor/about.php
99
sed -i -e 's/..\/vendor/\/var\/lib\/icinga-editor/g' debian/icinga-editor/usr/share/icinga-editor/includes/IEInit.php
1010
sed -i -e 's/..\/locale/\/usr\/share\/locale/g' debian/icinga-editor/usr/share/icinga-editor/includes/IEInit.php
1111
sed -i -e 's/..\/config.json/\/etc\/icinga-editor\/config.json/g' debian/icinga-editor/usr/share/icinga-editor/includes/IEInit.php
12-
sed -i -e 's/..\/includes/\/usr\/share\/icinga-editor\/includes/g' debian/icinga-editor/usr/bin/iecfgimporter
12+
sed -i -e 's/includes/\/usr\/share\/icinga-editor\/includes/g' debian/icinga-editor/usr/bin/iecfgimporter
1313
sed -i -e 's/config.json/\/etc\/icinga-editor\/config.json/g' debian/icinga-editor/var/lib/icinga-editor/phinx-adapter.php
1414
sed -i -e 's/.\/vendor/\/var\/lib\/icinga-editor/g' debian/icinga-editor/var/lib/icinga-editor/phinx-adapter.php

nbproject/private/config.properties

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
config=CfgImport

nbproject/private/private.xml

+1-2
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,7 @@
2323
</group>
2424
<group/>
2525
<group name="EASE">
26-
<file>file:/home/vitex/Projects/VitexSoftware/IcingaEditor/bootstrap.sh</file>
27-
<file>file:/home/vitex/Projects/VitexSoftware/IcingaEditor/debian/control</file>
26+
<file>file:/home/vitex/Projects/VitexSoftware/IcingaEditor/debian/postinst</file>
2827
</group>
2928
</open-files>
3029
</project-private>

nbproject/project.properties

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,5 +34,5 @@ src.dir=.
3434
tags.asp=false
3535
tags.short=true
3636
test.src.dir=test
37-
testing.providers=Codeception;PhpUnit
37+
testing.providers=PhpUnit
3838
web.root=.

src/classes/engine/Configurator.php

+15-7
Original file line numberDiff line numberDiff line change
@@ -722,6 +722,7 @@ public function saveToSQL($data = null, $searchForID = false) {
722722
if (is_null($data)) {
723723
$data = $this->getData();
724724
}
725+
$keyColumn = $this->getKeyColumn();
725726
foreach ($this->useKeywords as $keyWord => $columnType) {
726727
if (!array_key_exists($keyWord, $data)) {
727728
continue;
@@ -759,20 +760,20 @@ public function saveToSQL($data = null, $searchForID = false) {
759760
}
760761
$dbId = null;
761762
if ($this->allowTemplating && $this->isTemplate() && isset($data['name'])) {
762-
if (isset($data[$this->getKeyColumn()]) && (int) $data[$this->getKeyColumn()]) {
763-
$dbId = $this->dblink->queryToValue('SELECT `' . $this->keyColumn . '` FROM ' . $this->myTable . ' WHERE `name`' . " = '" . $data['name'] . "' AND " . $this->keyColumn . ' != ' . $data[$this->getKeyColumn()]);
763+
if (array_key_exists($keyColumn, $data) && (int) $data[$keyColumn]) {
764+
$dbId = $this->listingQuery()->where('name', $data['name'])->where($keyColumn . ' != ' . $data[$keyColumn])->fetchColumn();
764765
} else {
765-
$dbId = $this->dblink->queryToValue('SELECT `' . $this->keyColumn . '` FROM ' . $this->myTable . ' WHERE `name`' . " = '" . $data['name'] . "'");
766+
$dbId = $this->listingQuery()->where('name', $data['name'])->fetchColumn();
766767
}
767768
} else {
768769
if (isset($data[$this->nameColumn])) {
769-
if (isset($data[$this->getKeyColumn()]) && (int) $data[$this->getKeyColumn()]) {
770+
if (array_key_exists($keyColumn, $data) && (int) $data[$keyColumn]) {
770771
$dbId = $this->listingQuery()
771772
->where($this->nameColumn, $data[$this->nameColumn])
772-
->where($this->keyColumn . ' != ' . $data[$this->getKeyColumn()])->fetchColumn(0);
773+
->where($this->keyColumn . ' != ' . $data[$keyColumn])->fetchColumn(0);
773774
} else {
774-
$dbIdRaw = $oUser->listingQuery()->where($oUser->nameColumn, addslashes($data[$this->nameColumn]))->fetch();
775-
$dbId = $this->dblink->queryToValue('SELECT `' . $this->keyColumn . '` FROM ' . $this->myTable . ' WHERE ' . $this->nameColumn . " = '" . $data[$this->nameColumn] . "'");
775+
$dbIdRaw = User::singleton()->listingQuery()->where(User::singleton()->nameColumn, addslashes($data[$this->nameColumn]))->fetch();
776+
$dbId = $this->listingQuery()->where($this->nameColumn, $data[$this->nameColumn])->fetchColumn(0);
776777
}
777778
}
778779
}
@@ -797,6 +798,13 @@ public function saveToSQL($data = null, $searchForID = false) {
797798
}
798799
}
799800
}
801+
802+
if (array_key_exists('use', $data) && ($this->getPdo()->getAttribute(\PDO::ATTR_DRIVER_NAME) == 'mysql')) {
803+
$use = $data['use'];
804+
unset($data['use']);
805+
$data['`use`'] = $use;
806+
}
807+
800808
$result = parent::saveToSQL($data, $searchForID);
801809
if (!is_null($result) && (get_class($this->user) == 'Icinga\Editor\User')) {
802810
Shared::user()->setSettingValue('unsaved', true);

src/classes/engine/Importer.php

+4-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* Configuration importer
55
*
66
* @author Vitex <vitex@hippy.cz>
7-
* @copyright 2012-2015 Vitex@hippy.cz (G)
7+
* @copyright 2012-2020 Vitex@hippy.cz (G)
88
*/
99

1010
namespace Icinga\Editor\Engine;
@@ -67,6 +67,7 @@ public function dbInit() {
6767
* Import Configuration from path File or directory contents
6868
*
6969
* @param string $path import target
70+
*
7071
* @return array import results
7172
*/
7273
function importCfgPath($path) {
@@ -83,6 +84,7 @@ function importCfgPath($path) {
8384
* Naimportuje konfiguraci ze souboru
8485
*
8586
* @param string $cfgFile
87+
*
8688
* @return int počet uložených konfigurací
8789
*/
8890
public function importCfgFile($cfgFile) {
@@ -94,6 +96,7 @@ public function importCfgFile($cfgFile) {
9496
*
9597
* @param string $cfgText text
9698
* @param array $commonValues globálně uplatněné hodnoty
99+
*
97100
* @return int počet vloženýh konfigurací
98101
*/
99102
public function importCfgText($cfgText, $commonValues) {

src/iecfgimporter

+6-5
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#!/usr/bin/env php
22
<?php
3-
//namespace Icinga\Editor;
3+
4+
namespace Icinga\Editor;
45

56
/**
67
* Configuration import form file
@@ -12,7 +13,7 @@ define('EASE_LOGGER', 'console|syslog');
1213
require_once 'includes/IEInit.php';
1314

1415
if (!isset($argv[1])) {
15-
die("usage: iecfgimporter </import/source/path/> [default owner: _icinga] [public 0/1] ");
16+
die("usage: iecfgimporter </import/source/path/> [default owner: _icinga] [public 0/1] \n");
1617
} else {
1718
if (file_exists($argv[1])) {
1819
$cfgFile = $argv[1];
@@ -23,7 +24,7 @@ if (!isset($argv[1])) {
2324

2425
$owner = 0;
2526
if (isset($argv[2])) {
26-
$oUser = new \Icinga\Editor\User($argv[2]);
27+
$oUser = new User($argv[2]);
2728
$owner_id = $oUser->getUserID();
2829
if ($owner_id) {
2930
$owner = $owner_id;
@@ -35,9 +36,9 @@ if (isset($argv[2])) {
3536
$public = boolval($argv[2]);
3637
}
3738

38-
$params = ['public' => $public, 'generate' => true, 'owner' => $owner];
39+
$params = ['public' => $public, 'generate' => true, 'user_id' => $owner,'platform'=>'generic','autocfg'=>false];
3940

40-
$importer = new Icinga\Editor\Engine\Importer($params);
41+
$importer = new Engine\Importer($params);
4142
$importer->importCfgPath($cfgFile);
4243
if (count($importer->files)) {
4344
foreach ($importer->files as $cfgFile) {

0 commit comments

Comments
 (0)