Skip to content

Commit

Permalink
サブサイト(独自ドメイン)で作成したページがエイリアス付きサブサイトと混同される問題を修正 fix baserproject#3842
Browse files Browse the repository at this point in the history
  • Loading branch information
kawaseryoma committed Sep 27, 2024
1 parent 8d7a05c commit f2bcc42
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions lib/Baser/Lib/BcSite.php
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ public static function findCurrent($direct = true)
$request = new CakeRequest();
}
$url = $request->url;
$sites = self::findAll();
$sites = self::findAll(true);
if (!$sites) {
return null;
}
Expand Down Expand Up @@ -292,7 +292,7 @@ public static function findCurrentSub($sameMainUrl = false, BcAbstractDetector $
*
* @return BcSite[]
*/
public static function findAll()
public static function findAll($reversed = false)
{
if (!BC_INSTALLED) {
return [];
Expand All @@ -306,7 +306,17 @@ public static function findAll()
} catch (Exception $e) {
return [];
}
$sites = $Site->find('all', ['recursive' => -1]);
if($reversed){
$order = [
'Site.domain_type' => 'desc'
];
} else {
$order = [];
}
$sites = $Site->find('all', [
'recursive' => -1,
'order' => $order
]);
array_unshift($sites, $Site->getRootMain());
self::$_sites = [];
foreach($sites as $site) {
Expand Down

0 comments on commit f2bcc42

Please sign in to comment.