[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Phpgroupware-cvs] CVS: sitemgr/setup default_records.inc.php,1.5,1.6 se
From: |
Michael Totschnig <address@hidden> |
Subject: |
[Phpgroupware-cvs] CVS: sitemgr/setup default_records.inc.php,1.5,1.6 setup.inc.php,1.13,1.14 tables_current.inc.php,1.12,1.13 tables_update.inc.php,1.12,1.13 |
Date: |
Fri, 30 May 2003 00:01:45 -0400 |
Update of /cvsroot/phpgroupware/sitemgr/setup
In directory subversions:/tmp/cvs-serv4975/setup
Modified Files:
default_records.inc.php setup.inc.php tables_current.inc.php
tables_update.inc.php
Log Message:
make sitemgr capable of handling versions
Index: default_records.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/sitemgr/setup/default_records.inc.php,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -r1.5 -r1.6
*** default_records.inc.php 23 May 2003 03:37:25 -0000 1.5
--- default_records.inc.php 30 May 2003 04:01:43 -0000 1.6
***************
*** 1,4 ****
<?php
! $oProc->query("INSERT INTO phpgw_categories
(cat_parent,cat_owner,cat_access,cat_appname,cat_name,cat_description) VALUES
(0,-1,'public','sitemgr','Default Website','This website has been add by
setup')");
$site_id =
$oProc->m_odb->get_last_insert_id('phpgw_categories','cat_id');
$oProc->query("UPDATE phpgw_categories SET cat_main = $site_id WHERE
cat_id = $site_id",__LINE__,__FILE__);
--- 1,4 ----
<?php
! $oProc->query("INSERT INTO phpgw_categories
(cat_parent,cat_owner,cat_access,cat_appname,cat_name,cat_description) VALUES
(0,-1,'public','sitemgr','Default Website','This website has been added by
setup')");
$site_id =
$oProc->m_odb->get_last_insert_id('phpgw_categories','cat_id');
$oProc->query("UPDATE phpgw_categories SET cat_main = $site_id WHERE
cat_id = $site_id",__LINE__,__FILE__);
Index: setup.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/sitemgr/setup/setup.inc.php,v
retrieving revision 1.13
retrieving revision 1.14
diff -C2 -r1.13 -r1.14
*** setup.inc.php 22 May 2003 02:36:54 -0000 1.13
--- setup.inc.php 30 May 2003 04:01:43 -0000 1.14
***************
*** 14,20 ****
$setup_info['sitemgr']['name'] = 'sitemgr';
$setup_info['sitemgr']['title'] = 'SiteMgr Web Content Manager';
! $setup_info['sitemgr']['version'] = '0.9.15.004';
$setup_info['sitemgr']['app_order'] = 8;
! $setup_info['sitemgr']['tables'] =
array('phpgw_sitemgr_pages','phpgw_sitemgr_pages_lang','phpgw_sitemgr_categories_lang','phpgw_sitemgr_sites','phpgw_sitemgr_modules','phpgw_sitemgr_content','phpgw_sitemgr_content_lang','phpgw_sitemgr_active_modules','phpgw_sitemgr_properties');
$setup_info['sitemgr']['enable'] = 1;
--- 14,25 ----
$setup_info['sitemgr']['name'] = 'sitemgr';
$setup_info['sitemgr']['title'] = 'SiteMgr Web Content Manager';
! $setup_info['sitemgr']['version'] = '0.9.15.005';
$setup_info['sitemgr']['app_order'] = 8;
! $setup_info['sitemgr']['tables'] = array(
!
'phpgw_sitemgr_sites','phpgw_sitemgr_categories_state','phpgw_sitemgr_categories_lang',
!
'phpgw_sitemgr_pages','phpgw_sitemgr_pages_lang','phpgw_sitemgr_blocks','phpgw_sitemgr_blocks_lang',
! 'phpgw_sitemgr_content','phpgw_sitemgr_content_lang',
!
'phpgw_sitemgr_modules','phpgw_sitemgr_active_modules','phpgw_sitemgr_properties'
! );
$setup_info['sitemgr']['enable'] = 1;
Index: tables_current.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/sitemgr/setup/tables_current.inc.php,v
retrieving revision 1.12
retrieving revision 1.13
diff -C2 -r1.12 -r1.13
*** tables_current.inc.php 22 May 2003 02:36:54 -0000 1.12
--- tables_current.inc.php 30 May 2003 04:01:43 -0000 1.13
***************
*** 20,23 ****
--- 20,26 ----
'hide_page' => array('type' => 'int',
'precision' => 4),
'name' => array('type' => 'varchar',
'precision' => 100),
+ //one of constants SITEMGR_STATE_DRAFT,
SITEMGR_STATE_PREPUBLISH, SITEMGR_STATE_PUBLISH,
+ //SITEMGR_STATE_PREUNPUBLISH,
SITEMGR_STATE_ARCHIVE
+ 'state' => array('type' => 'int', 'precision'
=> 2)
),
'pk' => array('page_id'),
***************
*** 38,41 ****
--- 41,54 ----
'uc' => array()
),
+ 'phpgw_sitemgr_categories_state' => array(
+ 'fd' => array(
+ 'cat_id' => array('type' => 'int', 'precision'
=> 4, 'nullable' => false),
+ 'state' => array('type' => 'int', 'precision'
=> 2)
+ ),
+ 'pk' => array('cat_id'),
+ 'fk' => array(),
+ 'ix' => array(),
+ 'uc' => array()
+ ),
'phpgw_sitemgr_categories_lang' => array(
'fd' => array(
***************
*** 50,65 ****
'uc' => array()
),
- // 'phpgw_sitemgr_preferences' => array(
- // 'fd' => array(
- // 'pref_id' => array('type' => 'auto', 'nullable'
=> false),
- // 'name' => array('type' => 'varchar',
'precision' => 255),
- // 'value' => array('type' => 'text'),
- // 'site_id' => array('type' => 'int', 'precision'
=> 4, 'nullable' => false),
- // ),
- // 'pk' => array('pref_id'),
- // 'fk' => array(),
- // 'ix' => array(),
- // 'uc' => array()
- // ),
'phpgw_sitemgr_modules' => array(
'fd' => array(
--- 63,66 ----
***************
*** 73,88 ****
'uc' => array()
),
! 'phpgw_sitemgr_content' => array(
'fd' => array(
'block_id' => array('type' => 'auto',
'nullable' => false),
'area' => array('type' => 'varchar',
'precision' => 50),
! //if page_id != NULL scope=page, elseif cat_id
!= NULL scope=category, else scope=site
'cat_id' => array('type' => 'int', 'precision'
=> 4),
'page_id' => array('type' => 'int', 'precision'
=> 4),
'module_id' => array('type' => 'int',
'precision' => 4, 'nullable' => false),
- 'arguments' => array('type' => 'text'),
'sort_order' => array('type' => 'int',
'precision' => 4),
'viewable' => array('type' => 'int',
'precision' => 4),
- 'actif' => array('type' => 'int', 'precision'
=> 2)
),
'pk' => array('block_id'),
--- 74,87 ----
'uc' => array()
),
! 'phpgw_sitemgr_blocks' => array(
'fd' => array(
'block_id' => array('type' => 'auto',
'nullable' => false),
'area' => array('type' => 'varchar',
'precision' => 50),
! //if page_id != NULL scope=page, elseif cat_id
!= CURRENT_SITE_ID scope=category, else scope=site
'cat_id' => array('type' => 'int', 'precision'
=> 4),
'page_id' => array('type' => 'int', 'precision'
=> 4),
'module_id' => array('type' => 'int',
'precision' => 4, 'nullable' => false),
'sort_order' => array('type' => 'int',
'precision' => 4),
'viewable' => array('type' => 'int',
'precision' => 4),
),
'pk' => array('block_id'),
***************
*** 91,102 ****
'uc' => array()
),
! 'phpgw_sitemgr_content_lang' => array(
'fd' => array(
! 'block_id' => array('type' => 'int',
'precision' => 4, 'nullable' => false),
'lang' => array('type' => 'varchar',
'precision' => 2, 'nullable' => false),
- 'arguments_lang' => array('type' => 'text'),
'title' => array('type' => 'varchar',
'precision' => 255),
),
'pk' => array('block_id','lang'),
'fk' => array(),
'ix' => array(),
--- 90,124 ----
'uc' => array()
),
! 'phpgw_sitemgr_blocks_lang' => array(
'fd' => array(
! 'block_id' => array('type' => 'auto',
'nullable' => false),
'lang' => array('type' => 'varchar',
'precision' => 2, 'nullable' => false),
'title' => array('type' => 'varchar',
'precision' => 255),
),
'pk' => array('block_id','lang'),
+ 'fk' => array(),
+ 'ix' => array(),
+ 'uc' => array()
+ ),
+ 'phpgw_sitemgr_content' => array(
+ 'fd' => array(
+ 'version_id' => array('type' => 'auto',
'nullable' => false),
+ 'block_id' => array('type' => 'int',
'precision' => 4, 'nullable' => false),
+ 'arguments' => array('type' => 'text'),
+ //one of constants SITEMGR_STATE_PUBLISH,
SITEMGR_STATE_PREPUBLISH, SITEMGR_STATE_PREUNPUBLISH, SITEMGR_STATE_DRAFT
+ 'state' => array('type' => 'int', 'precision'
=> 2)
+ ),
+ 'pk' => array('version_id'),
+ 'fk' => array(),
+ 'ix' => array(),
+ 'uc' => array()
+ ),
+ 'phpgw_sitemgr_content_lang' => array(
+ 'fd' => array(
+ 'version_id' => array('type' => 'int',
'precision' => 4, 'nullable' => false),
+ 'lang' => array('type' => 'varchar',
'precision' => 2, 'nullable' => false),
+ 'arguments_lang' => array('type' => 'text'),
+ ),
+ 'pk' => array('version_id','lang'),
'fk' => array(),
'ix' => array(),
Index: tables_update.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/sitemgr/setup/tables_update.inc.php,v
retrieving revision 1.12
retrieving revision 1.13
diff -C2 -r1.12 -r1.13
*** tables_update.inc.php 22 May 2003 02:36:54 -0000 1.12
--- tables_update.inc.php 30 May 2003 04:01:43 -0000 1.13
***************
*** 433,437 ****
//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) VALUES
(0,-1,'public','sitemgr','Default Website','This website has been add by
setup')");
$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__);
--- 433,437 ----
//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) VALUES
(0,-1,'public','sitemgr','Default Website','This website has been added by
setup')");
$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__);
***************
*** 504,507 ****
--- 504,635 ----
return $setup_info['sitemgr']['currentver'];
+ }
+
+ $test[] = '0.9.15.004';
+ function sitemgr_upgrade0_9_15_004()
+ {
+ global $setup_info,$phpgw_setup;
+ $setup_info['sitemgr']['currentver'] = '0.9.15.005';
+ $db2 = $phpgw_setup->db;
+ $db3 = $phpgw_setup->db;
+
+ //Create the field state for pages and categories and give all
existing pages and categories published state (2)
+ $phpgw_setup->oProc->AddColumn('phpgw_sitemgr_pages',
+ 'state',array('type'=>int, 'precision'=>2));
+
+ $db2->query("UPDATE phpgw_sitemgr_pages SET state = 2");
+
+
$phpgw_setup->oProc->CreateTable('phpgw_sitemgr_categories_state',array(
+ 'fd' => array(
+ 'cat_id' => array('type' => 'int', 'precision'
=> 4, 'nullable' => false),
+ 'state' => array('type' => 'int', 'precision'
=> 2)
+ ),
+ 'pk' => array('cat_id'),
+ 'fk' => array(),
+ 'ix' => array(),
+ 'uc' => array()
+ ));
+
+ $GLOBALS['phpgw_setup']->oProc->query("select cat_id from
phpgw_categories where cat_appname='sitemgr' AND cat_level > 0");
+ while($GLOBALS['phpgw_setup']->oProc->next_record())
+ {
+ $cat_id = $GLOBALS['phpgw_setup']->oProc->f('cat_id');
+ $db2->query("INSERT INTO phpgw_sitemgr_categories_state
(cat_id,state) VALUES ($cat_id,2)");
+ }
+
+ //rename table content blocks and table content_lang blocks_lang
+ //and add the new tables content and content_lang
+
$GLOBALS['phpgw_setup']->oProc->RenameTable('phpgw_sitemgr_content','phpgw_sitemgr_blocks');
+
$GLOBALS['phpgw_setup']->oProc->RenameTable('phpgw_sitemgr_content_lang','phpgw_sitemgr_blocks_lang');
+
$GLOBALS['phpgw_setup']->oProc->CreateTable('phpgw_sitemgr_content',array(
+ 'fd' => array(
+ 'version_id' => array('type' => 'auto',
'nullable' => false),
+ 'block_id' => array('type' => 'int',
'precision' => 4, 'nullable' => false),
+ 'arguments' => array('type' => 'text'),
+ 'state' => array('type' => 'int', 'precision'
=> 2)
+ ),
+ 'pk' => array('version_id'),
+ 'fk' => array(),
+ 'ix' => array(),
+ 'uc' => array()
+ ));
+
$GLOBALS['phpgw_setup']->oProc->CreateTable('phpgw_sitemgr_content_lang',array(
+ 'fd' => array(
+ 'version_id' => array('type' => 'int',
'precision' => 4, 'nullable' => false),
+ 'lang' => array('type' => 'varchar',
'precision' => 2, 'nullable' => false),
+ 'arguments_lang' => array('type' => 'text'),
+ ),
+ 'pk' => array('version_id','lang'),
+ 'fk' => array(),
+ 'ix' => array(),
+ 'uc' => array()
+ ));
+
+ //create rows in the new content tables from old content tables
(where state=0(Draft) when inactive, state=2(Published) when active)
+ $GLOBALS['phpgw_setup']->oProc->query("SELECT
block_id,arguments,actif FROM phpgw_sitemgr_blocks");
+ while ($GLOBALS['phpgw_setup']->oProc->next_record())
+ {
+ $block_id =
$GLOBALS['phpgw_setup']->oProc->f('block_id');
+ $arguments =
$GLOBALS['phpgw_setup']->oProc->f('arguments');
+ $state = $GLOBALS['phpgw_setup']->oProc->f('actif') ? 0
: 2;
+ $db2->query("INSERT INTO phpgw_sitemgr_content
(block_id,arguments,state) VALUES ($block_id,'$arguments',$state)");
+ $version_id =
$db2->get_last_insert_id('phpgw_sitemgr_content','version_id');
+ $db2->query("SELECT lang,arguments_lang FROM
phpgw_sitemgr_blocks_lang WHERE block_id = $block_id");
+ while ($db2->next_record())
+ {
+ $lang = $db2->f('lang');
+ $arguments_lang = $db2->f('arguments_lang');
+ $title = $db2->f('title');
+ $db3->query("INSERT INTO
phpgw_sitemgr_content_lang (version_id,lang,arguments_lang) VALUES
($version_id,'$lang','$arguments_lang')");
+ }
+ }
+
+ //drop columns in tables blocks and blocks_lang
+ $newtbldef = array(
+ 'fd' => array(
+ 'block_id' => array('type' => 'auto',
'nullable' => false),
+ 'area' => array('type' => 'varchar',
'precision' => 50),
+ 'cat_id' => array('type' => 'int', 'precision'
=> 4),
+ 'page_id' => array('type' => 'int', 'precision'
=> 4),
+ 'module_id' => array('type' => 'int',
'precision' => 4, 'nullable' => false),
+ 'sort_order' => array('type' => 'int',
'precision' => 4),
+ 'viewable' => array('type' => 'int',
'precision' => 4),
+ 'actif' => array('type' => 'int', 'precision'
=> 2)
+ ),
+ 'pk' => array('block_id'),
+ 'fk' => array(),
+ 'ix' => array(),
+ 'uc' => array()
+ );
+
$phpgw_setup->oProc->DropColumn('phpgw_sitemgr_blocks',$newtbldef,'arguments');
+ $newtbldef = array(
+ 'fd' => array(
+ 'block_id' => array('type' => 'auto',
'nullable' => false),
+ 'area' => array('type' => 'varchar',
'precision' => 50),
+ 'cat_id' => array('type' => 'int', 'precision'
=> 4),
+ 'page_id' => array('type' => 'int', 'precision'
=> 4),
+ 'module_id' => array('type' => 'int',
'precision' => 4, 'nullable' => false),
+ 'sort_order' => array('type' => 'int',
'precision' => 4),
+ 'viewable' => array('type' => 'int',
'precision' => 4),
+ ),
+ 'pk' => array('block_id'),
+ 'fk' => array(),
+ 'ix' => array(),
+ 'uc' => array()
+ );
+
$phpgw_setup->oProc->DropColumn('phpgw_sitemgr_blocks',$newtbldef,'actif');
+ $newtbldef = array(
+ 'fd' => array(
+ 'block_id' => array('type' => 'auto',
'nullable' => false),
+ 'lang' => array('type' => 'varchar',
'precision' => 2, 'nullable' => false),
+ 'title' => array('type' => 'varchar',
'precision' => 255),
+ ),
+ 'pk' => array('block_id','lang'),
+ 'fk' => array(),
+ 'ix' => array(),
+ 'uc' => array()
+ );
+
$phpgw_setup->oProc->DropColumn('phpgw_sitemgr_blocks_lang',$newtbldef,'arguments_lang');
+ return $setup_info['sitemgr']['currentver'];
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Phpgroupware-cvs] CVS: sitemgr/setup default_records.inc.php,1.5,1.6 setup.inc.php,1.13,1.14 tables_current.inc.php,1.12,1.13 tables_update.inc.php,1.12,1.13,
Michael Totschnig <address@hidden> <=
- Prev by Date:
[Phpgroupware-cvs] CVS: sitemgr index.php,1.1.1.1,1.2
- Next by Date:
[Phpgroupware-cvs] CVS: sitemgr/sitemgr-site/inc class.Template3.inc.php,1.7,1.8 class.sitebo.inc.php,1.3,1.4 class.ui.inc.php,1.12,1.13
- Previous by thread:
[Phpgroupware-cvs] CVS: sitemgr index.php,1.1.1.1,1.2
- Next by thread:
[Phpgroupware-cvs] CVS: sitemgr/sitemgr-site/inc class.Template3.inc.php,1.7,1.8 class.sitebo.inc.php,1.3,1.4 class.ui.inc.php,1.12,1.13
- Index(es):