Joomla! Discussion Forums



It is currently Thu Nov 26, 2009 4:13 am (All times are UTC )

 




Post new topic Reply to topic  [ 6 posts ] 
Author Message
Posted: Sat Oct 25, 2008 8:06 am 
Joomla! Apprentice
Joomla! Apprentice
Offline

Joined: Mon Dec 24, 2007 7:43 am
Posts: 8
I had a question for other component developers out there...
How have you handled updating your component in the install?

As in.. when you come out with a new version of your component, is it just understood that the end user will need to uninstall the old version, deleting the way they've configured that version in favor of the new version? Or have you accounted for that someway in your new version install package?

Thanks,
-Haelix


Top
   
 
Posted: Sat Oct 25, 2008 10:34 pm 
Joomla! Apprentice
Joomla! Apprentice
Offline

Joined: Wed Aug 06, 2008 9:00 am
Posts: 27
First o all, I don't think it's OK that when a new version of your extension comes out, your customers have to uninstall the old version (possibly loosing data in the process) and install a new version.

When the new version comes out, simply create another install package (make sure to check if the tables in the database already exist ). Also, make sure that you don't overwrite existing customer data, or you'll be in big trouble.

Finally, when bulding the XML for the package, in the root element (<install>) write method="upgrade", so that the Joomla installer gracefully overwrites any existing files.

More about this here. http://docs.joomla.org/Using_the_installer_API_to_support_package_installation, in the "The root element" section.

_________________
Commercial Joomla extensions
http://www.rsjoomla.com


Top
  E-mail  
 
Posted: Sun Oct 26, 2008 12:20 am 
Joomla! Apprentice
Joomla! Apprentice
Offline

Joined: Mon Dec 24, 2007 7:43 am
Posts: 8
Thanks for the response and link! I'd read over that entry in the wiki a few times, seems I missed that part...

I cant seem to find any further documentation on method=upgrade... is there any specific joomla way to delete files you're not using in the new version?

Right now I've finished the sql for grabbing data out of old db fields and importing into new fields but this is with the idea that the process will be more like... "leave the folders but delete all the old files, upload new files, then click the 'Update DB' button that shows up if the new version of the component finds the wrong number of table fields"

There seem to be a lot of entries in the Wiki on upgrading Joomla... but not how extension developers should use the API to update their extensions.

Thanks,
Haelix


Top
   
 
Posted: Sun Oct 26, 2008 12:41 pm 
Joomla! Apprentice
Joomla! Apprentice
Offline

Joined: Wed Aug 06, 2008 9:00 am
Posts: 27
@haelix: before I can answer, I will need to know something: generally, an update is something that changes small portions of code. You are talking in your post about retrieving data from the "old" database and importing it into a "new" one. Also, you talk about files that you don't use anymore and want to delete them.

IMO, you want to create a new version of your extension, not an update. Again, I'm a little bit confused so it would be ok if you could provide additional info.

_________________
Commercial Joomla extensions
http://www.rsjoomla.com


Top
  E-mail  
 
Posted: Sun Oct 26, 2008 3:04 pm 
Joomla! Apprentice
Joomla! Apprentice
Offline

Joined: Mon Dec 24, 2007 7:43 am
Posts: 8
Ah ok.. same database.. the grabbing-old-data-and-putting-in-new-version is something like... custom color settings for various parts of the front end.. I have all of the settings in a single table, just one row, with a lot of fields so I can grab specific values and not have to grab the whole #__components params field.

In the beta version of the component i had `page_title_color` , `department_color` , etc.. but since I was using all of those on each page, in the new version I'm dropping all of those values in a single `custom_colors` field and whenever I need those, I've just got a function that parses them out into its own associative array.

That's all handled now... the issue I'm running into (and it's really not a serious issue) is that in using method=upgrade, it's overwriting the files from the last version that I'm using now... but the files from the last version that I am Not using anymore, or have moved to different directories, those are left and essentially clutter the directories up with files that don't need to be there.

A fair number of people have downloaded the beta and have entered a lot of data in for the component, and I really hate to say "Uninstall and lose all that data, then load the new version." But.. using the method=upgrade, I've written a lot of code to basically check if the new version of my tables was loaded (checking to see if a new version field exists) and its pretty much perfect now as far as the db goes. Whether fresh install or updating, it's placing the files where they need to go for the new version and overwriting any old files it finds... the problem is just... programmatically, how do you get rid of the files from last version that you're not using anymore.

I really don't know if I've just done an insane amount of work doing things the long way.. and the original question pertained to "whats the best way.. how have you guys done it" trying not to reinvent the wheel and learn a few things on how best to go about coming out with a new version from folks that've already been down this road.

I really appreciate that previous post, once I added the upgrade line in the install file, that just saved me a ton of time from how i was imagining doing it.

Thanks,
Haelix


Top
   
 
Posted: Sun Oct 26, 2008 3:42 pm 
Joomla! Apprentice
Joomla! Apprentice
Offline

Joined: Wed Aug 06, 2008 9:00 am
Posts: 27
Ok, now things are clearer. For the first part, the one that you use a table to keep the parameters, I think it would be best if you used the parameters system that Joomla provides for every extension. A good place to start is here http://docs.joomla.org/Component_parameters

Regarding the clean-up, you can instruct the Joomla installer via the XML file of your extension to run a post-install script that can take care of your problems. Please read the link I provided in my earlier posts.

Also, let's analyze the type of customers you have:
1) "old" customers, that already have the beta version. For them, you can prepare another package for your extension that does the upgrade with all the tweaks we have discussed about.
2) "new" customers, that install the new version. For them, just provide a normal package, one that doesn't check for updates and everything.

Hope the above helps.

_________________
Commercial Joomla extensions
http://www.rsjoomla.com


Top
  E-mail  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 6 posts ] 

Quick reply

 



Who is online

Users browsing this forum: jeffchannell and 27 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group