silverstripe-framework/dev/DevBuildController.php

35 lines
692 B
PHP
Raw Normal View History

<?php
2014-08-06 06:29:52 +02:00
use SilverStripe\ORM\DatabaseAdmin;
2014-08-06 06:29:52 +02:00
class DevBuildController extends Controller {
2014-08-06 06:29:52 +02:00
private static $url_handlers = array(
'' => 'build'
2014-08-06 06:29:52 +02:00
);
2014-08-06 06:29:52 +02:00
private static $allowed_actions = array(
'build'
);
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\">";
2014-08-06 06:29:52 +02:00
$da = DatabaseAdmin::create();
return $da->handleRequest($request, $this->model);
2014-08-06 06:29:52 +02:00
echo "</div>";
$renderer->writeFooter();
}
}
2014-08-06 06:29:52 +02:00
}