Skip to content

Commit

Permalink
NEW Allow database read-only replicas
Browse files Browse the repository at this point in the history
  • Loading branch information
emteknetnz committed Sep 15, 2024
1 parent c21cf6d commit fc0353d
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions code/AdminRootController.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
use SilverStripe\Core\Config\Config;
use SilverStripe\Core\Injector\Injector;
use SilverStripe\View\TemplateGlobalProvider;
use SilverStripe\ORM\DB;

class AdminRootController extends Controller implements TemplateGlobalProvider
{
Expand Down Expand Up @@ -106,6 +107,7 @@ protected static function add_rule_for_controller($controllerClass)

public function handleRequest(HTTPRequest $request): HTTPResponse
{
DB::setMustUsePrimary(true);
// If this is the final portion of the request (i.e. the URL is just /admin), direct to the default panel
if ($request->allParsed()) {
$segment = Config::forClass($this->config()->get('default_panel'))
Expand Down

0 comments on commit fc0353d

Please sign in to comment.