From 8065e06cb37b27d0736b74e0e8ab646499a630b7 Mon Sep 17 00:00:00 2001 From: tbrehm Date: Tue, 30 Sep 2008 18:27:48 +0000 Subject: [PATCH] - Added the interface part of the ispconfig pacage manager - updated the debian installation instructions --- INSTALL_DEBIAN.txt => INSTALL_DEBIAN_4.0.txt | 2 +- INSTALL_DEBIAN_LENNY.txt | 175 ++++++++++++++ install/sql/ispconfig3.sql | 60 ++++- interface/lib/classes/db_mysql.inc.php | 4 +- .../lib/lang/en_software_package_list.lng | 7 + .../lib/lang/en_software_update_list.lng | 7 + interface/web/admin/lib/module.conf.php | 6 + interface/web/admin/software_package_list.php | 126 ++++++++++ interface/web/admin/software_repo_del.php | 51 ++++ interface/web/admin/software_repo_edit.php | 58 +++++ interface/web/admin/software_repo_list.php | 52 +++++ interface/web/admin/software_update_list.php | 221 ++++++++++++++++++ .../admin/templates/software_package_list.htm | 18 ++ .../admin/templates/software_repo_edit.htm | 32 +++ .../admin/templates/software_repo_list.htm | 28 +++ .../admin/templates/software_update_list.htm | 25 ++ .../web/tools/lib/menu.d/statistics.menu.php | 21 ++ server/mods-available/server_module.inc.php | 11 +- 18 files changed, 896 insertions(+), 8 deletions(-) rename INSTALL_DEBIAN.txt => INSTALL_DEBIAN_4.0.txt (98%) create mode 100644 INSTALL_DEBIAN_LENNY.txt create mode 100644 interface/web/admin/lib/lang/en_software_package_list.lng create mode 100644 interface/web/admin/lib/lang/en_software_update_list.lng create mode 100644 interface/web/admin/software_package_list.php create mode 100644 interface/web/admin/software_repo_del.php create mode 100644 interface/web/admin/software_repo_edit.php create mode 100644 interface/web/admin/software_repo_list.php create mode 100644 interface/web/admin/software_update_list.php create mode 100644 interface/web/admin/templates/software_package_list.htm create mode 100644 interface/web/admin/templates/software_repo_edit.htm create mode 100644 interface/web/admin/templates/software_repo_list.htm create mode 100644 interface/web/admin/templates/software_update_list.htm create mode 100644 interface/web/tools/lib/menu.d/statistics.menu.php diff --git a/INSTALL_DEBIAN.txt b/INSTALL_DEBIAN_4.0.txt similarity index 98% rename from INSTALL_DEBIAN.txt rename to INSTALL_DEBIAN_4.0.txt index 120f9c16a6..ed994d308c 100644 --- a/INSTALL_DEBIAN.txt +++ b/INSTALL_DEBIAN_4.0.txt @@ -40,7 +40,7 @@ apt-get install amavisd-new spamassassin clamav clamav-daemon zoo unzip bzip2 ar 3) Install apache, PHP5 and phpmyadmin (1 line!): -apt-get install apache2 apache2.2-common apache2-doc apache2-mpm-prefork apache2-utils libexpat1 ssl-cert libapache2-mod-php5 php5 php5-common php5-gd php5-mysql php5-imap phpmyadmin php5-cli +apt-get install apache2 apache2.2-common apache2-doc apache2-mpm-prefork apache2-utils libexpat1 ssl-cert libapache2-mod-php5 php5 php5-common php5-gd php5-mysql php5-imap phpmyadmin php5-cli libapache2-mod-fcgid Then run the following to enable the Apache modules: diff --git a/INSTALL_DEBIAN_LENNY.txt b/INSTALL_DEBIAN_LENNY.txt new file mode 100644 index 0000000000..d6131da9c9 --- /dev/null +++ b/INSTALL_DEBIAN_LENNY.txt @@ -0,0 +1,175 @@ +Installation +----------- + +It is recommended to use a clean (fresh) Debian etch install where you just selected "Standard System" as the package selection during setup. Then follow the steps below to setup your server with ISPConfig 3: + +1) Install Postfix, Courier, Saslauthd, MySQL, phpMyAdmin with the following command line (on one line!): + +apt-get install postfix postfix-mysql postfix-doc mysql-client mysql-server courier-authdaemon courier-authlib-mysql courier-pop courier-pop-ssl courier-imap courier-imap-ssl libsasl2 libsasl2-modules libsasl2-modules-sql sasl2-bin libpam-mysql openssl courier-maildrop getmail4 + +Answer the questions from the package manager as follows. + +Create directories for web-based administration ? <-- No +General type of configuration? <-- Internet site +Mail name? <-- server1.mydomain.tld + SSL certificate required <-- Ok + +...use your own domain name of course ;) + +Edit the file /etc/mysql/my.cnf + +vi /etc/mysql/my.cnf + +and comment out the line + +bind-address = 127.0.0.1 + +then restart mysql + +/etc/init.d/mysql restart + +Set the mysql database password: + +mysqladmin -u root password yourrootsqlpassword +mysqladmin -h ispconfig.local -u root password yourrootsqlpassword + + +2) Install Amavisd-new, Spamassassin and Clamav (1 line!): + +apt-get install amavisd-new spamassassin clamav clamav-daemon zoo unzip bzip2 arj nomarch lzop cabextract apt-listchanges libnet-ldap-perl libauthen-sasl-perl clamav-docs daemon libio-string-perl libio-socket-ssl-perl libnet-ident-perl zip libnet-dns-perl + +3) Install apache, PHP5 and phpmyadmin (1 line!): + +apt-get install apache2 apache2.2-common apache2-doc apache2-mpm-prefork apache2-utils libexpat1 ssl-cert libapache2-mod-php5 php5 php5-common php5-gd php5-mysql php5-imap phpmyadmin php5-cli libapache2-mod-fcgid apache2-suexec + +Then run the following to enable the Apache modules: + +a2enmod suexec +a2enmod rewrite +a2enmod ssl + +4) Install pure-ftpd and quota + +apt-get install pure-ftpd-common pure-ftpd-mysql quota quotatool + +Edit the file /etc/default/pure-ftpd-common + +vi /etc/default/pure-ftpd-common + +and change the start mode from inetd to standalone. + +Edit the file /etc/inetd.conf + +vi /etc/inetd.conf + +and comment out the line for the FTP service, so it looks like this: + +# ftp stream tcp nowait root /usr/sbin/tcpd /usr/sbin/pure-ftpd-wrapper + +Then execute: + +/etc/init.d/openbsd-inetd restart + + +5) Install mydns + +apt-get install mydns-mysql + +What is the hostname of the machine on which the database will run? -> localhost +What is the database name for the MyDNS database? -> mydns +Would you like to set up the database and tables automatically? -> yes +What is the username of the MySQL administrator? -> root +Enter the MySQL administrator password -> yourrootsqlpassword +Confirm this password -> yourrootsqlpassword +What is the MyDNS username? -> mydns +What is the MyDNS user password? -> mydnspassword + +The mydns installer is a bit tricky, you will have to select to create a new database for mydns and use a existing mysql user, e.g. the mysql root user. This database is only to fullfill the requirements for the debian pacakge during installation and will not be used by ISPConfig later. ISPConfig will automatically change the mydns configuration files to use the ISPConfig database. + + +6) Install vlogger and webalizer + +apt-get install vlogger webalizer + + +7) Install ISPConfig 3 + +There are two possile scenarios, but not both: +7.1) Install the latest released version +7.2) Install directly from SVN + +apt-get install php5-cli + +7.1) Installation of beta 3 from tar.gz + + cd /tmp + wget http://www.ispconfig.org/downloads/ISPConfig-3.0.0.6-beta.tar.gz + tar xvfz ISPConfig-3.0.0.6-beta.tar.gz + cd ispconfig3_install/install/ + +7.2) Installation from SVN + + apt-get install subversion + cd /tmp + svn export svn://svn.ispconfig.org/ispconfig3/trunk/ + cd trunk/install + + +7.1+7.2) Now proceed with the ISPConfig installation. + +Now start the installation process by executing: + +php -q install.php + +The installer will configure all services like postfix, sasl, courier, etc. for you. A manual setup as required for ISPConfig 2 (perfect setup guides) is not nescessary. To login to the ISPConfig controlpanel, open the following URL in your browser (replace the IP to match your settings!): + +http://192.168.0.100:8080/ + +the default login is: + +user: admin +password: admin + +In case you get a permission denied error from apache, please restart the apache webserver process. + +Optional: + +Install a webbased Email Client + +apt-get install squirrelmail +ln -s /usr/share/squirrelmail/ /var/www/webmail + +Access squirrelmail: + +http://192.168.0.100/webmail + + +To configure squirrelmail, run: + +/usr/sbin/squirrelmail-configure + +---------------------------------------------------------------------------------------------------------- + +Hints: + +debian 4.0 under openvz: + +VPSID=101 +for CAP in CHOWN DAC_READ_SEARCH SETGID SETUID NET_BIND_SERVICE NET_ADMIN SYS_CHROOT SYS_NICE CHOWN DAC_READ_SEARCH SETGID SETUID NET_BIND_SERVICE NET_ADMIN SYS_CHROOT SYS_NICE +do + vzctl set $VPSID --capability ${CAP}:on --save +done + +---------------------------------------------------------------------------------------------------------- + +Installing Jailkit: + +apt-get install build-essential autoconf automake1.9 libtool flex bison +cd /tmp +wget http://olivier.sessink.nl/jailkit/jailkit-2.5.tar.gz +tar xvfz jailkit-2.5.tar.gz +cd jailkit-2.5 +./configure +make +make install +rm -rf jailkit-2.5* diff --git a/install/sql/ispconfig3.sql b/install/sql/ispconfig3.sql index 67cad8402f..dcf65d9442 100644 --- a/install/sql/ispconfig3.sql +++ b/install/sql/ispconfig3.sql @@ -606,6 +606,27 @@ CREATE TABLE `shell_user` ( -- +-- -------------------------------------------------------- + +-- +-- Tabellenstruktur für Tabelle `software_package` +-- + +CREATE TABLE `software_package` ( + `package_id` int(11) NOT NULL auto_increment, + `software_repo_id` int(11) NOT NULL, + `package_name` varchar(100) NOT NULL, + `package_title` varchar(255) NOT NULL, + `package_description` text, + `package_version` varchar(255) default NULL, + PRIMARY KEY (`package_id`), + UNIQUE KEY `package_name` (`package_name`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1; + +-- +-- Daten für Tabelle `software_package` +-- + -- -------------------------------------------------------- -- @@ -625,7 +646,13 @@ CREATE TABLE `software_repo` ( `repo_password` varchar(30) default NULL, `active` varchar(255) NOT NULL default 'y', PRIMARY KEY (`software_repo_id`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ; +) ENGINE=MyISAM DEFAULT CHARSET=latin1; + +-- +-- Daten für Tabelle `software_repo` +-- + +INSERT INTO `software_repo` (`software_repo_id`, `sys_userid`, `sys_groupid`, `sys_perm_user`, `sys_perm_group`, `sys_perm_other`, `repo_name`, `repo_url`, `repo_username`, `repo_password`, `active`) VALUES (1, 1, 1, 'riud', 'riud', '', 'ISPConfig Addons', 'http://repo.ispconfig.org/addons/', '', '', 'n'); -- -------------------------------------------------------- @@ -636,18 +663,43 @@ CREATE TABLE `software_repo` ( CREATE TABLE `software_update` ( `software_update_id` int(11) NOT NULL auto_increment, `software_repo_id` int(11) NOT NULL, + `package_name` varchar(255) NOT NULL, `update_url` varchar(255) NOT NULL, `update_md5` varchar(255) NOT NULL, - `install` char(1) NOT NULL, - `depenencies` varchar(255) NOT NULL, + `update_dependencies` varchar(255) NOT NULL, `update_title` varchar(255) NOT NULL, + `v1` tinyint(4) NOT NULL default '0', + `v2` tinyint(4) NOT NULL default '0', + `v3` tinyint(4) NOT NULL default '0', + `v4` tinyint(4) NOT NULL default '0', + `type` enum('full','update') NOT NULL default 'full', PRIMARY KEY (`software_update_id`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ; +) ENGINE=MyISAM DEFAULT CHARSET=latin1; -- -- Daten für Tabelle `software_update` -- +-- -------------------------------------------------------- + +-- +-- Tabellenstruktur für Tabelle `software_update_inst` +-- + +CREATE TABLE `software_update_inst` ( + `software_update_inst_id` int(10) unsigned NOT NULL auto_increment, + `software_update_id` int(11) NOT NULL default '0', + `package_name` varchar(255) NOT NULL, + `server_id` int(11) NOT NULL, + `status` enum('none','installing','installed','deleting') NOT NULL default 'none', + PRIMARY KEY (`software_update_inst_id`), + UNIQUE KEY `software_update_id` (`software_update_id`,`package_name`,`server_id`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1; + +-- +-- Daten für Tabelle `software_update_inst` +-- + -- -------------------------------------------------------- diff --git a/interface/lib/classes/db_mysql.inc.php b/interface/lib/classes/db_mysql.inc.php index ca3b38cf38..8084443280 100644 --- a/interface/lib/classes/db_mysql.inc.php +++ b/interface/lib/classes/db_mysql.inc.php @@ -250,10 +250,10 @@ class db } } elseif(is_array($record_new)) { foreach($record_new as $key => $val) { - if(isset($record_new[$key]) && $record_old[$key] != $val) { + if(isset($record_new[$key]) && @$record_old[$key] != $val) { // Record has changed $diffrec_full['new'][$key] = $val; - $diffrec_full['old'][$key] = $record_old[$key]; + $diffrec_full['old'][$key] = @$record_old[$key]; $diff_num++; } else { $diffrec_full['new'][$key] = $val; diff --git a/interface/web/admin/lib/lang/en_software_package_list.lng b/interface/web/admin/lib/lang/en_software_package_list.lng new file mode 100644 index 0000000000..03917cabce --- /dev/null +++ b/interface/web/admin/lib/lang/en_software_package_list.lng @@ -0,0 +1,7 @@ + diff --git a/interface/web/admin/lib/lang/en_software_update_list.lng b/interface/web/admin/lib/lang/en_software_update_list.lng new file mode 100644 index 0000000000..3894beb1e7 --- /dev/null +++ b/interface/web/admin/lib/lang/en_software_update_list.lng @@ -0,0 +1,7 @@ + diff --git a/interface/web/admin/lib/module.conf.php b/interface/web/admin/lib/module.conf.php index 5b631553f2..b43fdba7c0 100644 --- a/interface/web/admin/lib/module.conf.php +++ b/interface/web/admin/lib/module.conf.php @@ -90,7 +90,13 @@ $items[] = array( 'title' => 'Repositories', 'target' => 'content', 'link' => 'admin/software_repo_list.php'); +$items[] = array( 'title' => 'Packages', + 'target' => 'content', + 'link' => 'admin/software_package_list.php'); +$items[] = array( 'title' => 'Updates', + 'target' => 'content', + 'link' => 'admin/software_update_list.php'); $module['nav'][] = array( 'title' => 'Software', 'open' => 1, diff --git a/interface/web/admin/software_package_list.php b/interface/web/admin/software_package_list.php new file mode 100644 index 0000000000..2f632a6f8d --- /dev/null +++ b/interface/web/admin/software_package_list.php @@ -0,0 +1,126 @@ +auth->check_module_permissions('admin'); + +//* This is only allowed for administrators +if(!$app->auth->is_admin()) die('only allowed for administrators.'); + +//* Get the latest packages from the repositorys and insert them in the local database +$packages_added = 0; +$repos = $app->db->queryAllRecords("SELECT software_repo_id, repo_url, repo_username, repo_password FROM software_repo WHERE active = 'y'"); +if(is_array($repos)) { + foreach($repos as $repo) { + $client = new SoapClient(null, array('location' => $repo['repo_url'], + 'uri' => $repo['repo_url'])); + + $packages = $client->get_packages($repo['repo_username'], $repo['repo_password']); + if(is_array($packages)) { + foreach($packages as $p) { + $package_name = $app->db->quote($p['name']); + $tmp = $app->db->queryOneRecord("SELECT package_id FROM software_package WHERE package_name = '$package_name'"); + if(empty($tmp['package_id'])) { + + $package_title = $app->db->quote($p['title']); + $package_description = $app->db->quote($p['description']); + $software_repo_id = intval($repo['software_repo_id']); + + $sql = "INSERT INTO software_package (software_repo_id, package_name, package_title, package_description) VALUES ($software_repo_id, '$package_name', '$package_title', '$package_description')"; + $app->db->query($sql); + $packages_added++; + } + } + } + + } +} + +//* Install packages, if GET Request +if(isset($_GET['action']) && $_GET['action'] == 'install' && $_GET['package'] != '' && $_GET['server_id'] > 0) { + $package_name = $app->db->quote($_GET['package']); + $server_id = intval($_GET['server_id']); + $sql = "SELECT software_update_id, package_name, update_title FROM software_update WHERE type = 'full' AND package_name = '$package_name' ORDER BY v1 DESC, v2 DESC, v3 DESC, v4 DESC LIMIT 0,1"; + $tmp = $app->db->queryOneRecord($sql); + $software_update_id = $tmp['software_update_id']; + + $insert_data = "(package_name, server_id, software_update_id, status) VALUES ('$package_name', '$server_id', '$software_update_id','installing')"; + $app->db->datalogInsert('software_update_inst', $insert_data, 'software_update_inst_id'); + +} + + + +// Show the list in the interface +// Loading the template +$app->uses('tpl'); +$app->tpl->newTemplate("form.tpl.htm"); +$app->tpl->setInclude('content_tpl','templates/software_package_list.htm'); + + +$servers = $app->db->queryAllRecords('SELECT server_id, server_name FROM server ORDER BY server_name'); +$packages = $app->db->queryAllRecords('SELECT * FROM software_package'); +if(is_array($packages)) { + foreach($packages as $key => $p) { + $installed_txt = ''; + foreach($servers as $s) { + $inst = $app->db->queryOneRecord("SELECT * FROM software_update, software_update_inst WHERE software_update_inst.software_update_id = software_update.software_update_id AND software_update_inst.package_name = '".addslashes($p["package_name"])."' AND server_id = '".$s["server_id"]."'"); + $version = $inst['v1'].'.'.$inst['v2'].'.'.$inst['v3'].'.'.$inst['v4']; + + if($inst['status'] == 'installed') { + $installed_txt .= $s['server_name'].": Installed version $version
"; + } elseif ($inst['status'] == 'installing') { + $installed_txt .= $s['server_name'].": Installation in progress
"; + } elseif ($inst['status'] == 'deleting') { + $installed_txt .= $s['server_name'].": Deletion in progress
"; + } else { + $installed_txt .= $s['server_name'].": Install now
"; + } + } + $packages[$key]['installed'] = $installed_txt; + } +} + + + +$app->tpl->setLoop('records',$packages); + +include_once('lib/lang/en_software_package_list.lng'); +$app->tpl->setVar($wb); + + +$app->tpl_defaults(); +$app->tpl->pparse(); + + +?> \ No newline at end of file diff --git a/interface/web/admin/software_repo_del.php b/interface/web/admin/software_repo_del.php new file mode 100644 index 0000000000..8da40c9c87 --- /dev/null +++ b/interface/web/admin/software_repo_del.php @@ -0,0 +1,51 @@ +auth->check_module_permissions('admin'); + +$app->uses("tform_actions"); +$app->tform_actions->onDelete(); + +?> \ No newline at end of file diff --git a/interface/web/admin/software_repo_edit.php b/interface/web/admin/software_repo_edit.php new file mode 100644 index 0000000000..bd0c875f56 --- /dev/null +++ b/interface/web/admin/software_repo_edit.php @@ -0,0 +1,58 @@ +auth->check_module_permissions('admin'); + +// Loading classes +$app->uses('tpl,tform,tform_actions'); +$app->load('tform_actions'); + +class page_action extends tform_actions { + +} + +$page = new page_action; +$page->onLoad(); + +?> \ No newline at end of file diff --git a/interface/web/admin/software_repo_list.php b/interface/web/admin/software_repo_list.php new file mode 100644 index 0000000000..0c05490ba0 --- /dev/null +++ b/interface/web/admin/software_repo_list.php @@ -0,0 +1,52 @@ +auth->check_module_permissions('admin'); + +$app->uses('listform_actions'); + +$app->listform_actions->onLoad(); + + +?> \ No newline at end of file diff --git a/interface/web/admin/software_update_list.php b/interface/web/admin/software_update_list.php new file mode 100644 index 0000000000..78cbbfe347 --- /dev/null +++ b/interface/web/admin/software_update_list.php @@ -0,0 +1,221 @@ +auth->check_module_permissions('admin'); + +//* This is only allowed for administrators +if(!$app->auth->is_admin()) die('only allowed for administrators.'); + +//* Get the latest updates from the repositorys and insert them in the local database +$updates_added = 0; +$repos = $app->db->queryAllRecords("SELECT software_repo_id, repo_url, repo_username, repo_password FROM software_repo WHERE active = 'y'"); +if(is_array($repos)) { + foreach($repos as $repo) { + + /* + SELECT software_package.package_name, v1, v2, v3, v4 + FROM software_package + LEFT JOIN software_update ON ( software_package.package_name = software_update.package_name ) + LEFT JOIN software_update_inst ON ( software_update.software_update_id = software_update_inst.software_update_id ) + GROUP BY package_name + ORDER BY v1 DESC , v2 DESC , v3 DESC , v4 DESC + */ + + $client = new SoapClient(null, array('location' => $repo['repo_url'], + 'uri' => $repo['repo_url'])); + + $packages = $app->db->queryAllRecords("SELECT software_package.package_name, v1, v2, v3, v4 FROM software_package LEFT JOIN software_update ON ( software_package.package_name = software_update.package_name ) GROUP BY package_name ORDER BY v1 DESC , v2 DESC , v3 DESC , v4 DESC"); + if(is_array($packages)) { + foreach($packages as $p) { + + $version = $p['v1'].'.'.$p['v2'].'.'.$p['v3'].'.'.$p['v4']; + $updates = $client->get_updates($p['package_name'], $version,$repo['repo_username'], $repo['repo_password']); + + if(is_array($updates)) { + foreach($updates as $u) { + + $version_array = explode('.',$u['version']); + $v1 = intval($version_array[0]); + $v2 = intval($version_array[1]); + $v3 = intval($version_array[2]); + $v4 = intval($version_array[3]); + + $package_name = $app->db->quote($u['package_name']); + $software_repo_id = intval($repo['software_repo_id']); + $update_url = $app->db->quote($u['url']); + $update_md5 = $app->db->quote($u['md5']); + $update_dependencies = (isset($u['dependencies']))?$app->db->quote($u['dependencies']):''; + $update_title = $app->db->quote($u['title']); + $type = $app->db->quote($u['type']); + + // Check that we do not have this update in the database yet + $sql = "SELECT * FROM software_update WHERE package_name = '$package_name' and v1 = '$v1' and v2 = '$v2' and v3 = '$v3' and v4 = '$v4'"; + $tmp = $app->db->queryOneRecord($sql); + if(!isset($tmp['software_update_id'])) { + // Insert the update in the datbase + $sql = "INSERT INTO software_update (software_repo_id, package_name, update_url, update_md5, update_dependencies, update_title, v1, v2, v3, v4, type) + VALUES ($software_repo_id, '$package_name', '$update_url', '$update_md5', '$update_dependencies', '$update_title', '$v1', '$v2', '$v3', '$v4', '$type')"; + //die($sql); + $app->db->query($sql); + } + + } + } + } + } + } +} + + +//* Install packages, if GET Request +if(isset($_GET['action']) && $_GET['action'] == 'install' && $_GET['package'] != '' && $_GET['server_id'] > 0) { + $package_name = $app->db->quote($_GET['package']); + $server_id = intval($_GET['server_id']); + $software_update_id = intval($_GET['id']); + + $insert_data = "(package_name, server_id, software_update_id, status) VALUES ('$package_name', '$server_id', '$software_update_id','installing')"; + $app->db->datalogInsert('software_update_inst', $insert_data, 'software_update_inst_id'); + +} + + + +// Show the list in the interface +// Loading the template +$app->uses('tpl'); +$app->tpl->newTemplate("form.tpl.htm"); +$app->tpl->setInclude('content_tpl','templates/software_update_list.htm'); + +/* +SELECT software_package.package_name, software_package.package_title, software_update.update_title, v1, v2, v3, v4, software_update_inst.status + FROM software_package + LEFT JOIN software_update ON ( software_package.package_name = software_update.package_name ) + LEFT JOIN software_update_inst ON ( software_update.software_update_id = software_update_inst.software_update_id ) +GROUP BY software_update.software_update_id + ORDER BY v1 DESC , v2 DESC , v3 DESC , v4 DESC +*/ + + + +if(isset($_POST["server_id"]) && $_POST["server_id"] > 0) { + $server_id = intval($_POST["server_id"]); +} else { + $server_id = 1; +} + +$servers = $app->db->queryAllRecords('SELECT server_id, server_name FROM server ORDER BY server_name'); +foreach($servers as $key => $server) { + if($server['server_id'] == $server_id) { + $servers[$key]['selected'] = 'selected'; + } else { + $servers[$key]['selected'] = ''; + } +} + +$app->tpl->setLoop('servers',$servers); + +$sql = "SELECT v1, v2, v3, v4, software_update.update_title, software_update.software_update_id, software_update.package_name, v1, v2, v3, v4, software_update_inst.status + FROM software_update LEFT JOIN software_update_inst ON ( software_update.software_update_id = software_update_inst.software_update_id ) + WHERE server_id = $server_id + GROUP BY software_update.package_name + ORDER BY software_update.package_name ASC, v1 DESC , v2 DESC , v3 DESC , v4 DESC"; + +$installed_packages = $app->db->queryAllRecords($sql); + + +$records_out = array(); + +if(is_array($installed_packages)) { + foreach($installed_packages as $ip) { + + // Get version number of the latest installed version + $sql = "SELECT v1, v2, v3, v4 FROM software_update, software_update_inst WHERE software_update.software_update_id = software_update_inst.software_update_id AND server_id = 1 ORDER BY v1 DESC , v2 DESC , v3 DESC , v4 DESC LIMIT 0,1"; + $lu = $app->db->queryOneRecord($sql); + + // Get all installable updates + $sql = "SELECT * FROM software_update WHERE v1 >= $lu[v1] AND v2 >= $lu[v2] AND v3 >= $lu[v3] AND v4 >= $lu[v4] AND package_name = '$ip[package_name]' ORDER BY v1 DESC , v2 DESC , v3 DESC , v4 DESC"; + $updates = $app->db->queryAllRecords($sql); + //die($sql); + + if(is_array($updates)) { + // Delete the last record as it is already installed + unset($updates[count($updates)-1]); + + foreach($updates as $key => $u) { + $version = $u['v1'].'.'.$u['v2'].'.'.$u['v3'].'.'.$u['v4']; + $installed_txt = "Install Update
"; + $records_out[] = array('version' => $version, 'update_title' => $u["update_title"], 'installed' => $installed_txt); + + } + } + } +} + +/* +$updates = $app->db->queryAllRecords('SELECT software_update.update_title, software_update.software_update_id, software_update.package_name, v1, v2, v3, v4, software_update_inst.status + FROM software_update LEFT JOIN software_update_inst ON ( software_update.software_update_id = software_update_inst.software_update_id ) + WHERE server_id = '.$server_id.' + GROUP BY software_update.package_name + ORDER BY software_update.package_name ASC, v1 DESC , v2 DESC , v3 DESC , v4 DESC'); + +if(is_array($updates)) { + foreach($updates as $key => $u) { + $installed_txt = ''; + + $version = $u['v1'].'.'.$u['v2'].'.'.$u['v3'].'.'.$u['v4']; + $updates[$key]['version'] = $version; + if($u['status'] == 'installed' || $u['status'] == 'installing' || $u['status'] == 'deleting') { + $installed_txt .= "Installed version $version
"; + } else { + $installed_txt .= "Install now
"; + } + $updates[$key]['installed'] = $installed_txt; + + } +} +*/ + + + +$app->tpl->setLoop('records',$records_out); + +include_once('lib/lang/en_software_update_list.lng'); +$app->tpl->setVar($wb); + + +$app->tpl_defaults(); +$app->tpl->pparse(); + + +?> \ No newline at end of file diff --git a/interface/web/admin/templates/software_package_list.htm b/interface/web/admin/templates/software_package_list.htm new file mode 100644 index 0000000000..399d9723aa --- /dev/null +++ b/interface/web/admin/templates/software_package_list.htm @@ -0,0 +1,18 @@ +

+ + + + + + + + + + + + + + + + +
{tmpl_var name="installed"}{tmpl_var name="package_title"}{tmpl_var name="package_description"}
 
\ No newline at end of file diff --git a/interface/web/admin/templates/software_repo_edit.htm b/interface/web/admin/templates/software_repo_edit.htm new file mode 100644 index 0000000000..eb719e92ac --- /dev/null +++ b/interface/web/admin/templates/software_repo_edit.htm @@ -0,0 +1,32 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
{tmpl_var name='repo_name_txt'}:
{tmpl_var name='repo_url_txt'}:
{tmpl_var name='repo_username_txt'}:
{tmpl_var name='repo_password_txt'}:
{tmpl_var name='active_txt'}:{tmpl_var name='active'}
  
 
  +
+
+ \ No newline at end of file diff --git a/interface/web/admin/templates/software_repo_list.htm b/interface/web/admin/templates/software_repo_list.htm new file mode 100644 index 0000000000..e3aa1d91d8 --- /dev/null +++ b/interface/web/admin/templates/software_repo_list.htm @@ -0,0 +1,28 @@ +

+


+ + + + + + + + + + + + + + + + + + + + + + + + + +
 
{tmpl_var name="active"}{tmpl_var name="repo_name"}{tmpl_var name="repo_url"}{tmpl_var name='delete_txt'}
\ No newline at end of file diff --git a/interface/web/admin/templates/software_update_list.htm b/interface/web/admin/templates/software_update_list.htm new file mode 100644 index 0000000000..34aa7792de --- /dev/null +++ b/interface/web/admin/templates/software_update_list.htm @@ -0,0 +1,25 @@ +

+ +

+ + + + + + + + + + + + + + + + + +
{tmpl_var name="installed"}{tmpl_var name="update_title"}{tmpl_var name="version"}
 
\ No newline at end of file diff --git a/interface/web/tools/lib/menu.d/statistics.menu.php b/interface/web/tools/lib/menu.d/statistics.menu.php new file mode 100644 index 0000000000..7c10155bff --- /dev/null +++ b/interface/web/tools/lib/menu.d/statistics.menu.php @@ -0,0 +1,21 @@ + 'Other page', + 'target' => 'content', + 'link' => 'http://www.google.de'); + +$items[] = array( 'title' => 'Mailqueue', + 'target' => 'content', + 'link' => 'tools/mailqueue.php'); + + +$module['nav'][] = array( 'title' => 'System Info', + 'open' => 1, + 'items' => $items); + + + + +?> \ No newline at end of file diff --git a/server/mods-available/server_module.inc.php b/server/mods-available/server_module.inc.php index a9e28dd714..a01e4c492c 100644 --- a/server/mods-available/server_module.inc.php +++ b/server/mods-available/server_module.inc.php @@ -40,7 +40,10 @@ class server_module { 'server_ip_delete', 'firewall_insert', 'firewall_update', - 'firewall_delete'); + 'firewall_delete', + 'software_update_inst_insert', + 'software_update_inst_update', + 'software_update_inst_delete'); /* This function is called when the module is loaded @@ -69,6 +72,7 @@ class server_module { $app->modules->registerTableHook('server','server_module','process'); $app->modules->registerTableHook('server_ip','server_module','process'); $app->modules->registerTableHook('firewall','server_module','process'); + $app->modules->registerTableHook('software_update_inst','server_module','process'); // Register service //$app->services->registerService('httpd','web_module','restartHttpd'); @@ -99,6 +103,11 @@ class server_module { if($action == 'u') $app->plugins->raiseEvent('firewall_update',$data); if($action == 'd') $app->plugins->raiseEvent('firewall_delete',$data); break; + case 'software_update_inst': + if($action == 'i') $app->plugins->raiseEvent('software_update_inst_insert',$data); + if($action == 'u') $app->plugins->raiseEvent('software_update_inst_update',$data); + if($action == 'd') $app->plugins->raiseEvent('software_update_inst_delete',$data); + break; } // end switch } // end function -- GitLab