upgrade method that preserves customised forms

Discussion in 'Feature Requests' started by meemu, Jun 9, 2007.

  1. meemu

    meemu New Member

    I have recently performed an upgrade of a production system from ISPConfig 2.2.9 to 2.2.11. It's a reasonably small upgrade and I wanted to see what difficulties to expect during future upgrades.

    My old installation of ISPConfig was slightly customised. I had implemented a couple of things that I needed for my users, others that I thought make more sense than ISPConfig defaults. A list of things I had added:

    * custom field in web template form to put in our billing code for a hostingplan
    * custom field in web form to preserver this billing form
    * custom field in web form to chose between mod-php4 or php5-fastcgi
    * custom field in web form to chose between FTP, SFTP (rssh), bash
    * custom field in web form to disable ISPConfig error pages and use default apache error pages (or allow manual override with ErrorDocument)
    * custom field in web form for shared cgi support (e.g. formmail.pl). Needed because I'm running suexec and have to use some mod_rewrite trick to get shared cgis working
    * custom field in web form for dynamic awstats - same as above (plus a cron script to do the actual awstats processing)
    * custom field in web form for shared htdig installation - same as above also a cron script
    * custom field in web form to select a shared application and make php settings accordingly (e.g. drupal shared installation for all drupal sites)
    * custom field in server form to preset different default MX records - as I'm running DNS and mail on two other machines
    * patch to logs.php to exclude requests from own IPs (SSI, sub requests) being counted as traffic or showing up in statistics
    * patch to webalizer.php to resolve DNS using dnstran and simplify htaccess to logs to one server wide username/password
    * patch to create sites with 770 (660) and add www-data (and other shared groups like htdig,awstats) to new sites
    * preserve groups that contain ispconfig created users but are customised (user_von patch I posted somewhere here - mainly needed for shared apps)
    * some patch I found to keep the tree view in the left hand pane open

    Most of this went quite well and quickly. I manually created unified diffs against the 2.2.9 original files. Then I unpacked 2.2.11 and applied the diffs against the installer files before running setup. I can post my patches or a complete patchset against 2.2.11. I guess some of them make not sense for everyone so I think I'll have to learn to live with this method of upgrading.

    The only thing that really did my head was the customised forms. As the form information is stored as serialised php code there is no easy copy and paste method. I tried the Export Form/Import Form but that didn't do anything. I guess there is a reason why it says don't use in production. I ended up creating a unified diff between db_ispconfig.sql and what I got from mysqldump. Then I manually edited the CREATE statements to include my custom fields and ran the upgrade. That went well and the additional columns where still in the mysql db. The form fields had disappeared though. Finally, I managed to get them back doing a direct DELETE FROM doctype WHERE doctype_id=xxx and then inserting from a backup db I had made at the beginning.

    I think in terms of time the patching took 1/4 of the complete upgrade procedure. Getting the forms back was really painful.

    So finally to my point or feature request. I see one way how to get around the problem. It would be to do upgrades not via an installer but SVN and add some sort of db update script (if there are any changes to the db structure at all). This would be very similar to what, for instance, drupal does. Something like
    Code:
    svn update -r '{RELEASE DATE}'
    scripts/db_update
    
    (my svn isn't that great!)

    The db_update would the check the current db version and run ALTER TABLE and INSERTS according to the changes in versions. I don't know if Form Export does this already but I think it should be possible to merge the PHP code in doctyped_defs with some simple PHP script that preserves any local modifications.

    If there's anyway I could help I am happy to commit some time to this if you think it's at all possible and useful.
     
    Last edited: Jun 9, 2007
  2. danf.1979

    danf.1979 Member

    It would be great to see those features on svn :)
     
  3. till

    till Super Moderator Staff Member ISPConfig Developer

    The forms in the development branch (version 2.3.2) are stored as files and not in the datbase anymore, so making a diff of these files should work.
     

Share This Page