2016-01-06 00:34:58 +01:00
|
|
|
<?php
|
2014-08-06 06:29:52 +02:00
|
|
|
|
2016-06-15 06:03:16 +02:00
|
|
|
use SilverStripe\ORM\DatabaseAdmin;
|
|
|
|
|
2014-08-06 06:29:52 +02:00
|
|
|
class DevBuildController extends Controller {
|
2016-01-06 00:34:58 +01:00
|
|
|
|
2014-08-06 06:29:52 +02:00
|
|
|
private static $url_handlers = array(
|
2016-01-06 00:34:58 +01:00
|
|
|
'' => 'build'
|
2014-08-06 06:29:52 +02:00
|
|
|
);
|
2016-01-06 00:34:58 +01:00
|
|
|
|
2014-08-06 06:29:52 +02:00
|
|
|
private static $allowed_actions = array(
|
|
|
|
'build'
|
|
|
|
);
|
2016-01-06 00:34:58 +01:00
|
|
|
|
|
|
|
|
2014-08-06 06:29:52 +02:00
|
|
|
public function build($request) {
|
|
|
|
if(Director::is_cli()) {
|
|
|
|
$da = DatabaseAdmin::create();
|
|
|
|
return $da->handleRequest($request, $this->model);
|
|
|
|
} else {
|
|
|
|
$renderer = DebugView::create();
|
|
|
|
$renderer->writeHeader();
|
|
|
|
$renderer->writeInfo("Environment Builder", Director::absoluteBaseURL());
|
|
|
|
echo "<div class=\"build\">";
|
2016-01-06 00:34:58 +01:00
|
|
|
|
2014-08-06 06:29:52 +02:00
|
|
|
$da = DatabaseAdmin::create();
|
|
|
|
return $da->handleRequest($request, $this->model);
|
2016-01-06 00:34:58 +01:00
|
|
|
|
2014-08-06 06:29:52 +02:00
|
|
|
echo "</div>";
|
|
|
|
$renderer->writeFooter();
|
|
|
|
}
|
|
|
|
}
|
2016-01-06 00:34:58 +01:00
|
|
|
|
2014-08-06 06:29:52 +02:00
|
|
|
}
|