silverstripe-framework/Dev/DevBuildController.php

40 lines
837 B
PHP
Raw Normal View History

<?php
2014-08-06 06:29:52 +02:00
namespace SilverStripe\Dev;
use SilverStripe\Control\Controller;
use SilverStripe\Control\Director;
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();
echo $renderer->renderHeader();
echo $renderer->renderInfo("Environment Builder", Director::absoluteBaseURL());
2014-08-06 06:29:52 +02:00
echo "<div class=\"build\">";
2014-08-06 06:29:52 +02:00
$da = DatabaseAdmin::create();
2016-07-10 11:35:14 +02:00
$response = $da->handleRequest($request, $this->model);
2014-08-06 06:29:52 +02:00
echo "</div>";
echo $renderer->renderFooter();
2016-07-10 11:35:14 +02:00
return $response;
2014-08-06 06:29:52 +02:00
}
}
2014-08-06 06:29:52 +02:00
}