PDA

View Full Version : Having problems with product file and ugprades...


Jaxel
02-20-2009, 04:00 AM
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?

TigerC10
02-20-2009, 04:33 AM
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:

$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 (http://www.phpbuilder.com/board/showthread.php?t=10282370) for a sample of how to check for db fields.



Unless you're talking about the static options...

<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.

Jaxel
02-20-2009, 08:20 AM
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.

<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>

<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...

Jaxel
03-06-2009, 07:54 PM
I have not yet been able to fix this problem.