Subject:*
Name/Email:*
Message Icon:*
Message:*
url email imgsrc image php hide code quote
English Nederlands 
VOORBEELD
alignleft aligncenter alignright bold italic underline linethrough   


 [meer...]
Options:*
 

 

 
   
Re: Automatic database upgrade for non-module objects?

by skenow on 19/10/2024 11:06:48

After looking at this a bit more, I have submitted changes that will look at these 2 tables every time the system module is updated. It might be good to do the same in 1.4.7.


Re: Automatic database upgrade for non-module objects?

by fiammybe on 18/9/2024 3:01:05

If it is feasable to make this automatic, it would be best.


Re: Automatic database upgrade for non-module objects?

by skenow on 17/9/2024 7:26:42

I had a good solid foundation for the solution - thanks to all the work others had done before me. I would like to test a few other things and then I'll create a pull request to add this in. What do you think about making this a default action of the system module update, rather than just a step?


Re: Automatic database upgrade for non-module objects?

by fiammybe on 15/9/2024 21:17:35

this looks like a very elegant and minimalistic change, kudos for that!

Taking the module upgrade route would also have been my choice.


Re: Automatic database upgrade for non-module objects?

by skenow on 15/9/2024 14:56:58

Well, some experimenting has gotten me the results I was looking for - with a pretty small change to icms_db_legacy_updater_Handler::upgradeObjectItem(). Here's how the first lines look -

  function upgradeObjectItem($dirname, $item) {
        $module_handler = icms_getModuleHandler($item, $dirname, null, true); // this is changed

        if (!$module_handler) { // added this branch
                $module_handler = icms::handler($dirname . '_' . $item);
        }
        if (!$module_handler) {
                return false;
        }

Then, in the system module's upgrade file I added at the end

    if (!$abortUpdate) $newDbVersion = 45;
    
    if ($dbVersion < $newDbVersion) {
        $icmsDatabaseUpdater->automaticUpgrade('icms_data', array('file', 'urllink'));
        /* Finish up this portion of the db update */
        if (!$abortUpdate) {
            $icmsDatabaseUpdater->updateModuleDBVersion($newDbVersion, 'system');
            echo sprintf(_DATABASEUPDATER_UPDATE_OK, icms_conv_nr2local($newDbVersion)) . '<br />';
        }
    }        

After upgrading the system module, I had the 2 tables I needed. Updates of other IPF modules still work.

Any unexpected risks? Another few sets of eyes on this would be fantastic!