tango
Member
Posts: 461
Joined: Jun 2007
Reputation: 0
|
RE: Probleme mit Dienste
I've just seen, there will be time to update and report
orginal
Code:
<?php
/**
* ispCP ω (OMEGA) a Virtual Hosting Control System
*
* @copyright 2001-2006 by moleSoftware GmbH
* @copyright 2006-2008 by ispCP | http://isp-control.net
* @version SVN: $Id$
* @link http://isp-control.net
* @author ispCP Team
*
* @license
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GPL General Public License
* as published by the Free Software Foundation; either version 2.0
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GPL General Public License for more details.
*
* You may have received a copy of the GPL General Public License
* along with this program.
*
* An on-line copy of the GPL General Public License can be found
* http://www.fsf.org/licensing/licenses/gpl.txt
**/
/*
* Get the current revision from the database and return it
*/
function getCurrentRevision() {
$sql = Database::getInstance();
$query = "SELECT * FROM `config` WHERE `name` = 'DATABASE_REVISION'";
$rs = $sql->Execute($query);
return (int)$rs->fields['value'];
}
/*
* Return the current revision + 1
*/
function getNextRevision() {
return getCurrentRevision() + 1;
}
/*
* Simple check for a new update
*/
function checkDatabaseUpdateExists() {
if(checkNewRevisionExists())
return true;
else
return false;
}
/*
* Check for existence of an available update
*/
function checkNewRevisionExists() {
$functionName = returnFunctionName(getNextRevision());
if(function_exists($functionName))
return true;
else
return false;
}
/*
* Combine the needed function name, and return it
*/
function returnFunctionName($revision) {
$functionName = "_databaseUpdate_" . $revision;
return $functionName;
}
/*
* Execute all available update functions.
*/
function executeDatabaseUpdates() {
$sql = Database::getInstance();
$failedUpdate = false;
while(checkNewRevisionExists()) {
// Get the next database update revision
$newRevision = getNextRevision();
// Get the needed function name
$functionName = returnFunctionName($newRevision);
// Pull the query from the update function using a variable function
$queryArray = $functionName();
// Add the query, to set the new Database Revision, to our queryArray
$queryArray[] = "UPDATE `config` SET `value` = '$newRevision' WHERE `name` = 'DATABASE_REVISION'";
// Start the Transaction
$sql->StartTrans();
// Execute every query in our queryArray
foreach($queryArray as $query) {
$sql->Execute($query);
}
// Set failedUpdate to true if an databaseUpdate failed
if ($sql->HasFailedTrans())
$failedUpdate = true;
// Complete the Transactin and rollback if nessessary
$sql->CompleteTrans();
// Display an error if nessessary
if($failedUpdate)
system_message(tr("Database update %s failed", $newRevision));
}
}
/*
* Insert the update functions below this entry. The revision has to be ascending and unique.
* Each databaseUpdate function has to return a array. Even if the array contains only one entry.
*/
/*
* Initital Update. Insert the first Revision.
*/
function _databaseUpdate_1() {
$sqlUpd = array();
$sqlUpd[] = "INSERT INTO `config` (name, value) VALUES ('DATABASE_REVISION' , '1')";
return $sqlUpd;
}
/*
* Updates the database fields ispcp.mail_users.mail_addr to the right mail address
* written by Christian Hernmarck, Feb 2008
* Since it does not delete or add any field, it may be run several times...
*/
function _databaseUpdate_2() {
$sqlUpd = array(); // we need several SQL Statements...
// domain mail + forward
$sqlUpd[] = "UPDATE `mail_users`, `domain`"
. "SET `mail_addr` = CONCAT(`mail_acc`,'@',`domain_name`)"
. "WHERE `mail_users`.`domain_id` = `domain`.`domain_id`"
. "AND (`mail_type` = 'normal_mail' OR `mail_type` = 'normal_forward');";
// domain-alias mail + forward
$sqlUpd[] = "UPDATE `mail_users`, `domain_aliasses`"
. "SET `mail_addr` = CONCAT(`mail_acc`,'@',`alias_name`)"
. "WHERE `mail_users`.`domain_id` = `domain_aliasses`.`domain_id` AND `mail_users`.`sub_id` = `domain_aliasses`.`alias_id`"
. "AND (`mail_type` = 'alias_mail' OR `mail_type` = 'alias_forward');";
// subdomain mail + forward
$sqlUpd[] = "UPDATE `mail_users`, `subdomain`, `domain`"
. "SET `mail_addr` = CONCAT(`mail_acc`,'@',`subdomain_name`,'.',`domain_name`)"
. "WHERE `mail_users`.`domain_id` = `subdomain`.`domain_id` AND `mail_users`.`sub_id` = `subdomain`.`subdomain_id`"
. "AND `mail_users`.`domain_id` = `domain`.`domain_id`"
. "AND (`mail_type` = 'subdom_mail' OR `mail_type` = 'subdom_forward');";
// domain catchall
$sqlUpd[] = "UPDATE `mail_users`, `domain`"
. "SET `mail_addr` = CONCAT('@',`domain_name`)"
. "WHERE `mail_users`.`domain_id` = `domain`.`domain_id`"
. "AND `mail_type` = 'normal_catchall';";
// domain-alias catchall
$sqlUpd[] = "UPDATE `mail_users`, `domain_aliasses`"
. "SET `mail_addr` = CONCAT('@',`alias_name`)"
. "WHERE `mail_users`.`domain_id` = `domain_aliasses`.`domain_id` AND `mail_users`.`sub_id` = `domain_aliasses`.`alias_id`"
. "AND `mail_type` = 'alias_catchall';";
// subdomain catchall
$sqlUpd[] = "UPDATE `mail_users`, `subdomain`, `domain`"
. "SET `mail_addr` = CONCAT('@',`subdomain_name`,'.',`domain_name`)"
. "WHERE `mail_users`.`domain_id` = `subdomain`.`domain_id` AND `mail_users`.`sub_id` = `subdomain`.`subdomain_id`"
. "AND `mail_users`.`domain_id` = `domain`.`domain_id`"
. "AND `mail_type` = 'subdom_catchall';";
return $sqlUpd;
}
/*
* Fix for ticket #1139 http://www.isp-control.net/ispcp/ticket/1139 (Benedikt Heintel, 2008-03-27)
*/
function _databaseUpdate_3() {
$sqlUpd = array();
$sqlUpd[] = "ALTER IGNORE TABLE `orders_settings` CHANGE `id` `id` int(10) unsigned NOT NULL auto_increment;";
return $sqlUpd;
}
/*
* Fix for ticket #1196 http://www.isp-control.net/ispcp/ticket/1196 (Benedikt Heintel, 2008-04-23)
*/
function _databaseUpdate_4() {
$sqlUpd = array();
$sqlUpd[] = "ALTER IGNORE TABLE `mail_users` CHANGE `mail_auto_respond` `mail_auto_respond_text` text collate utf8_unicode_ci;";
$sqlUpd[] = "ALTER IGNORE TABLE `mail_users` ADD `mail_auto_respond` BOOL NOT NULL default '0' AFTER `status`;";
$sqlUpd[] = "ALTER IGNORE TABLE `mail_users` CHANGE `mail_type` `mail_type` varchar(30);";
return $sqlUpd;
}
/*
* Fix for ticket #1346 http://www.isp-control.net/ispcp/ticket/1346 (Benedikt Heintel, 2008-06-13)
*/
function _databaseUpdate_5() {
$sqlUpd = array();
$sqlUpd[] = "ALTER IGNORE TABLE `sql_user` CHANGE `sqlu_name` `sqlu_name` varchar(64) binary DEFAULT 'n/a';";
$sqlUpd[] = "ALTER IGNORE TABLE `sql_user` CHANGE `sqlu_pass` `sqlu_pass` varchar(64) binary DEFAULT 'n/a';";
return $sqlUpd;
}
/*
* Fix for ticket #755 http://www.isp-control.net/ispcp/ticket/755 (Markus Milkereit, 2008-07-20)
*/
function _databaseUpdate_6() {
$sqlUpd = array();
$sqlUpd[] = "ALTER IGNORE TABLE `htaccess`
CHANGE `user_id` `user_id` VARCHAR(255) NULL DEFAULT NULL,
CHANGE `group_id` `group_id` VARCHAR(255) NULL DEFAULT NULL";
return $sqlUpd;
}
?>
is 235 lines and in the Changeset 1508 you written
Code:
275 275 }
276 276
277 /**
278 * Fix for ticket #1664 http://www.isp-control.net/ispcp/ticket/1610.
279 *
280 * @author Daniel Andreca
281 * @copyright 2006-2008 by ispCP | http://isp-control.net
282 * @version 1.0
283 * @since r1508
284 *
285 * @access protected
286 * @return sql statements to be performed
287 */
288 protected function _databaseUpdate_10() {
289 $sqlUpd = array();
290 $sqlUpd[] = "UPDATE `config` SET `value` = CONCAT( `value`, ';' ) WHERE `name` LIKE \"PORT_%\"";
291 $sqlUpd[] = "UPDATE `config` SET `value` = CONCAT( `value`, 'localhost' ) WHERE `name` IN (\"PORT_POSTGREY\", \"PORT_AMAVIS\", \"PORT_SPAMASSASSIN\", \"PORT_POLICYD-WEIGHT\")";
292
293 return $sqlUpd;
294 }
295
277 296 /*
278 297 * DO NOT CHANGE ANYTHING BELOW THIS LINE!
modifited file
Code:
<?php
/**
* ispCP ω (OMEGA) a Virtual Hosting Control System
*
* @copyright 2001-2006 by moleSoftware GmbH
* @copyright 2006-2008 by ispCP | http://isp-control.net
* @version SVN: $Id$
* @link http://isp-control.net
* @author ispCP Team
*
* @license
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GPL General Public License
* as published by the Free Software Foundation; either version 2.0
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GPL General Public License for more details.
*
* You may have received a copy of the GPL General Public License
* along with this program.
*
* An on-line copy of the GPL General Public License can be found
* http://www.fsf.org/licensing/licenses/gpl.txt
**/
/**
* Implementing abstract class ispcpUpdate for database update functions
*
* @author Daniel Andreca <sci2tech@gmail.com>
* @copyright 2006-2008 by ispCP | http://isp-control.net
* @version 1.0
* @since r1355
*/
class databaseUpdate extends ispcpUpdate{
protected $databaseVariableName="DATABASE_REVISION";
protected $functionName="_databaseUpdate_";
protected $errorMessage="Database update %s failed";
public static function getInstance() {
static $instance=null;
if($instance===null)$instance= new self();
return $instance;
}
/*
* Insert the update functions below this entry. The revision has to be ascending and unique.
* Each databaseUpdate function has to return a array. Even if the array contains only one entry.
*/
/**
* Initital Update. Insert the first Revision.
*
* @author Jochen Manz <zothos@zothos.net>
* @copyright 2006-2008 by ispCP | http://isp-control.net
* @version 1.0
* @since r1355
*
* @access protected
* @return sql statements to be performed
*/
protected function _databaseUpdate_1() {
$sqlUpd = array();
$sqlUpd[] = "INSERT INTO `config` (name, value) VALUES ('DATABASE_REVISION' , '1')";
return $sqlUpd;
}
/**
* Updates the database fields ispcp.mail_users.mail_addr to the right mail address.
*
* @author Christian Hernmarck
* @copyright 2006-2008 by ispCP | http://isp-control.net
* @version 1.0
* @since r1355
*
* @access protected
* @return sql statements to be performed
*/
protected function _databaseUpdate_2() {
$sqlUpd = array(); // we need several SQL Statements...
// domain mail + forward
$sqlUpd[] = "UPDATE `mail_users`, `domain`"
. "SET `mail_addr` = CONCAT(`mail_acc`,'@',`domain_name`)"
. "WHERE `mail_users`.`domain_id` = `domain`.`domain_id`"
. "AND (`mail_type` = 'normal_mail' OR `mail_type` = 'normal_forward');";
// domain-alias mail + forward
$sqlUpd[] = "UPDATE `mail_users`, `domain_aliasses`"
. "SET `mail_addr` = CONCAT(`mail_acc`,'@',`alias_name`)"
. "WHERE `mail_users`.`domain_id` = `domain_aliasses`.`domain_id` AND `mail_users`.`sub_id` = `domain_aliasses`.`alias_id`"
. "AND (`mail_type` = 'alias_mail' OR `mail_type` = 'alias_forward');";
// subdomain mail + forward
$sqlUpd[] = "UPDATE `mail_users`, `subdomain`, `domain`"
. "SET `mail_addr` = CONCAT(`mail_acc`,'@',`subdomain_name`,'.',`domain_name`)"
. "WHERE `mail_users`.`domain_id` = `subdomain`.`domain_id` AND `mail_users`.`sub_id` = `subdomain`.`subdomain_id`"
. "AND `mail_users`.`domain_id` = `domain`.`domain_id`"
. "AND (`mail_type` = 'subdom_mail' OR `mail_type` = 'subdom_forward');";
// domain catchall
$sqlUpd[] = "UPDATE `mail_users`, `domain`"
. "SET `mail_addr` = CONCAT('@',`domain_name`)"
. "WHERE `mail_users`.`domain_id` = `domain`.`domain_id`"
. "AND `mail_type` = 'normal_catchall';";
// domain-alias catchall
$sqlUpd[] = "UPDATE `mail_users`, `domain_aliasses`"
. "SET `mail_addr` = CONCAT('@',`alias_name`)"
. "WHERE `mail_users`.`domain_id` = `domain_aliasses`.`domain_id` AND `mail_users`.`sub_id` = `domain_aliasses`.`alias_id`"
. "AND `mail_type` = 'alias_catchall';";
// subdomain catchall
$sqlUpd[] = "UPDATE `mail_users`, `subdomain`, `domain`"
. "SET `mail_addr` = CONCAT('@',`subdomain_name`,'.',`domain_name`)"
. "WHERE `mail_users`.`domain_id` = `subdomain`.`domain_id` AND `mail_users`.`sub_id` = `subdomain`.`subdomain_id`"
. "AND `mail_users`.`domain_id` = `domain`.`domain_id`"
. "AND `mail_type` = 'subdom_catchall';";
return $sqlUpd;
}
/**
* Fix for ticket #1139 http://www.isp-control.net/ispcp/ticket/1139.
*
* @author Benedikt Heintel
* @copyright 2006-2008 by ispCP | http://isp-control.net
* @version 1.0
* @since r1355
*
* @access protected
* @return sql statements to be performed
*/
protected function _databaseUpdate_3() {
$sqlUpd = array();
$sqlUpd[] = "ALTER IGNORE TABLE `orders_settings` CHANGE `id` `id` int(10) unsigned NOT NULL auto_increment;";
return $sqlUpd;
}
/**
* Fix for ticket #1196 http://www.isp-control.net/ispcp/ticket/1196.
*
* @author Benedikt Heintel
* @copyright 2006-2008 by ispCP | http://isp-control.net
* @version 1.0
* @since r1355
*
* @access protected
* @return sql statements to be performed
*/
protected function _databaseUpdate_4() {
$sqlUpd = array();
$sqlUpd[] = "ALTER IGNORE TABLE `mail_users` CHANGE `mail_auto_respond` `mail_auto_respond_text` text collate utf8_unicode_ci;";
$sqlUpd[] = "ALTER IGNORE TABLE `mail_users` ADD `mail_auto_respond` BOOL NOT NULL default '0' AFTER `status`;";
$sqlUpd[] = "ALTER IGNORE TABLE `mail_users` CHANGE `mail_type` `mail_type` varchar(30);";
return $sqlUpd;
}
/**
* Fix for ticket #1346 http://www.isp-control.net/ispcp/ticket/1346.
*
* @author Benedikt Heintel
* @copyright 2006-2008 by ispCP | http://isp-control.net
* @version 1.0
* @since r1355
*
* @access protected
* @return sql statements to be performed
*/
protected function _databaseUpdate_5() {
$sqlUpd = array();
$sqlUpd[] = "ALTER IGNORE TABLE `sql_user` CHANGE `sqlu_name` `sqlu_name` varchar(64) binary DEFAULT 'n/a';";
$sqlUpd[] = "ALTER IGNORE TABLE `sql_user` CHANGE `sqlu_pass` `sqlu_pass` varchar(64) binary DEFAULT 'n/a';";
return $sqlUpd;
}
/**
* Fix for ticket #755 http://www.isp-control.net/ispcp/ticket/755.
*
* @author Markus Milkereit
* @copyright 2006-2008 by ispCP | http://isp-control.net
* @version 1.0
* @since r1355
*
* @access protected
* @return sql statements to be performed
*/
protected function _databaseUpdate_6() {
$sqlUpd = array();
$sqlUpd[] = "ALTER IGNORE TABLE `htaccess`
CHANGE `user_id` `user_id` VARCHAR(255) NULL DEFAULT NULL,
CHANGE `group_id` `group_id` VARCHAR(255) NULL DEFAULT NULL";
return $sqlUpd;
}
/**
* Fix for ticket #1509 http://www.isp-control.net/ispcp/ticket/1509.
*
* @author Benedikt Heintel
* @copyright 2006-2008 by ispCP | http://isp-control.net
* @version 1.0
* @since r1356
*
* @access protected
* @return sql statements to be performed
*/
protected function _databaseUpdate_7() {
$sqlUpd = array();
$sqlUpd[] = "DROP TABLE IF EXISTS `subdomain_alias`";
$sqlUpd[] = "CREATE TABLE IF NOT EXISTS `subdomain_alias` (
`subdomain_alias_id` int(10) unsigned NOT NULL auto_increment,
`alias_id` int(10) unsigned default NULL,
`subdomain_alias_name` varchar(200) collate utf8_unicode_ci default NULL,
`subdomain_alias_mount` varchar(200) collate utf8_unicode_ci default NULL,
`subdomain_alias_status` varchar(255) collate utf8_unicode_ci default NULL,
PRIMARY KEY (`subdomain_alias_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;";
return $sqlUpd;
}
/**
* Fix for ticket #1571 http://www.isp-control.net/ispcp/ticket/1571.
*
* @author Daniel Andreca
* @copyright 2006-2008 by ispCP | http://isp-control.net
* @version 1.0
* @since r1417
* @removed r1418
*
* @access protected
* @return sql statements to be performed
*/
protected function _databaseUpdate_8() {
$sqlUpd = array();
//moved to critical because we need to run engine request
return $sqlUpd;
}
/**
* Fix for ticket #1610 http://www.isp-control.net/ispcp/ticket/1610.
*
* @author Daniel Andreca
* @copyright 2006-2008 by ispCP | http://isp-control.net
* @version 1.0
* @since r1462
*
* @access protected
* @return sql statements to be performed
*/
protected function _databaseUpdate_9() {
$sqlUpd = array();
$sqlUpd[] = "ALTER TABLE `mail_users`
CHANGE `mail_acc` `mail_acc` VARCHAR(200) CHARACTER SET utf8 COLLATE utf8_unicode_ci NULL DEFAULT NULL,
CHANGE `mail_pass` `mail_pass` VARCHAR(150) CHARACTER SET utf8 COLLATE utf8_unicode_ci NULL DEFAULT NULL,
CHANGE `mail_forward` `mail_forward` TEXT CHARACTER SET utf8 COLLATE utf8_unicode_ci NULL DEFAULT NULL,
CHANGE `mail_type` `mail_type` VARCHAR(30) CHARACTER SET utf8 COLLATE utf8_unicode_ci NULL DEFAULT NULL,
CHANGE `status` `status` VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci NULL DEFAULT NULL";
return $sqlUpd;
}
/**
* Fix for ticket #1664 http://www.isp-control.net/ispcp/ticket/1610.
*
* @author Daniel Andreca
* @copyright 2006-2008 by ispCP | http://isp-control.net
* @version 1.0
* @since r1508
*
* @access protected
* @return sql statements to be performed
*/
protected function _databaseUpdate_10() {
$sqlUpd = array();
$sqlUpd[] = "UPDATE `config` SET `value` = CONCAT( `value`, ';' ) WHERE `name` LIKE \"PORT_%\"";
$sqlUpd[] = "UPDATE `config` SET `value` = CONCAT( `value`, 'localhost' ) WHERE `name` IN (\"PORT_POSTGREY\", \"PORT_AMAVIS\", \"PORT_SPAMASSASSIN\", \"PORT_POLICYD-WEIGHT\")";
return $sqlUpd;
}
/*
* DO NOT CHANGE ANYTHING BELOW THIS LINE!
*/
}
?>
screenshot
http://alleslegal.net/fehler.png
(This post was last modified: 02-17-2009 09:06 AM by tango.)
|
|