ENH Use cached table list from ClassInfo (#564)

undefined
This commit is contained in:
Thomas Portelange 2024-03-28 09:06:05 +01:00 committed by GitHub
parent 0fe63e92bd
commit 6ba7385f5d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -34,6 +34,7 @@ use SilverStripe\Subsites\Service\ThemeResolver;
use SilverStripe\Subsites\State\SubsiteState; use SilverStripe\Subsites\State\SubsiteState;
use SilverStripe\Versioned\Versioned; use SilverStripe\Versioned\Versioned;
use UnexpectedValueException; use UnexpectedValueException;
use SilverStripe\Core\ClassInfo;
/** /**
* A dynamically created subsite. SiteTree objects can now belong to a subsite. * A dynamically created subsite. SiteTree objects can now belong to a subsite.
@ -259,7 +260,8 @@ class Subsite extends DataObject
$domainTableName = $schema->tableName(SubsiteDomain::class); $domainTableName = $schema->tableName(SubsiteDomain::class);
if (!DB::get_schema()->hasTable($domainTableName)) { // ClassInfo::hasTable provides a cached table list
if (!ClassInfo::hasTable($domainTableName)) {
// Table hasn't been created yet. Might be a dev/build, skip. // Table hasn't been created yet. Might be a dev/build, skip.
return 0; return 0;
} }