Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 Programming Discussions
  #1  
Old 02-20-2009, 04:00 AM
Jaxel Jaxel is offline
 
Join Date: Sep 2005
Posts: 1,160
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Having problems with product file and ugprades...

Attached is a product file. It install fines, and works great... However, there is one section of the settings screen (rankingladder_awards), where each time I re-install the product, those settings are wiped out. Does anyone know how I fix this, so that the settings are maintained?
Attached Files
File Type: xml product-rankingladder.xml (73.2 KB, 4 views)
Reply With Quote
  #2  
Old 02-20-2009, 04:33 AM
TigerC10's Avatar
TigerC10 TigerC10 is offline
 
Join Date: Apr 2006
Location: Austin, TX
Posts: 616
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

There are two sections of codes for installing and uninstalling there, both are for version 1.0 - and I don't think that's really appropriate. I mean if they're the same version, shouldn't they be in the same section? But I don't think that's the problem. It probably doesn't matter.

I think this is your problem:
Code:
$dbalter->fetch_table_info('usergroup');
$dbalter->add_field(array (
It looks like it alters your database without checking to see if the alteration has already been made. I can only assume that's what's wiping the fields. Check this page out for a sample of how to check for db fields.



Unless you're talking about the static options...
Code:
<options>
		<settinggroup name="rankingladder" displayorder="65538">
			<setting varname="rankingladder_navbar" displayorder="1">
				<datatype>number</datatype>
				<optioncode>radio:piped
					0|Disable
					1|Create Link on Navbar (Left)
					2|Create Link in Quick Links
					3|Create Link in Community Links</optioncode>
				<defaultvalue>1</defaultvalue>
			</setting>
			<setting varname="rankingladder_filename" displayorder="5">
				<datatype>free</datatype>
				<defaultvalue>ranking.php</defaultvalue>
			</setting>
			<setting varname="rankingladder_thumbdir" displayorder="6">
				<datatype>free</datatype>
				<defaultvalue>ranking</defaultvalue>
			</setting>
			<setting varname="rankingladder_bestcount" displayorder="10">
				<datatype>posint</datatype>
				<defaultvalue>20</defaultvalue>
			</setting>
			<setting varname="rankingladder_topcount" displayorder="20">
				<datatype>posint</datatype>
				<defaultvalue>10</defaultvalue>
			</setting>
			<setting varname="rankingladder_timecount" displayorder="30">
				<datatype>posint</datatype>
				<defaultvalue>12</defaultvalue>
			</setting>
			<setting varname="rankingladder_awards" displayorder="40">
				<datatype>free</datatype>
				<optioncode><![CDATA[";
					$values = @unserialize($setting['value']);
					$values = @array_map('htmlspecialchars_uni', $values);
					$right .= "
					<fieldset class=\"fieldset\">
					<legend>$settingphrase[setting_rankingladder_awards_title]</legend>
					<table border=\"0\" width=\"100%\" cellpadding=\"1\" cellspacing=\"1\">
					<tr>
						<td>$vbphrase[setting_rankingladder_awards_first]</td>
						<td><input type=\"text\" name=\"setting[$setting[varname]][first]\" value=\"$values[first]\" class=\"bginput\" /></td>
					</tr>
					<tr>
						<td>$vbphrase[setting_rankingladder_awards_split]</td>
						<td><input type=\"text\" name=\"setting[$setting[varname]][split]\" value=\"$values[split]\" class=\"bginput\" /></td>
					</tr>
					<tr>
						<td>$vbphrase[setting_rankingladder_awards_second]</td>
						<td><input type=\"text\" name=\"setting[$setting[varname]][second]\" value=\"$values[second]\" class=\"bginput\" /></td>
					</tr>
					<tr>
						<td>$vbphrase[setting_rankingladder_awards_third]</td>
						<td><input type=\"text\" name=\"setting[$setting[varname]][third]\" value=\"$values[third]\" class=\"bginput\" /></td>
					</tr>
					<tr>
						<td>$vbphrase[setting_rankingladder_awards_fourth]</td>
						<td><input type=\"text\" name=\"setting[$setting[varname]][fourth]\" value=\"$values[fourth]\" class=\"bginput\" /></td>
					</tr>
					<tr>
						<td>$vbphrase[setting_rankingladder_awards_fifth]</td>
						<td><input type=\"text\" name=\"setting[$setting[varname]][fifth]\" value=\"$values[fifth]\" class=\"bginput\" /></td>
					</tr>
					<tr>
						<td>$vbphrase[setting_rankingladder_awards_sixten]</td>
						<td><input type=\"text\" name=\"setting[$setting[varname]][sixten]\" value=\"$values[sixten]\" class=\"bginput\" /></td>
					</tr>
					<tr>
						<td>$vbphrase[setting_rankingladder_awards_else]</td>
						<td><input type=\"text\" name=\"setting[$setting[varname]][else]\" value=\"$values[else]\" class=\"bginput\" /></td>
					</tr>
					</table>
					</fieldset>]]></optioncode>
				<defaultvalue><![CDATA[a:7:{s:5:"first";i:10;s:5:"split";i:9;s:6:"second";i:8;s:5:"third";i:6;s:6:"fourth";i:5;s:5:"fifth";i:3;s:6:"sixten";i:2;s:4:"else";i:1;}]]></defaultvalue>
			</setting>
			<setting varname="rankingladder_externalurl" displayorder="60">
				<datatype>free</datatype>
				<defaultvalue>member.php?u=</defaultvalue>
			</setting>
			<setting varname="rankingladder_pagesplit" displayorder="70">
				<datatype>posint</datatype>
				<defaultvalue>30</defaultvalue>
			</setting>
			<setting varname="rankingladder_rebuildcount" displayorder="80">
				<datatype>posint</datatype>
				<defaultvalue>20</defaultvalue>
			</setting>
		</settinggroup>
	</options>
Then you'd just need to change the default values to what you want before reinstalling.
Reply With Quote
  #3  
Old 02-20-2009, 08:20 AM
Jaxel Jaxel is offline
 
Join Date: Sep 2005
Posts: 1,160
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Naw Tiger, thats not the problem... The alter field is for usergroup permissions, I'm not having any problems with that...

The problem I am having is in the settings section.

Code:
<plugin active="1" executionorder="5">
	<title>Ranking Ladder Initialization</title>
	<hookname>init_startup</hookname>
	<phpcode><![CDATA[$vbulletin->options['rankingladder_awards'] = @unserialize($vbulletin->options['rankingladder_awards']);]]></phpcode>
</plugin>
<plugin active="1" executionorder="5">
	<title>Ranking Ladder Save Options</title>
	<hookname>admin_options_processing</hookname>
	<phpcode><![CDATA[if ($oldsetting['varname'] == 'rankingladder_awards')
		{
			$settings['rankingladder_awards'] = @serialize(@array_map('intval', $settings['rankingladder_awards']));
		}]]></phpcode>
</plugin>
Code:
<setting varname="rankingladder_awards" displayorder="40">
	<datatype>free</datatype>
	<optioncode><![CDATA[";
		$values = @unserialize($setting['value']);
		$values = @array_map('htmlspecialchars_uni', $values);
		$right .= "
		<fieldset class=\"fieldset\">
		<legend>$settingphrase[setting_rankingladder_awards_title]</legend>
		<table border=\"0\" width=\"100%\" cellpadding=\"1\" cellspacing=\"1\">
		<tr>
			<td>$vbphrase[setting_rankingladder_awards_first]</td>
			<td><input type=\"text\" name=\"setting[$setting[varname]][first]\" value=\"$values[first]\" class=\"bginput\" /></td>
		</tr>
		<tr>
			<td>$vbphrase[setting_rankingladder_awards_split]</td>
			<td><input type=\"text\" name=\"setting[$setting[varname]][split]\" value=\"$values[split]\" class=\"bginput\" /></td>
		</tr>
		<tr>
			<td>$vbphrase[setting_rankingladder_awards_second]</td>
			<td><input type=\"text\" name=\"setting[$setting[varname]][second]\" value=\"$values[second]\" class=\"bginput\" /></td>
		</tr>
		<tr>
			<td>$vbphrase[setting_rankingladder_awards_third]</td>
			<td><input type=\"text\" name=\"setting[$setting[varname]][third]\" value=\"$values[third]\" class=\"bginput\" /></td>
		</tr>
		<tr>
			<td>$vbphrase[setting_rankingladder_awards_fourth]</td>
			<td><input type=\"text\" name=\"setting[$setting[varname]][fourth]\" value=\"$values[fourth]\" class=\"bginput\" /></td>
		</tr>
		<tr>
			<td>$vbphrase[setting_rankingladder_awards_fifth]</td>
			<td><input type=\"text\" name=\"setting[$setting[varname]][fifth]\" value=\"$values[fifth]\" class=\"bginput\" /></td>
		</tr>
		<tr>
			<td>$vbphrase[setting_rankingladder_awards_sixten]</td>
			<td><input type=\"text\" name=\"setting[$setting[varname]][sixten]\" value=\"$values[sixten]\" class=\"bginput\" /></td>
		</tr>
		<tr>
			<td>$vbphrase[setting_rankingladder_awards_else]</td>
			<td><input type=\"text\" name=\"setting[$setting[varname]][else]\" value=\"$values[else]\" class=\"bginput\" /></td>
		</tr>
		</table>
		</fieldset>]]></optioncode>
	<defaultvalue><![CDATA[a:7:{s:5:"first";i:10;s:5:"split";i:9;s:6:"second";i:8;s:5:"third";i:6;s:6:"fourth";i:5;s:5:"fifth";i:3;s:6:"sixten";i:2;s:4:"else";i:1;}]]></defaultvalue>
</setting>
The default values ARE what I want, but when I re-install, it doesnt retain my old settings, or put in the default settings, it just wipes all the settings out complete...
Reply With Quote
  #4  
Old 03-06-2009, 07:54 PM
Jaxel Jaxel is offline
 
Join Date: Sep 2005
Posts: 1,160
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I have not yet been able to fix this problem.
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 05:49 AM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.05587 seconds
  • Memory Usage 2,225KB
  • Queries Executed 14 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (4)bbcode_code
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (4)post_thanks_box
  • (4)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (4)post_thanks_postbit_info
  • (4)postbit
  • (1)postbit_attachment
  • (4)postbit_onlinestatus
  • (4)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_attachment
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete