how to reset a plugin's upgrade process?

i have been changing my own plugins to make use of the icon handling system from elgg 2.2+ - and have successfully upgraded videolist to be able to run its own upgrade for the old icon format to the new format.

however, i just did the same for another plugin i use that handles icons and although the upgrade tested corretly on my dev and also test server, for some unknown reason it didn't work correctly in my production server. how can i reset the status of the plugin's upgrade process on this server?

i have tried to manually insert code that sets the 'is_completed' field for the upgrade object to be 'false', but that and nothing else i have done has resulted in me being able to re-run the upgrade process which failed.

  • I suppose you could bump the version number of the upgrade temporarily to be ahead of the current version in datalists.

  • Oops, I totally don't know how plugin upgrades work in 2.x.

  • As I understand you changed "is_completed" to false and you could repeat the upgrade. Right? I think that's the only way to "undo" an update or let's say to rather be able to re-run it. There's no version number bumped anymore as in the past that you could simply increase together with adding another upgrade script that might fix issues due to an incomplete former upgrade.

  • the problem is that if an upgrade fails without the system recognising the failure then there's no way to rerun it. if i create another upgrade to run, then i could end up with many of them as i attempt to fix the problem, when in truth it is far more efficient to just tweak the first upgrade script and rerun it.
    it is possible that i wasn't using the correct syntax / command for setting 'is_completed', but so far i wasn't successful in doing that.

  • It may be wise to construct your upgrade script as a plain old PHP file. You can then temporarily stick the bootstrap at the top and run it directly.

  • maybe, yeah - although it would be nicer to be able to just reset the upgrade process with a one line command.

  • what is the bootstrap command now?

  • // require vendor/autoload.php
    
    \Elgg\Application::start();
    

     

  • thanks steve. having now rerun the upgrade and debugged it, i can see that it appears to complete correctly and there are no errors outputted. however, when i try to view the new icons via the url that elgg has created i just get an error that the icon cannot be found, so there appears to have been a failure in some way in the process of creating the new icons from an existing thumbnail. my code doesn't use a custom icon handler or view and the thumbnails ARE being accessed and rendered correctly when the other part of my plugin creates them using FFMPEG when new entities are created.

    i am using this line to generate the new thumbnails from an existing thumbnail:

    $entity->saveIconFromElggFile($old_file)

    anyone have any tips on why this is failing?  i'm not seeing anything anything useful in the log.