[Phpslash-commit] CVS: phpslash-dev/scripts db_xfer.php.disabled,1.2,1.3
Brought to you by:
joestewart,
nhruby
From: Joe S. <joe...@us...> - 2004-09-06 01:34:40
|
Update of /cvsroot/phpslash/phpslash-dev/scripts In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15686/phpslash-dev/scripts Modified Files: db_xfer.php.disabled Log Message: User Blog support Index: db_xfer.php.disabled =================================================================== RCS file: /cvsroot/phpslash/phpslash-dev/scripts/db_xfer.php.disabled,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** db_xfer.php.disabled 2 Sep 2004 04:10:16 -0000 1.2 --- db_xfer.php.disabled 6 Sep 2004 01:34:29 -0000 1.3 *************** *** 28,34 **** /* Array of availible functions. Please update if need be*/ ! $av_func = array("xfer_authors" => "Upgrade the authors", ! "xfer_sections" => "Upgrade the sections", ! "xfer_blocktypes" => "Upgrade the blocktypes", "xfer_blocks" => "Upgrade the blocks" ); --- 28,34 ---- /* Array of availible functions. Please update if need be*/ ! $av_func = array("xfer_sections" => "Upgrade the sections", ! "xfer_groups" => "Upgrade the groups", ! "xfer_blocktypes" => "Upgrade the blocktypes", "xfer_blocks" => "Upgrade the blocks" ); *************** *** 182,198 **** $content .= getMessage("Block types migrated"); - // Updating possible bad db_sequence for section_block_lut_seq - $q= "SELECT max(lut_id) as max_lut_id from psl_section_block_lut"; - $db->query($q); - $db->next_record(); - - $max_lut_id = $db->Record['max_lut_id']; - $content .= "max_lut_id = ". $max_lut_id ."<br>\n"; - - $q = sprintf("UPDATE db_sequence SET nextid = '%s' where seq_name = 'psl_section_block_lut_seq'", $max_lut_id); - $db->query($q); - // $db->next_record(); - - return $content; } --- 182,185 ---- *************** *** 858,861 **** --- 845,859 ---- $section = pslNew("Section"); + // Updating possible bad db_sequence for section_block_lut_seq + $q= "SELECT max(lut_id) as max_lut_id from psl_section_block_lut"; + $db->query($q); + $db->next_record(); + + $max_lut_id = $db->Record['max_lut_id']; + $content .= "max_lut_id = ". $max_lut_id ."<br>\n"; + + $q = sprintf("UPDATE db_sequence SET nextid = '%s' where seq_name = 'psl_section_block_lut_seq'", $max_lut_id); + $db->query($q); + // $db->next_record(); // Add the "Poll" section if needed. *************** *** 959,962 **** --- 957,978 ---- $content .= getMessage("Submission Section already exists"); } + + // Add the "Blogs" section if needed. + if(!$section->getId("Blogs")) { + $ary['section_name'] = "Blogs"; + $ary['description'] = "User Journals"; + $ary['optionname'] = array(); + $ary['optionval'] = array(); + $success = $section->saveSection($ary); + // debug("message", $section->getMessage()); + if($success) { + $content .= getMessage($section->getMessage()); + } else { + $content .= getError($section->getMessage()); + } + + } else { + $content .= getMessage("Blogs Section already exists"); + } $content .= getMessage("Sections migrated"); *************** *** 966,969 **** --- 982,1035 ---- } + function xfer_groups() { + + global $_PSL; + + $content = ''; + + AddClassRequirement("group",$_PSL['moduledir'] ."/group/Group.class"); + + $group = pslNew("Group"); + $section = pslNew("Section"); + + // Add the "blogger" group if needed. + if(!$group->getGroupId("blogger")) { + $ary['group_name'] = "blogger"; + $ary['description'] = "User Journals"; + $group_id_ary = null; + $section_id_ary = null; + $section_id_ary[] = $section->getId("Blogs"); + + $ary['section_id_ary'] = $section_id_ary; + + $perm_id_ary = null; + $perm_id_ary[] = $group->getPermId("storyDelete"); + $perm_id_ary[] = $group->getPermId("storyEdit"); + $perm_id_ary[] = $group->getPermId("storyList"); + $perm_id_ary[] = $group->getPermId("storyNew"); + $perm_id_ary[] = $group->getPermId("storySave"); + + $ary['perm_id_ary'] = $perm_id_ary; + + + $ary[optionname] = array(); + $ary[optionval] = array(); + $success = $group->saveGroup($ary); + // debug("message", $group->getMessage()); + if($success) { + $content .= getMessage($group->getMessage()); + } else { + $content .= getError($group->getMessage()); + } + } else { + $content .= getMessage("Blogs Section already exists"); + } + + $content .= getMessage("Groups migrated"); + + return $content; + + + } /* *************** *** 992,995 **** --- 1058,1065 ---- $content .= xfer_sections(); break; + case xfer_groups: + // echo "xfer_groups<br>"; + $content .= xfer_groups(); + break; case xfer_blocktypes: // echo "xfer_blocktypes<br>"; |