[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Phpgroupware-cvs] CVS: sitemgr/setup tables_update.inc.php,1.11.2.2,1.
From: |
Michael Totschnig <address@hidden> |
Subject: |
[Phpgroupware-cvs] CVS: sitemgr/setup tables_update.inc.php,1.11.2.2,1.11.2.3 |
Date: |
Tue, 24 Jun 2003 15:21:28 -0400 |
Update of /cvsroot/phpgroupware/sitemgr/setup
In directory subversions:/tmp/cvs-serv30996
Modified Files:
Tag: Version-0_9_16-branch
tables_update.inc.php
Log Message:
simulate get_last_insert_id by selecting the inserted the row
Index: tables_update.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/sitemgr/setup/tables_update.inc.php,v
retrieving revision 1.11.2.2
retrieving revision 1.11.2.3
diff -C2 -r1.11.2.2 -r1.11.2.3
*** tables_update.inc.php 23 Jun 2003 20:43:06 -0000 1.11.2.2
--- tables_update.inc.php 24 Jun 2003 19:21:25 -0000 1.11.2.3
***************
*** 434,444 ****
//Create default site and hang all existing categories into it
! $db2->query("INSERT INTO phpgw_categories
(cat_parent,cat_owner,cat_access,cat_appname,cat_name,cat_description,last_mod)
VALUES (0,-1,'public','sitemgr','Default Website','This website has been added
by setup',0)");
! $site_id =
$db2->get_last_insert_id('phpgw_categories','cat_id');
! $db2->query("UPDATE phpgw_categories SET cat_main = $site_id
WHERE cat_appname = 'sitemgr'",__LINE__,__FILE__);
! $db2->query("UPDATE phpgw_categories SET cat_parent = $site_id
WHERE cat_appname = 'sitemgr' AND cat_parent = 0 AND cat_id !=
$site_id",__LINE__,__FILE__);
! $db2->query("UPDATE phpgw_categories SET cat_level = cat_level
+1 WHERE cat_appname = 'sitemgr' AND cat_id != $site_id",__LINE__,__FILE__);
! $db2->query("INSERT INTO phpgw_sitemgr_sites
(site_id,site_name) VALUES ($site_id,'Default Website')");
//insert values from old preferences table into new sites table
--- 434,448 ----
//Create default site and hang all existing categories into it
! $phpgw_setup->oProc->query("INSERT INTO phpgw_categories
(cat_parent,cat_owner,cat_access,cat_appname,cat_name,cat_description,last_mod)
VALUES (0,-1,'public','sitemgr','Default Website','This website has been added
by setup',0)");
+ $phpgw_setup->oProc->query("SELECT cat_id FROM phpgw_categories
WHERE cat_name='Default Website' AND cat_appname='sitemgr'");
+ if ($phpgw_setup->oProc->next_record())
+ {
+ $site_id = $value = $phpgw_setup->oProc->f('cat_id');
+ $db2->query("UPDATE phpgw_categories SET cat_main =
$site_id WHERE cat_appname = 'sitemgr'",__LINE__,__FILE__);
+ $db2->query("UPDATE phpgw_categories SET cat_parent =
$site_id WHERE cat_appname = 'sitemgr' AND cat_parent = 0 AND cat_id !=
$site_id",__LINE__,__FILE__);
+ $db2->query("UPDATE phpgw_categories SET cat_level =
cat_level +1 WHERE cat_appname = 'sitemgr' AND cat_id !=
$site_id",__LINE__,__FILE__);
+ $db2->query("INSERT INTO phpgw_sitemgr_sites
(site_id,site_name) VALUES ($site_id,'Default Website')");
+ }
//insert values from old preferences table into new sites table
***************
*** 455,506 ****
{
$phpgw_setup->oProc->query("SELECT value from
phpgw_sitemgr_preferences WHERE name = '$old'");
! $phpgw_setup->oProc->next_record();
! $value = $phpgw_setup->oProc->f('value');
! $db2->query("UPDATE phpgw_sitemgr_sites SET $new =
'$value' WHERE site_id = $site_id");
}
//site names and headers
! $db2->query("SELECT site_languages from phpgw_sitemgr_sites");
! if ($db2->next_record())
{
! $db2->f('site_languages');
! }
! $sitelanguages = $db2->f('site_languages');
! $sitelanguages = explode(',',$sitelanguages);
! $db2->query("SELECT module_id from phpgw_sitemgr_modules WHERE
module_name='html'");
! $db2->next_record();
! $html_module = $db2->f('module_id');
! $emptyarray = serialize(array());
! $db2->query("INSERT INTO phpgw_sitemgr_content
(area,cat_id,page_id,module_id,arguments,sort_order,viewable,actif) VALUES
('HEADER',$site_id,0,$html_module,'$emptyarray',0,0,1)",__LINE__,__FILE__);
! $headerblock =
$db2->get_last_insert_id('phpgw_sitemgr_content','block_id');
! $db2->query("INSERT INTO phpgw_sitemgr_content
(area,cat_id,page_id,module_id,arguments,sort_order,viewable,actif) VALUES
('FOOTER',$site_id,0,$html_module,'$emptyarray',0,0,1)",__LINE__,__FILE__);
! $footerblock =
$db2->get_last_insert_id('phpgw_sitemgr_content','block_id');
! foreach ($sitelanguages as $lang)
! {
! $db2->query("SELECT value from
phpgw_sitemgr_preferences WHERE name = 'sitemgr-site-name-$lang'");
! if ($db2->next_record())
! {
! $name_lang = $db2->f('value');
! $db2->query("INSERT INTO
phpgw_sitemgr_categories_lang (cat_id,lang,name) VALUES
($site_id,'$lang','$name_lang')");
! }
! $db2->query("SELECT value from
phpgw_sitemgr_preferences WHERE name = 'siteheader-$lang'");
! if ($db2->next_record())
{
! $header_lang = $db2->f('value');
! $content =
$db2->db_addslashes(serialize(array('htmlcontent' =>
stripslashes($header_lang))));
! $db2->query("INSERT INTO
phpgw_sitemgr_content_lang (block_id,lang,arguments_lang,title) VALUES
($headerblock,'$lang','$content','Site header')",__LINE__,__FILE__);
! }
! $db2->query("SELECT value from
phpgw_sitemgr_preferences WHERE name = 'sitefooter-$lang'");
! if ($db2->next_record())
! {
! $footer_lang = $db2->f('value');
! $content =
$db2->db_addslashes(serialize(array('htmlcontent' =>
stripslashes($footer_lang))));
! $db2->query("INSERT INTO
phpgw_sitemgr_content_lang (block_id,lang,arguments_lang,title) VALUES
($footerblock,'$lang','$content','Site footer')",__LINE__,__FILE__);
}
}
-
$phpgw_setup->oProc->DropTable('phpgw_sitemgr_preferences');
--- 459,510 ----
{
$phpgw_setup->oProc->query("SELECT value from
phpgw_sitemgr_preferences WHERE name = '$old'");
! if ($phpgw_setup->oProc->next_record())
! {
! $value = $phpgw_setup->oProc->f('value');
! $db2->query("UPDATE phpgw_sitemgr_sites SET
$new = '$value' WHERE site_id = $site_id");
! }
}
//site names and headers
! $phpgw_setup->oProc->query("SELECT site_languages from
phpgw_sitemgr_sites");
! if ($phpgw_setup->oProc->next_record())
{
! $sitelanguages = $db2->f('site_languages');
! $sitelanguages = explode(',',$sitelanguages);
! $db2->query("SELECT module_id from
phpgw_sitemgr_modules WHERE module_name='html'");
! $db2->next_record();
! $html_module = $db2->f('module_id');
! $emptyarray = serialize(array());
! $db2->query("INSERT INTO phpgw_sitemgr_content
(area,cat_id,page_id,module_id,arguments,sort_order,viewable,actif) VALUES
('HEADER',$site_id,0,$html_module,'$emptyarray',0,0,1)",__LINE__,__FILE__);
! $headerblock =
$db2->get_last_insert_id('phpgw_sitemgr_content','block_id');
! $db2->query("INSERT INTO phpgw_sitemgr_content
(area,cat_id,page_id,module_id,arguments,sort_order,viewable,actif) VALUES
('FOOTER',$site_id,0,$html_module,'$emptyarray',0,0,1)",__LINE__,__FILE__);
! $footerblock =
$db2->get_last_insert_id('phpgw_sitemgr_content','block_id');
! foreach ($sitelanguages as $lang)
{
! $db2->query("SELECT value from
phpgw_sitemgr_preferences WHERE name = 'sitemgr-site-name-$lang'");
! if ($db2->next_record())
! {
! $name_lang = $db2->f('value');
! $db2->query("INSERT INTO
phpgw_sitemgr_categories_lang (cat_id,lang,name) VALUES
($site_id,'$lang','$name_lang')");
! }
! $db2->query("SELECT value from
phpgw_sitemgr_preferences WHERE name = 'siteheader-$lang'");
! if ($db2->next_record())
! {
! $header_lang = $db2->f('value');
! $content =
$db2->db_addslashes(serialize(array('htmlcontent' =>
stripslashes($header_lang))));
! $db2->query("INSERT INTO
phpgw_sitemgr_content_lang (block_id,lang,arguments_lang,title) VALUES
($headerblock,'$lang','$content','Site header')",__LINE__,__FILE__);
! }
! $db2->query("SELECT value from
phpgw_sitemgr_preferences WHERE name = 'sitefooter-$lang'");
! if ($db2->next_record())
! {
! $footer_lang = $db2->f('value');
! $content =
$db2->db_addslashes(serialize(array('htmlcontent' =>
stripslashes($footer_lang))));
! $db2->query("INSERT INTO
phpgw_sitemgr_content_lang (block_id,lang,arguments_lang,title) VALUES
($footerblock,'$lang','$content','Site footer')",__LINE__,__FILE__);
! }
}
}
$phpgw_setup->oProc->DropTable('phpgw_sitemgr_preferences');
***************
*** 520,524 ****
'state',array('type'=>int, 'precision'=>2));
! $db2->query("UPDATE phpgw_sitemgr_pages SET state = 2");
$phpgw_setup->oProc->CreateTable('phpgw_sitemgr_categories_state',array(
--- 524,528 ----
'state',array('type'=>int, 'precision'=>2));
! $phpgw_setup->oProc->query("UPDATE phpgw_sitemgr_pages SET
state = 2");
$phpgw_setup->oProc->CreateTable('phpgw_sitemgr_categories_state',array(
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Phpgroupware-cvs] CVS: sitemgr/setup tables_update.inc.php,1.11.2.2,1.11.2.3,
Michael Totschnig <address@hidden> <=