Page Menu
Home
In-Portal Phabricator
Search
Configure Global Search
Log In
Files
F1046458
D513.id.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Sat, Jun 28, 7:19 PM
Size
3 KB
Mime Type
text/x-diff
Expires
Sun, Jun 29, 7:19 PM (6 h, 1 m)
Engine
blob
Format
Raw Data
Handle
675825
Attached To
D513: INP-1904 - Support opening an Admin Console from a Site Domain
D513.id.diff
View Options
Index: core/kernel/application.php
===================================================================
--- core/kernel/application.php
+++ core/kernel/application.php
@@ -667,11 +667,6 @@
*/
public function siteDomainField($field, $formatted = false, $format = null)
{
- if ( $this->isAdmin ) {
- // don't apply any filtering in administrative console
- return false;
- }
-
if ( !$this->siteDomain ) {
$this->siteDomain = $this->recallObject('site-domain.current', null, Array ('live_table' => true));
/** @var kDBItem $site_domain */
@@ -1818,15 +1813,20 @@
*/
public function getSecureDomain()
{
- $ret = $this->isAdmin ? $this->ConfigValue('AdminSSLDomain') : false;
+ // Dynamically detected site domain wins over any statically defined domain.
+ $site_domain = $this->siteDomainField('SSLDomainName');
+
+ if ( $site_domain ) {
+ return $site_domain;
+ }
- if ( !$ret ) {
- $ssl_domain = $this->siteDomainField('SSLDomainName');
+ $admin_domain = $this->isAdmin ? $this->ConfigValue('AdminSSLDomain') : false;
- return strlen($ssl_domain) ? $ssl_domain : $this->ConfigValue('SSLDomain');
+ if ( $admin_domain ) {
+ return $admin_domain;
}
- return $ret;
+ return $this->ConfigValue('SSLDomain');
}
/**
Index: core/units/site_domains/site_domain_eh.php
===================================================================
--- core/units/site_domains/site_domain_eh.php
+++ core/units/site_domains/site_domain_eh.php
@@ -44,14 +44,9 @@
public function getPassedID(kEvent $event)
{
if ( $event->Special == 'current' ) {
- if ( $this->Application->isAdmin ) {
- $event->setEventParam('raise_warnings', 0);
- }
- else {
- $domain_field = PROTOCOL == 'https://' ? 'SSLDomainName' : 'DomainName';
+ $domain_field = PROTOCOL == 'https://' ? 'SSLDomainName' : 'DomainName';
- return $this->querySiteDomain($domain_field, $_SERVER['HTTP_HOST']);
- }
+ return $this->querySiteDomain($domain_field, $_SERVER['HTTP_HOST']);
}
return parent::getPassedID($event);
@@ -107,7 +102,7 @@
protected function LoadItem(kEvent $event)
{
if ( $this->Application->isAdmin ) {
- // don't load domain data from cache
+ // Don't load domain data from a cache. Unmatched site domain results in "ID=false".
parent::LoadItem($event);
return;
@@ -116,10 +111,10 @@
/** @var kDBItem $object */
$object = $event->getObject();
- $id = (int)$this->getPassedID($event);
+ $id = (int)$this->getPassedID($event); // Unmatched site domain results in "ID=0".
if ( $object->isLoaded() && ($object->GetID() == $id) ) {
- // object is already loaded by same id
+ // Object is already loaded by the same id.
return;
}
@@ -127,7 +122,7 @@
$site_helper = $this->Application->recallObject('SiteHelper');
$site_domains = $site_helper->getSiteDomains();
- $domain_data = array_key_exists($id, $site_domains) ? $site_domains[$id] : false;
+ $domain_data = array_key_exists($id, $site_domains) ? $site_domains[$id] : array();
if ( $object->LoadFromHash($domain_data) ) {
/** @var Params $actions */
Event Timeline
Log In to Comment