API Update MigrationTask class to be an abstract class

This commit is contained in:
Michal Kleiner 2020-03-16 17:26:53 +13:00 committed by Guy Sartorelli
parent 2ae52120c1
commit e42ed95be1
No known key found for this signature in database
GPG Key ID: F313E3B9504D496A

View File

@ -7,16 +7,17 @@ namespace SilverStripe\Dev;
* *
* <b>Creating Migration Tasks</b> * <b>Creating Migration Tasks</b>
* *
* To create your own migration task all you need to do is define your own subclass of MigrationTask and define the * To create your own migration task, you need to define your own subclass of MigrationTask
* following functions * and implement the following methods
* *
* <i>mysite/code/MyMigrationTask.php</i> * <i>app/src/MyMigrationTask.php</i>
* *
* <code> * <code>
* class MyMigrationTask extends BuildTask { * class MyMigrationTask extends MigrationTask {
* *
* private static $segment = 'MyMigrationTask'; // segment in the dev/tasks/ namespace for URL access
* protected $title = "My Database Migrations"; // title of the script * protected $title = "My Database Migrations"; // title of the script
* protected $description = "Description"; // description of what it does * protected $description = "My Description"; // description of what it does
* *
* public function run($request) { * public function run($request) {
* if ($request->getVar('Direction') == 'down') { * if ($request->getVar('Direction') == 'down') {
@ -37,18 +38,19 @@ namespace SilverStripe\Dev;
* </code> * </code>
* *
* <b>Running Migration Tasks</b> * <b>Running Migration Tasks</b>
* To run any tasks you can find them under the dev/ namespace. To run the above script you would need to run * You can find all tasks under the dev/tasks/ namespace.
* the following and note - Either the site has to be in [devmode](debugging) or you need to add ?isDev=1 to the URL * To run the above script you would need to run the following and note - Either the site has to be
* in [devmode](debugging) or you need to add ?isDev=1 to the URL.
* *
* <code> * <code>
* // url to visit if in dev mode. * // url to visit if in dev mode.
* http://www.yoursite.com/dev/tasks/MyMigrationTask * https://www.yoursite.com/dev/tasks/MyMigrationTask
* *
* // url if you are in live mode but need to run this * // url to visit if you are in live mode but need to run this
* http://www.yoursite.com/dev/tasks/MyMigrationTask?isDev=1 * https://www.yoursite.com/dev/tasks/MyMigrationTask?isDev=1
* </code> * </code>
*/ */
class MigrationTask extends BuildTask abstract class MigrationTask extends BuildTask
{ {
private static $segment = 'MigrationTask'; private static $segment = 'MigrationTask';