Commit 6149e17b authored by tbrehm's avatar tbrehm
Browse files

Removed some unmaintained tables and files and introduced the pre_update.sql...

Removed some unmaintained tables and files and introduced the pre_update.sql script for sql commands to be run before an update.
parent 99481a05
......@@ -40,126 +40,6 @@ SET FOREIGN_KEY_CHECKS = 0;
-- --------------------------------------------------------
-- --------------------------------------------------------
--
-- Table structure for table `billing_invoice`
--
CREATE TABLE `billing_invoice` (
`billing_invoice_id` int(11) unsigned NOT NULL auto_increment,
`sys_userid` int(11) unsigned NOT NULL default '0',
`sys_groupid` int(11) unsigned NOT NULL default '0',
`sys_perm_user` varchar(5) default NULL,
`sys_perm_group` varchar(5) default NULL,
`sys_perm_other` varchar(5) default NULL,
`sys_perm_all` varchar(5) default NULL,
`invoice_number` varchar(32) NOT NULL default '',
`invoice_date` date default NULL,
`xml` longtext NOT NULL,
`total_fee_net` decimal(10,4) NOT NULL default '0.00',
`total_fee_gross` decimal(10,4) NOT NULL default '0.00',
`currency_code` char(3) default 'EUR',
PRIMARY KEY (`billing_invoice_id`)
) ENGINE=MyISAM AUTO_INCREMENT=1;
-- --------------------------------------------------------
--
-- Table structure for table `billing_product`
--
CREATE TABLE `billing_product` (
`billing_product_id` int(11) unsigned NOT NULL auto_increment,
`sys_userid` int(11) unsigned NOT NULL default '0',
`sys_groupid` int(11) unsigned NOT NULL default '0',
`sys_perm_user` varchar(5) default NULL,
`sys_perm_group` varchar(5) default NULL,
`sys_perm_other` varchar(5) default NULL,
`sys_perm_all` varchar(5) default NULL,
`parent_id` int(11) unsigned NOT NULL default '0',
`product_name` varchar(64) default NULL,
`product_details` varchar(256) default NULL,
`template_id` int(11) unsigned NOT NULL default '0',
`service_class_id` int(11) unsigned NOT NULL default '0',
`billing_tax_id` int(11) unsigned NOT NULL default '0',
`setup_fee_gross` decimal(10,4) NOT NULL default '0.00',
`interval_fee_gross` decimal(10,4) NOT NULL default '0.00',
`interval_length` tinyint(3) NOT NULL default '0',
`interval_type` enum('non-recurring','hour','day','week','month','quarter','year') NOT NULL default 'non-recurring',
`interval_payment` enum('prepaid','postpaid') NOT NULL default 'prepaid',
`clearing_period` tinyint(3) unsigned default '1',
`currency_code` char(3) default 'EUR',
PRIMARY KEY (`billing_product_id`)
) ENGINE=MyISAM AUTO_INCREMENT=1;
-- --------------------------------------------------------
--
-- Table structure for table `billing_service`
--
CREATE TABLE `billing_service` (
`billing_service_id` int(11) unsigned NOT NULL auto_increment,
`sys_userid` int(11) unsigned NOT NULL default '0',
`sys_groupid` int(11) unsigned NOT NULL default '0',
`sys_perm_user` varchar(5) default NULL,
`sys_perm_group` varchar(5) default NULL,
`sys_perm_other` varchar(5) default NULL,
`sys_perm_all` varchar(5) default NULL,
`product_id` int(11) unsigned default NULL,
`product_pid` int(11) unsigned default NULL,
`product_name` varchar(64) default NULL,
`product_details` varchar(256) default NULL,
`service_class_id` int(11) unsigned default '0',
`service_template_id` int(11) unsigned default NULL,
`service_id` int(11) unsigned default NULL,
`billing_tax_id` int(11) unsigned NOT NULL default '1',
`quantity` smallint(5) unsigned NOT NULL default '1',
`setup_fee_gross` decimal(10,4) NOT NULL default '0.00',
`interval_fee_gross` decimal(10,4) default '0.00',
`interval_fee_is_individual` tinyint(1) default '0',
`interval_length` int(11) NOT NULL default '1',
`interval_type` enum('non-recurring','hour','day','week','month','quarter','year') NOT NULL default 'non-recurring',
`interval_payment` enum('prepaid','postpaid') NOT NULL default 'prepaid',
`clearing_period` tinyint(3) unsigned default '1',
`currency_code` char(3) default 'EUR',
`is_active` tinyint(1) NOT NULL default '0',
`service_start_at` date default NULL,
`service_end_at` date default NULL,
`invoiced_upto` date default NULL,
PRIMARY KEY (`billing_service_id`)
) ENGINE=MyISAM AUTO_INCREMENT=1;
-- --------------------------------------------------------
--
-- Table structure for table `billing_service_class`
--
CREATE TABLE `billing_service_class` (
`billing_service_class_id` int(11) unsigned NOT NULL auto_increment,
`name` varchar(64) NOT NULL default '',
`sort_order` int(11) unsigned NOT NULL default '0',
PRIMARY KEY (`billing_service_class_id`)
) ENGINE=MyISAM AUTO_INCREMENT=1;
-- --------------------------------------------------------
--
-- Table structure for table `billing_tax`
--
CREATE TABLE `billing_tax` (
`billing_tax_id` int(11) unsigned NOT NULL auto_increment,
`name` varchar(64) NOT NULL default '',
`tax_rate` decimal(10,4) default NULL,
`is_default` tinyint(1) NOT NULL default '0',
`valid_from` date default NULL,
`valid_till` date default NULL,
PRIMARY KEY (`billing_tax_id`)
) ENGINE=MyISAM AUTO_INCREMENT=1;
-- --------------------------------------------------------
--
-- Table structure for table `client`
--
......@@ -226,38 +106,6 @@ CREATE TABLE `client` (
-- --------------------------------------------------------
--
-- Table structure for table `client_address_book`
--
CREATE TABLE `client_address_book` (
`client_address_book_id` int(11) unsigned NOT NULL auto_increment,
`sys_userid` int(11) unsigned NOT NULL default '0',
`sys_groupid` int(11) unsigned NOT NULL default '0',
`sys_perm_user` varchar(5) default NULL,
`sys_perm_group` varchar(5) default NULL,
`sys_perm_other` varchar(5) default NULL,
`entry_role` enum('Standard','Other','Administrator','Abuse','Accounting','Owner','Emergency','Technician','Signatory') default 'Standard',
`entry_company` varchar(64) default NULL,
`entry_gender` enum('m','f') default NULL,
`entry_title` varchar(16) default NULL,
`entry_firstname` varchar(32) NOT NULL,
`entry_lastname` varchar(32) NOT NULL,
`entry_address1` varchar(64) default NULL,
`entry_address2` varchar(64) default NULL,
`entry_postcode` varchar(32) NOT NULL,
`entry_city` varchar(64) NOT NULL,
`entry_state` varchar(32) default NULL,
`entry_country` char(2) default NULL,
`entry_phone` varchar(32) default NULL,
`entry_fax` varchar(32) default NULL,
`entry_mobile` varchar(32) default NULL,
`entry_email` varchar(256) default NULL,
PRIMARY KEY (`client_address_book_id`)
) ENGINE=MyISAM AUTO_INCREMENT=1;
-- --------------------------------------------------------
--
-- Table structure for table `client_template`
--
......@@ -375,94 +223,6 @@ CREATE TABLE `dns_template` (
-- --------------------------------------------------------
--
-- Table structure for table `domain`
--
CREATE TABLE `domain` (
`domain_id` int(11) unsigned NOT NULL auto_increment,
`sys_userid` int(11) unsigned NOT NULL default '0',
`sys_groupid` int(11) unsigned NOT NULL default '0',
`sys_perm_user` varchar(5) default NULL,
`sys_perm_group` varchar(5) default NULL,
`sys_perm_other` varchar(5) default NULL,
`sys_perm_all` varchar(5) default NULL,
`domain_provider_id` int(11) unsigned NOT NULL default '0',
`provider_domain_id` int(11) unsigned default NULL,
`domain` varchar(255) NOT NULL default '',
`tld` varchar(32) NOT NULL default '',
`handle_desc` varchar(32) default NULL,
`handle_admin_c` varchar(32) default NULL,
`handle_tech_c` varchar(32) default NULL,
`handle_zone_c` varchar(32) default NULL,
`added_at` timestamp NULL default NULL,
`connected_at` date default NULL,
`disconnected_at` date default NULL,
`status` varchar(64) NOT NULL default '0',
PRIMARY KEY (`domain_id`)
) ENGINE=MyISAM AUTO_INCREMENT=1;
-- --------------------------------------------------------
--
-- Table structure for table `domain_handle`
--
CREATE TABLE `domain_handle` (
`domain_handle_id` int(11) unsigned NOT NULL auto_increment,
`sys_userid` int(11) unsigned NOT NULL default '0',
`sys_groupid` int(11) unsigned NOT NULL default '0',
`sys_perm_user` varchar(5) default NULL,
`sys_perm_group` varchar(5) default NULL,
`sys_perm_other` varchar(5) default NULL,
`sys_perm_all` varchar(5) default NULL,
`domain_registrar` varchar(64) default NULL,
`handle` varchar(32) default NULL,
PRIMARY KEY (`domain_handle_id`)
) ENGINE=MyISAM AUTO_INCREMENT=1;
-- --------------------------------------------------------
--
-- Table structure for table `domain_provider`
--
CREATE TABLE `domain_provider` (
`domain_provider_id` int(11) unsigned NOT NULL auto_increment,
`sys_userid` int(11) unsigned NOT NULL default '0',
`sys_groupid` int(11) unsigned NOT NULL default '0',
`sys_perm_user` varchar(5) default NULL,
`sys_perm_group` varchar(5) default NULL,
`sys_perm_other` varchar(5) default NULL,
`sys_perm_all` varchar(5) default NULL,
`provider` varchar(255) default NULL,
`is_extern` tinyint(1) NOT NULL default '0',
`domainrobot_interface` varchar(16) default '',
PRIMARY KEY (`domain_provider_id`)
) ENGINE=MyISAM AUTO_INCREMENT=1;
-- --------------------------------------------------------
--
-- Table structure for table `domain_tld`
--
CREATE TABLE `domain_tld` (
`domain_tld_id` int(11) unsigned NOT NULL auto_increment,
`sys_userid` int(11) unsigned NOT NULL default '0',
`sys_groupid` int(11) unsigned NOT NULL default '0',
`sys_perm_user` varchar(5) default NULL,
`sys_perm_group` varchar(5) default NULL,
`sys_perm_other` varchar(5) default NULL,
`sys_perm_all` varchar(5) default NULL,
`tld` varchar(32) default NULL,
`domain_provider_id` int(11) unsigned NOT NULL default '0',
`domain_registrar` varchar(64) default NULL,
PRIMARY KEY (`domain_tld_id`)
) ENGINE=MyISAM AUTO_INCREMENT=1;
-- --------------------------------------------------------
--
-- Table structure for table `firewall`
--
......@@ -1330,23 +1090,6 @@ CREATE TABLE `country` (
-- --------------------------------------------------------
-- --------------------------------------------------------
--
-- Dumping data for table `billing_service_class`
--
INSERT INTO `billing_service_class` VALUES (1,'other',9999);
INSERT INTO `billing_service_class` VALUES (2,'hosting',10);
INSERT INTO `billing_service_class` VALUES (3,'domains',20);
INSERT INTO `billing_service_class` VALUES (4,'traffic',30);
INSERT INTO `billing_service_class` VALUES (5,'diskspace',40);
--
-- Dumping data for table `billing_tax_class`
--
INSERT INTO `billing_tax` VALUES (1,'USt. (DE)',19,1,'2007-01-01',NULL);
INSERT INTO `billing_tax` VALUES (2,'USt. ermäßigt (DE)',7,0,'2007-01-01',NULL);
--
-- Dumping data for table `dns_template`
--
......
<?php
/*
Copyright (c) 2007, Till Brehm, projektfarm Gmbh
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the name of ISPConfig nor the names of its contributors
may be used to endorse or promote products derived from this software without
specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/******************************************
* Begin Form configuration
******************************************/
$list_def_file = "list/domain.list.php";
$tform_def_file = "form/domain.tform.php";
/******************************************
* End Form configuration
******************************************/
require_once('../../lib/config.inc.php');
require_once('../../lib/app.inc.php');
//* Check permissions for module
$app->auth->check_module_permissions('domain');
$app->uses('tpl,tform,tform_actions');
$app->load('tform_actions');
class page_action extends tform_actions {
function onBeforeDelete() {
global $app; $conf;
if($app->tform->checkPerm($this->id,'d') == false) $app->error($app->lng('error_no_delete_permission'));
// Delete all records that belog to this domain.
$app->db->query("DELETE FROM domain WHERE domain_id = $domain_id");
}
}
$page = new page_action;
$page->onDelete();
?>
\ No newline at end of file
/*
Copyright (c) 2007-2009, Till Brehm, projektfarm Gmbh
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the name of ISPConfig nor the names of its contributors
may be used to endorse or promote products derived from this software without
specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
--
-- These SQL commands will be executed before the ISPConfig update is performed.
--
SET FOREIGN_KEY_CHECKS = 0;
DROP TABLE IF EXISTS `billing_invoice`;
DROP TABLE IF EXISTS `billing_product`;
DROP TABLE IF EXISTS `billing_service`;
DROP TABLE IF EXISTS `billing_service_class`;
DROP TABLE IF EXISTS `billing_tax`;
DROP TABLE IF EXISTS `client_address_book`;
DROP TABLE IF EXISTS `domain`;
DROP TABLE IF EXISTS `domain_handle`;
DROP TABLE IF EXISTS `domain_provider`;
DROP TABLE IF EXISTS `domain_tld`;
SET FOREIGN_KEY_CHECKS = 1;
\ No newline at end of file
......@@ -119,6 +119,15 @@ if( empty($conf["mysql"]["admin_password"]) ) {
$conf["mysql"]["admin_password"] = $inst->free_query('MySQL root password', $conf['mysql']['admin_password']);
}
//** load the pre update sql script do perform modifications on the database before the database is dumped
if(is_file(ISPC_INSTALL_ROOT."/install/sql/pre_update.sql")) {
if($conf['mysql']['admin_password'] == '') {
caselog("mysql --default-character-set=".$conf['mysql']['charset']." -h '".$conf['mysql']['host']."' -u '".$conf['mysql']['admin_user']."' '".$conf['mysql']['database']."' < '".ISPC_INSTALL_ROOT."/install/sql/pre_update.sql' &> /dev/null", __FILE__, __LINE__, 'read in ispconfig3.sql', 'could not read in ispconfig3.sql');
} else {
caselog("mysql --default-character-set=".$conf['mysql']['charset']." -h '".$conf['mysql']['host']."' -u '".$conf['mysql']['admin_user']."' -p'".$conf['mysql']['admin_password']."' '".$conf['mysql']['database']."' < '".ISPC_INSTALL_ROOT."/install/sql/pre_update.sql' &> /dev/null", __FILE__, __LINE__, 'read in ispconfig3.sql', 'could not read in ispconfig3.sql');
}
}
//** export the current database data
if( !empty($conf["mysql"]["admin_password"]) ) {
......
since i don't have the time to develope this module at the moment i want to explain how the database is constructed, so that someone else is able to contiue on this module.
First of all: Why do we need this module?
-----------------------------------------
At the moment it is possible for a customer to register every domain, even subdomains belonging to other customers!
With the "domain"-module it is possible to assign domains to customers and to implement domain-robot-tools.
The next step would be to implement selector boxes to other modules like "dns", "mail", etc. where the customer can only select domains which belong to him.
THE TABLES:
-----------
domain
______
- domain_provider_id: reference to table domain_provider; over which provider was the domain ordered!
- provider_domain_id: reference-id from the domain-provider
- ...
- added_at: record creation date
- connected_at: date at which the domain was connected - important for billing!
- disconnected_at: empty by default. Date when the domain was canceled.
- status: status-info from the registrar
domain_handle
-------------
most registrars work with handles. In this table we assign handles from different registrars (DENIC, etc.) to the ispc-clients
domain_provider
---------------
the domainprovider is the one where the domains are ordere at (Hetzner, 1und1, HostEurope, etc.)
- provider: name of the Provider
- is_extern: BOOL; Only True if the client has ordered the domain somewhere else on his own and want's to use the domain on the ISPC-Server. - IMPORTANT FOR DOMAIN-BILLING!
- domainrobot_interface: for future development - describes the Providers domainrobot-interface: could be NULL, EMAIL, SOAP, XML, etc.
domain_tld
----------
all available TopLevelDomains
- tld: The TopLevelDomain (without dot: e.g.: "de" NOT ".de")
- domain_provider: reference to table domain_provider; which provider is responsible for registration
- domain_registrar: who is the domain registrar (DENIC, EURID, etc.); same name as in domain_handle - IMPORTANT for Table domain_handle: e.g.: When the domain test.de is ordered only DENIC-Handles from the Customer are displayed and valid!
cheers
if you have any question you can contact me over the forum.
http://www.howtoforge.com/forums/member.php?u=50859
2009-04-11
\ No newline at end of file
<?php
/*
Copyright (c) 2007, Till Brehm, projektfarm Gmbh
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the name of ISPConfig nor the names of its contributors
may be used to endorse or promote products derived from this software without
specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/******************************************
* Begin Form configuration
******************************************/
$tform_def_file = "form/domain.tform.php";
/******************************************
* End Form configuration
******************************************/
require_once('../../lib/config.inc.php');
require_once('../../lib/app.inc.php');
//* Check permissions for module
$app->auth->check_module_permissions('domain');
// Loading classes
$app->uses('tpl,tform,tform_actions');
$app->load('tform_actions');
class page_action extends tform_actions {
function onShowNew() {
global $app, $conf;
if($_SESSION["s"]["user"]["typ"] != 'admin') {
$app->error($app->tform->wordbook["onlyforadmin_txt"]);
}
parent::onShowNew();
}
function onShowEnd() {
global $app, $conf;
if($_SESSION["s"]["user"]["typ"] != 'admin') {
$app->error($app->tform->wordbook["onlyforadmin_txt"]);
}
// Fill the client select field
$sql = "SELECT groupid, name FROM sys_group WHERE client_id > 0";
$clients = $app->db->queryAllRecords($sql);
$client_select = "<option value='0'></option>";
if(is_array($clients)) {
foreach( $clients as $client) {
$selected = @($client["groupid"] == $this->dataRecord["sys_groupid"])?'SELECTED':'';
$client_select .= "<option value='$client[groupid]' $selected>$client[name]</option>\r\n";
}
}
$app->tpl->setVar("client_group_id",$client_select);
parent::onShowEnd();
}
function onSubmit() {
global $app, $conf;
parent::onSubmit();
}
function onAfterInsert() {
global $app, $conf;
}
function onBeforeUpdate () {
global $app, $conf;
}
function onAfterUpdate() {
global $app, $conf;
}
function onAfterDelete() {
global $app, $conf;
}
}
$page = new page_action;
$page->onLoad();
?>
\ No newline at end of file
<?php
require_once('../../lib/config.inc.php');
require_once('../../lib/app.inc.php');
/******************************************
* Begin Form configuration
******************************************/
$list_def_file = "list/domain.list.php";
/******************************************
* End Form configuration
******************************************/
//* Check permissions for module
$app->auth->check_module_permissions('domain');
$app->uses('listform_actions');
$app->listform_actions->SQLOrderBy = 'ORDER BY domain';