Version: current

     1 <?php
     2
     3 /**
     4  * UserForms Versioned Task
     5  *
     6  * Initial migration script for forms that do not exist on the live site.
     7  * In previous versions of UserForms it did not provide staging / live functionality
     8  * When upgrading to the new version we need to publish the existing pages.
     9  *
    10  * @package userforms
    11  */
    12
    13 class UserFormsVersionedTask extends MigrationTask {
    14
    15     protected $title = "UserForms Versioned Initial Migration";
    16
    17     protected $description = "Publishes the existing forms";
    18
    19     /**
    20      * Publish the existing forms.
    21      *
    22      */
    23     function run($request) {
    24         $forms = Versioned::get_by_stage('UserDefinedForm', 'Live');
    25
    26         if($forms) {
    27             foreach($forms as $form) {
    28                 echo "Publishing $form->Title <br />";
    29                 $form->doPublish();
    30             }
    31             echo "Complete";
    32         }
    33         else {
    34             echo "No Forms Found";
    35         }
    36     }
    37 }
    38
    39
    40

[Raise a SilverStripe Framework issue/bug](https://github.com/silverstripe/silverstripe-framework/issues/new)
- [Raise a SilverStripe CMS issue/bug](https://github.com/silverstripe/silverstripe-cms/issues/new)
- Please use the Silverstripe Forums to ask development related questions. -