Преглед изворни кода

Railway seed: skip the demo group when bx_groups isn't installed, and say why

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Andrey Yasko пре 2 недеља
родитељ
комит
ef8f19fd2c
1 измењених фајлова са 4 додато и 2 уклоњено
  1. 4 2
      scripts/railway/seed.php

+ 4 - 2
scripts/railway/seed.php

@@ -80,10 +80,10 @@ function seedAs(array $aProfile): int
     return $aProfile[1];
     return $aProfile[1];
 }
 }
 
 
-// --- a public group
+// --- a public group (when the package has the Groups module)
 $iGroupProfileId = 0;
 $iGroupProfileId = 0;
 $iOwner = seedAs($aProfiles[0]);
 $iOwner = seedAs($aProfiles[0]);
-$r = bx_srv('bx_groups', 'entity_add_forcedly', [$iOwner, [
+$r = !BxDolModuleQuery::getInstance()->isEnabledByName('bx_groups') ? ['message' => 'bx_groups is not installed'] : bx_srv('bx_groups', 'entity_add_forcedly', [$iOwner, [
     'group_name' => 'UNA Community',
     'group_name' => 'UNA Community',
     'group_desc' => 'Introduce yourself, share what you are building with UNA and NEO, and ask questions.',
     'group_desc' => 'Introduce yourself, share what you are building with UNA and NEO, and ask questions.',
     'allow_view_to' => BX_DOL_PG_ALL,
     'allow_view_to' => BX_DOL_PG_ALL,
@@ -92,6 +92,8 @@ if (!empty($r['content']['profile_id'])) {
     $iGroupProfileId = (int)$r['content']['profile_id'];
     $iGroupProfileId = (int)$r['content']['profile_id'];
     seedLog('group UNA Community');
     seedLog('group UNA Community');
 }
 }
+else
+    seedLog('group skipped: ' . ($r['message'] ?? 'unknown'));
 
 
 // --- posts, each with a couple of comments from other people
 // --- posts, each with a couple of comments from other people
 $aPosts = [
 $aPosts = [