\EcommerceDatabaseAdmin

One stop shop for massaging e-commerce related data AND running tests.

You can customise this menu by "decorating" this class
and adding the method: "updateEcommerceDevMenu".

Here is an example:

<code php>
<?php

####################### in mysite/code/tasks/MyMigration.php

class MyMigration extends BuildTask {

protected $title = "Mysite Database Fixes";

protected $description = "General DB fixes";

function run(SS_HTTPRequest $request) {
DB::query("TRUNCATE TABLE MyUselessTable;");
}

}

class MyMigration_EXT extends Extension {

private static $allowed_actions = array(
"mymigration" => true
);

//NOTE THAT updateEcommerceDevMenuConfig adds to Config options
//but you can als have: updateEcommerceDevMenuDebugActions, or updateEcommerceDevMenuMaintenanceActions
function updateEcommerceDevMenuConfig($buildTasks){
$buildTasks[] = "mymigration";
return $buildTasks;
}

function mymigration(SS_HTTPRequest $request){
$this->owner->runTask("MyMigration", $request);
}

}


####################### in mysite/_config.php:

Object::add_extension("EcommerceDatabaseAdmin", "MyMigration_EXT");


</code>


SECTIONS

0. check settings
1. ecommerce setup (default records)
2. data review
3. regular maintance
4. debug
5. migration
6. reset
7. tests