forked from extern/egroupware
ported app-registration functions to new db-functions, as the applications tables contains a text column which need special treatment for MaxDB
This commit is contained in:
parent
2f488b17a1
commit
4420445e55
@ -19,6 +19,8 @@
|
|||||||
class setup
|
class setup
|
||||||
{
|
{
|
||||||
var $db;
|
var $db;
|
||||||
|
var $config_table = 'phpgw_config';
|
||||||
|
var $applications_table = 'phpgw_applications';
|
||||||
var $oProc;
|
var $oProc;
|
||||||
|
|
||||||
var $detection = '';
|
var $detection = '';
|
||||||
@ -71,6 +73,8 @@
|
|||||||
$this->db->Database = $GLOBALS['phpgw_domain'][$this->ConfigDomain]['db_name'];
|
$this->db->Database = $GLOBALS['phpgw_domain'][$this->ConfigDomain]['db_name'];
|
||||||
$this->db->User = $GLOBALS['phpgw_domain'][$this->ConfigDomain]['db_user'];
|
$this->db->User = $GLOBALS['phpgw_domain'][$this->ConfigDomain]['db_user'];
|
||||||
$this->db->Password = $GLOBALS['phpgw_domain'][$this->ConfigDomain]['db_pass'];
|
$this->db->Password = $GLOBALS['phpgw_domain'][$this->ConfigDomain]['db_pass'];
|
||||||
|
|
||||||
|
$this->db->set_app('phpgwapi');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -388,11 +392,7 @@
|
|||||||
*/
|
*/
|
||||||
if($this->alessthanb($setup_info['phpgwapi']['currentver'],'0.9.10pre8') && ($setup_info['phpgwapi']['currentver'] != ''))
|
if($this->alessthanb($setup_info['phpgwapi']['currentver'],'0.9.10pre8') && ($setup_info['phpgwapi']['currentver'] != ''))
|
||||||
{
|
{
|
||||||
$appstbl = 'applications';
|
$this->applications_table = 'applications';
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$appstbl = 'phpgw_applications';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if($GLOBALS['DEBUG'])
|
if($GLOBALS['DEBUG'])
|
||||||
@ -409,24 +409,24 @@
|
|||||||
}
|
}
|
||||||
if ($setup_info[$appname]['tables_use_prefix'] == True)
|
if ($setup_info[$appname]['tables_use_prefix'] == True)
|
||||||
{
|
{
|
||||||
echo $setup_info[$appname]['name'] . ' uses tables_use_prefix, storing '
|
if($GLOBALS['DEBUG'])
|
||||||
. $setup_info[$appname]['tables_prefix']
|
{
|
||||||
. ' as prefix for ' . $setup_info[$appname]['name'] . " tables\n";
|
echo "<br>$appname uses tables_use_prefix, storing ". $setup_info[$appname]['tables_prefix']." as prefix for tables\n";
|
||||||
|
}
|
||||||
$sql = "INSERT INTO phpgw_config (config_app,config_name,config_value) "
|
$this->db->insert($this->config_table,array(
|
||||||
."VALUES ('".$setup_info[$appname]['name']."','"
|
'config_app' => $appname,
|
||||||
.$appname."_tables_prefix','".$setup_info[$appname]['tables_prefix']."')";
|
'config_name' => $appname.'_tables_prefix',
|
||||||
$this->db->query($sql,__LINE__,__FILE__);
|
'config_value' => $setup_info[$appname]['tables_prefix'],
|
||||||
|
),False,__LINE__,__FILE__);
|
||||||
}
|
}
|
||||||
$this->db->query("INSERT INTO $appstbl "
|
$this->db->insert($this->applications_table,array(
|
||||||
. "(app_name,app_enabled,app_order,app_tables,app_version) "
|
'app_name' => $appname,
|
||||||
. "VALUES ("
|
'app_enabled' => $enable,
|
||||||
. "'" . $setup_info[$appname]['name'] . "',"
|
'app_order' => $setup_info[$appname]['app_order'],
|
||||||
. $enable . ","
|
'app_tables' => $tables,
|
||||||
. (int)$setup_info[$appname]['app_order'] . ","
|
'app_version' => $setup_info[$appname]['version'],
|
||||||
. "'" . $tables . "',"
|
),False,__LINE__,__FILE__);
|
||||||
. "'" . $setup_info[$appname]['version'] . "')"
|
|
||||||
);
|
|
||||||
$this->clear_session_cache();
|
$this->clear_session_cache();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -448,20 +448,16 @@
|
|||||||
|
|
||||||
if($this->alessthanb($setup_info['phpgwapi']['currentver'],'0.9.10pre8') && ($setup_info['phpgwapi']['currentver'] != ''))
|
if($this->alessthanb($setup_info['phpgwapi']['currentver'],'0.9.10pre8') && ($setup_info['phpgwapi']['currentver'] != ''))
|
||||||
{
|
{
|
||||||
$appstbl = 'applications';
|
$this->applications_table = 'applications';
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$appstbl = 'phpgw_applications';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(@$GLOBALS['DEBUG'])
|
if(@$GLOBALS['DEBUG'])
|
||||||
{
|
{
|
||||||
echo '<br>app_registered(): checking ' . $appname . ', table: ' . $appstbl;
|
echo '<br>app_registered(): checking ' . $appname . ', table: ' . $this->applications_table;
|
||||||
// _debug_array($setup_info[$appname]);
|
// _debug_array($setup_info[$appname]);
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->db->query("SELECT COUNT(app_name) FROM $appstbl WHERE app_name='".$appname."'");
|
$this->db->select($this->applications_table,'COUNT(*)',array('app_name' => $appname),__LINE__,__FILE__);
|
||||||
$this->db->next_record();
|
$this->db->next_record();
|
||||||
if($this->db->f(0))
|
if($this->db->f(0))
|
||||||
{
|
{
|
||||||
@ -495,22 +491,16 @@
|
|||||||
|
|
||||||
if($this->alessthanb($setup_info['phpgwapi']['currentver'],'0.9.10pre8') && ($setup_info['phpgwapi']['currentver'] != ''))
|
if($this->alessthanb($setup_info['phpgwapi']['currentver'],'0.9.10pre8') && ($setup_info['phpgwapi']['currentver'] != ''))
|
||||||
{
|
{
|
||||||
$appstbl = 'applications';
|
$this->applications_table = 'applications';
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$appstbl = 'phpgw_applications';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if($GLOBALS['DEBUG'])
|
if($GLOBALS['DEBUG'])
|
||||||
{
|
{
|
||||||
echo '<br>update_app(): ' . $appname . ', version: ' . $setup_info[$appname]['currentver'] . ', table: ' . $appstbl . '<br>';
|
echo '<br>update_app(): ' . $appname . ', version: ' . $setup_info[$appname]['currentver'] . ', table: ' . $this->applications_table . '<br>';
|
||||||
// _debug_array($setup_info[$appname]);
|
// _debug_array($setup_info[$appname]);
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->db->query("SELECT COUNT(app_name) FROM $appstbl WHERE app_name='".$appname."'");
|
if(!$this->app_registered($appname))
|
||||||
$this->db->next_record();
|
|
||||||
if(!$this->db->f(0))
|
|
||||||
{
|
{
|
||||||
return False;
|
return False;
|
||||||
}
|
}
|
||||||
@ -522,17 +512,12 @@
|
|||||||
{
|
{
|
||||||
$tables = implode(',',$setup_info[$appname]['tables']);
|
$tables = implode(',',$setup_info[$appname]['tables']);
|
||||||
}
|
}
|
||||||
|
$this->db->update($this->applications_table,array(
|
||||||
$sql = "UPDATE $appstbl "
|
'app_enabled' => $setup_info[$appname]['enable'],
|
||||||
. "SET app_name='" . $setup_info[$appname]['name'] . "',"
|
'app_order' => $setup_info[$appname]['app_order'],
|
||||||
. " app_enabled=" . (int)$setup_info[$appname]['enable'] . ","
|
'app_tables' => $tables,
|
||||||
. " app_order=" . (int)$setup_info[$appname]['app_order'] . ","
|
'app_version' => $setup_info[$appname]['version'],
|
||||||
. " app_tables='" . $tables . "',"
|
),array('app_name'=>$appname),__LINE__,__FILE__);
|
||||||
. " app_version='" . $setup_info[$appname]['version'] . "'"
|
|
||||||
. " WHERE app_name='" . $appname . "'";
|
|
||||||
//echo $sql; exit;
|
|
||||||
|
|
||||||
$this->db->query($sql);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -552,11 +537,7 @@
|
|||||||
|
|
||||||
if($this->alessthanb($setup_info['phpgwapi']['currentver'],'0.9.10pre8') && ($setup_info['phpgwapi']['currentver'] != ''))
|
if($this->alessthanb($setup_info['phpgwapi']['currentver'],'0.9.10pre8') && ($setup_info['phpgwapi']['currentver'] != ''))
|
||||||
{
|
{
|
||||||
$appstbl = 'applications';
|
$this->applications_table = 'applications';
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$appstbl = 'phpgw_applications';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if($tableschanged == True)
|
if($tableschanged == True)
|
||||||
@ -565,7 +546,9 @@
|
|||||||
}
|
}
|
||||||
if($setup_info[$appname]['currentver'])
|
if($setup_info[$appname]['currentver'])
|
||||||
{
|
{
|
||||||
$this->db->query("UPDATE $appstbl SET app_version='" . $setup_info[$appname]['currentver'] . "' WHERE app_name='".$appname."'");
|
$this->db->update($this->applications_table,array(
|
||||||
|
'app_version' => $setup_info[$appname]['currentver'],
|
||||||
|
),array('app_name'=>$appname),__LINE__,__FILE__);
|
||||||
}
|
}
|
||||||
return $setup_info;
|
return $setup_info;
|
||||||
}
|
}
|
||||||
@ -585,15 +568,11 @@
|
|||||||
|
|
||||||
if($this->alessthanb($setup_info['phpgwapi']['currentver'],'0.9.10pre8') && ($setup_info['phpgwapi']['currentver'] != ''))
|
if($this->alessthanb($setup_info['phpgwapi']['currentver'],'0.9.10pre8') && ($setup_info['phpgwapi']['currentver'] != ''))
|
||||||
{
|
{
|
||||||
$appstbl = 'applications';
|
$this->applications_table = 'applications';
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$appstbl = 'phpgw_applications';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//echo 'DELETING application: ' . $appname;
|
//echo 'DELETING application: ' . $appname;
|
||||||
$this->db->query("DELETE FROM $appstbl WHERE app_name='". $appname ."'");
|
$this->db->delete($this->applications_table,array('app_name'=>$appname),__LINE__,__FILE__);
|
||||||
$this->clear_session_cache();
|
$this->clear_session_cache();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user