2009-11-24 22:07:36 +01:00
|
|
|
<?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";
|
2015-09-11 00:20:06 +02:00
|
|
|
|
2009-11-24 22:07:36 +01:00
|
|
|
/**
|
|
|
|
* Publish the existing forms.
|
|
|
|
*
|
|
|
|
*/
|
2012-05-04 03:39:08 +02:00
|
|
|
public function run($request) {
|
2009-11-24 22:07:36 +01:00
|
|
|
$forms = Versioned::get_by_stage('UserDefinedForm', 'Live');
|
2015-09-11 00:20:06 +02:00
|
|
|
|
2009-11-24 22:07:36 +01:00
|
|
|
if($forms) {
|
|
|
|
foreach($forms as $form) {
|
|
|
|
echo "Publishing $form->Title <br />";
|
|
|
|
$form->doPublish();
|
|
|
|
}
|
|
|
|
echo "Complete";
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
echo "No Forms Found";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|