mirror of
https://github.com/silverstripe/silverstripe-userforms.git
synced 2024-10-22 15:05:42 +00:00
FEATURE: added migration tool for publishing unversioned forms
This commit is contained in:
parent
0707279dec
commit
85c30f68e4
39
code/migration/UserFormsVersionedTask.php
Normal file
39
code/migration/UserFormsVersionedTask.php
Normal file
@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* UserForms Versioned Task
|
||||
*
|
||||
* Initial migration script for forms that do not exist on the live site.
|
||||
* In previous versions of UserForms it did not provide staging / live functionality
|
||||
* When upgrading to the new version we need to publish the existing pages.
|
||||
*
|
||||
* @package userforms
|
||||
*/
|
||||
|
||||
class UserFormsVersionedTask extends MigrationTask {
|
||||
|
||||
protected $title = "UserForms Versioned Initial Migration";
|
||||
|
||||
protected $description = "Publishes the existing forms";
|
||||
|
||||
/**
|
||||
* Publish the existing forms.
|
||||
*
|
||||
*/
|
||||
function run($request) {
|
||||
$forms = Versioned::get_by_stage('UserDefinedForm', 'Live');
|
||||
|
||||
if($forms) {
|
||||
foreach($forms as $form) {
|
||||
echo "Publishing $form->Title <br />";
|
||||
$form->doPublish();
|
||||
}
|
||||
echo "Complete";
|
||||
}
|
||||
else {
|
||||
echo "No Forms Found";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user