Skip to content

Commit

Permalink
fix: don't invoke db for ready check outside of dev urls
Browse files Browse the repository at this point in the history
fixes #828
  • Loading branch information
tractorcow committed Mar 24, 2024
1 parent 02d6dfa commit 6961bc7
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/Model/CachableModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

namespace TractorCow\Fluent\Model;

use SilverStripe\Control\Director;
use SilverStripe\Control\HTTPRequest;
use SilverStripe\Core\ClassInfo;
use SilverStripe\Core\Config\Config;
use SilverStripe\Core\Injector\Injector;
Expand Down Expand Up @@ -68,6 +70,13 @@ public static function clearCached()
*/
protected static function databaseIsReady()
{
// Outside of dev/ don't actually do any checks, assume ready
/** @var HTTPRequest $request */
$request = Injector::inst()->get(HTTPRequest::class);
if (stripos($request->getURL(false), 'dev/') !== 0) {
return true;
}

$object = DataObject::singleton(static::class);

// if any of the tables aren't created in the database
Expand Down

0 comments on commit 6961bc7

Please sign in to comment.