Log in

View Full Version : installation script?


sde
01-26-2006, 05:04 AM
i made a little product that requires custom user fields to be entered. since userfields are not associated with a product, is there a way i can just execute a script when the product is installed? i'm thinking this script could just progromatically add the userfields.

or possibly might there be a hook for on (this) product install? i didn't see one.

harmor19
01-26-2006, 05:22 AM
Are you asking how to create a new table in the database or add fields in an existing table with the product or something else?

sde
01-26-2006, 05:41 AM
no, i'm good with php/mysql. it is the vb product creation that i'm a little new at.

i'm asking if there is a way to execute a php script at the time the product is installed.

for my case, i would have this script i want executed create the additional userfield so the user won't have to. if there was a hook for "on_this_plugin_install" or something like that, then i could just add this script as a plugin, and it would be executed immediately after the product is installed.

or maybe there is another way to do this i'm not thinking of.

Andreas
01-26-2006, 10:56 AM
Install Code?

harmor19
01-26-2006, 12:05 PM
In the product xml under the "version" tags put

<codes>
<code version="1.0.0">
<installcode><![CDATA[

//create, update, alter table(s) here

$db->show_errors();


]]></installcode>
<uninstallcode><![CDATA[$db->hide_errors();
//Reverse the install code above.
//So instead of "Create" use "drop


$db->show_errors();]]></uninstallcode>
</code>
</codes>