Adriano Faria Posted October 29, 2015 Posted October 29, 2015 @Mark, I'm trying to add an option when updating to latest version of my app but it's not working. That's what I got: - Created a file called options.php in app/setup/upg_210001/ with the following content: $options = array(); $options[] = new \IPS\Helpers\Form\YesNo( '210001_fied_name', FALSE ); Then on app/setup/upg_210001/upgrade.php I got: public function step2() { if ( $_SESSION['upgrade_options']['app']['210001']['field_name'] ) { //do something } return TRUE; } But it upgrades from version 210000 to 210001 without show the form. Am I forgetting something ? Tks.
Adriano Faria Posted October 30, 2015 Author Posted October 30, 2015 On 29/10/2015 11:01:27, Adriano Faria said: @Mark, I'm trying to add an option when updating to latest version of my app but it's not working. That's what I got: - Created a file called options.php in app/setup/upg_210001/ with the following content: $options = array(); $options[] = new \IPS\Helpers\Form\YesNo( '210001_fied_name', FALSE ); Then on app/setup/upg_210001/upgrade.php I got: public function step2() { if ( $_SESSION['upgrade_options']['app']['210001']['field_name'] ) { //do something } return TRUE; } But it upgrades from version 210000 to 210001 without show the form. Am I forgetting something ? Tks. Anyone?
Ali Majrashi Posted October 30, 2015 Posted October 30, 2015 $options = array(); $options[] = new \IPS\Helpers\Form\YesNo( '210001_fied_name', FALSE ); i dont think it is related but you got spelling mistake on the field name it is 210001_fied_name missing L
Adriano Faria Posted October 30, 2015 Author Posted October 30, 2015 1 minute ago, Ali Majrashi said: i dont think it is related but you got spelling mistake on the field name it is 210001_fied_name missing L Oh yes, a typo because I replaced the real name by that to post here. Tks.
Adriano Faria Posted November 9, 2015 Author Posted November 9, 2015 @Lindy, this would be a good topic to move to the new forum. I really need to run some routines when upgrading app to a new version but I want to give the admin the option to do it. It should appear a form just like when you upgrade from IP.Board 3 to IPS4, where the admins has options to choose like display/login name, questions forums, etc. Tks.
Mark Posted November 11, 2015 Posted November 11, 2015 That should indeed work fine. Check what the value is for the "app_long_version" column in the "core_applications" table. It has to be less than the version your options.php file is set to (so only the appropriate options show) and if you've been using the same database for development, it may have updated already.
Adriano Faria Posted November 11, 2015 Author Posted November 11, 2015 23 minutes ago, Mark said: That should indeed work fine. Check what the value is for the "app_long_version" column in the "core_applications" table. It has to be less than the version your options.php file is set to (so only the appropriate options show) and if you've been using the same database for development, it may have updated already. Ok, I'll check it out. Tks.
Adriano Faria Posted February 20, 2016 Author Posted February 20, 2016 Ok, @Mark, came back to this today because I'm not sure why, some upgrades from 3.4 didn't ran the text parser, so it appears bbcodes, images links, etc., on tutorials content. So I want to give the admin the option to run it again. That's what I'm doing: 2 boards install, one dev board with the options, set to version 210003. Other install with version 210002. On dev board board I got on 210003 version: options.php upgrade.php Content: - options.php: <?php $options = array(); $options[] = new \IPS\Helpers\Form\YesNo( '210003_run_upgrader', FALSE, FALSE ); - upgrade.php: class _Upgrade { /** * ... * * @return array If returns TRUE, upgrader will proceed to next step. If it returns any other value, it will set this as the value of the 'extra' GET parameter and rerun this step (useful for loops) */ public function step1() { if ( $_SESSION['upgrade_options']['tutorials']['210003']['run_upgrader'] ) { echo time(); exit; } return TRUE; } } I really just want to make the form appears to see it working. - Built the app and downloaded the .tar. --------------------------- Now, the other board, which I will test the upgrade, is running the version 210002 from the app, so it should work. Thing is, it runs the upgrader without stop and show the form. See: http://www.screencast.com/t/no25UpCT
newbie LAC Posted February 21, 2016 Posted February 21, 2016 16 hours ago, Adriano Faria said: See: http://www.screencast.com/t/no25UpCT You uploaded new version but custom options works when you run test.com/admin/upgrade/
Adriano Faria Posted February 22, 2016 Author Posted February 22, 2016 So how can I start a task manually ? Need to run the same task that runs when you upgrade the app to parse content. I can't run this on a new version because only a few users who came from 3.4 needs it.
Adriano Faria Posted February 25, 2016 Author Posted February 25, 2016 On 22/02/2016 at 1:06 PM, Adriano Faria said: So how can I start a task manually ? Need to run the same task that runs when you upgrade the app to parse content. I can't run this on a new version because only a few users who came from 3.4 needs it. @Mark
teraßyte Posted February 25, 2016 Posted February 25, 2016 Hmm, in forum view this question is marted as having a best answer selected. But I see none here in topic/question view itself.
Adriano Faria Posted March 1, 2016 Author Posted March 1, 2016 On 22/02/2016 at 1:06 PM, Adriano Faria said: So how can I start a task manually ? Need to run the same task that runs when you upgrade the app to parse content. I can't run this on a new version because only a few users who came from 3.4 needs it. Ran manually on a new module: protected function manage() { \IPS\Task::queue( 'core', 'RebuildPosts', array( 'class' => 'IPS\tutorials\Article' ), 2 ); \IPS\Task::queue( 'core', 'RebuildPosts', array( 'class' => 'IPS\tutorials\Article\Comment' ), 2 ); \IPS\Task::queue( 'core', 'RebuildNonContentPosts', array( 'extension' => 'tutorials_Categories' ), 2 ); }
bfarber Posted April 8, 2016 Posted April 8, 2016 I'm not sure I fully follow which task you need to restart, but assuming you mean one of the background tasks it would be something like this \IPS\Task::queue( 'core', 'RebuildPosts', array( 'class' => 'IPS\forums\Topic\Post' ), 2 ); WARNING: most background tasks should not be re-ran without good reason. The above can break your post content, for instance, as it's expecting the content to be in the 3.x format. That said, this is generally how you do it - replacing the task and any variables the task class needs, as appropriate.
Recommended Posts
Archived
This topic is now archived and is closed to further replies.