Skip to content

Commit

Permalink
Merge pull request #369 from SU-SWS/release-4.2.0
Browse files Browse the repository at this point in the history
Release 4.2.0
  • Loading branch information
joegl authored Feb 21, 2024
2 parents db9bbc8 + 5d8d601 commit 7383312
Show file tree
Hide file tree
Showing 139 changed files with 10,861 additions and 1,597 deletions.
46 changes: 45 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,50 @@
# ACE SDSSGryphon

4.0.3
4.2.0
--------------------------------------------------------------------------------
_Release Date: 2024-02-21_

- 5d94fee3 (HEAD -> 4.x, origin/4.x) SDSS-812: SQUIZ | Add and enable Stanford Syndication module (#207)
- d4f60062 Sdss 1070 button margins (#362)
- f63bac6c (SDSS-835--fix-illegal-choice) SDSS-1166: Use service to load config sync storage (#366)
- 1c2d26ce SDSS-1176 and SDSS-241: fixup to the cards when added to a green background (#351)
- 6eaebd15 SDSS-1166: Added Media Mention field and displays to List paragraph (#346)
- 789a4a94 SDSS-1172: Added sync-staging and show-sites BLT Commands (#363)
- c486a94c SDSS-988: Fixed SDSS reviewer role (#361)
- d1b0af1c SDSS-372: Open up metatag defaults for editing (#360)
- 631cc0e5 SDSS-350: Added Room Reservation config_split and updated stanford_earth_r25 module (#340)
- 8efba57e Merge branch '4.x' of github.com:SU-SWS/ace-sdssgryphon into 4.x
- 1556baf8 Fixed example.local.sites.php.
- 7d3ec988 SDSS-1129: Rename four-column layout to one-four-one (#359)
- de0982df Added example.local.sites.php.
- c20c9174 SDSS-1129: 4 column layout with a header and footer, an ibeam (#338)
- 19e5e562 SDSS-1188: Linked Newsroom menu logo to /news page (#355)
- f5085d56 SDSS-997: Remove local footer lockup and replace with SDSS logo (#357)
- 865817f8 SDSS-000: Moved manage content menu link to bottom of content menu (#356)
- 0cf66e6a SDSS-000: Updated stanford_layout_paragraphs patch to remove test.
- 50ba8bf0 SDSS-000: Added patch to drop layout paragraph restrictions from stanford_layout_paragraphs (#358)
- 22d85c6a SDSS-1170: Add region based paragraph restrictions for layout_paragraphs (#353)
- 8597d70d SDSS-988: Added Reviewer role (#264)
- 63b07130 SDSS-469: Removed lock-up options SDSS does not support (#277)
- 93e9e465 SDSS-1183 | @jdwjdwjdw | Add padding to two-column editorial sidebar's with background colors (#354)
- 757381df SDSS-1157: Circle backgrounds on News Spotlight. (#344)
- c69bdbbd Update Card help text (#289)
- 2bb66fc1 SDSS-1081: removed the margin from further up the tree (#350)
- a8d31b6c SDSS-1134: Added Manage Content views and menu for key content types (#345)
- 062a97e6 SDSS-1060: Removed featured media label from view (#287)
- 9c04be27 SDSS-289: Enabled nesting on Shared Tags (#352)
- 6dbddd31 SDSS-1173: Display Stanford site alias on Status Report page (#349)
- b2588966 SDSS-985: Increased list paragraphs term depth (#313)
- e1b42970 SDSS-1163: Provision sustainablemobility (#348)
- f5df4b90 SDSS-1160: Provision environmentalsocialsci (#342)
- d812eaa6 SDSS-846: fix the misspelled tabindex (#341)
- f3ec990a SDSS-1076: Widening the max-width of site to 2000px (#315)
- b529a2b4 SDSS-1135: Point eep alias to gep site (#337)
- 7009187f Merge pull request #336 from SU-SWS/backtodev-4.1.1
- c36e248b (origin/backtodev-4.1.1, backtodev-4.1.1) backtodev-4.1.1


4.1.0
--------------------------------------------------------------------------------
_Release Date: 2023-12-13_

Expand Down
2 changes: 2 additions & 0 deletions blt/blt.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ multisites:
- environment_ecosystems
- environmentalbehavior
- environmentalpolicy
- environmentalsocialsci
- ese
- esys
- explore_energy
Expand Down Expand Up @@ -67,6 +68,7 @@ multisites:
- strategic_energy_alliance
- sustainability
- sustainability_accelerator
- sustainablemobility
- understand_energy_course
- understandenergy
- water
Expand Down
180 changes: 179 additions & 1 deletion blt/src/Blt/Plugin/Commands/GryphonAcquiaApiCommands.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace Gryphon\Blt\Plugin\Commands;

use AcquiaCloudApi\Endpoints\Crons;
use GuzzleHttp\Client;
use Sws\BltSws\Blt\Plugin\Commands\SwsCommandTrait;
use Symfony\Component\Console\Question\Question;

Expand Down Expand Up @@ -67,13 +68,154 @@ public function createDatabase() {
* @command gryphon:add-domain
* @aliases grad
*/
public function humsciAddDomain($environment, $domains) {
public function gryphonAddDomain($environment, $domains) {
$this->connectAcquiaApi();
foreach (explode(',', $domains) as $domain) {
$this->say($this->acquiaDomains->create($this->getEnvironmentUuid($environment), $domain)->message);
}
}

/**
* Display all sites on the multi-site and a total count of sites.
*
* @command sdss:show-sites
* @aliases sites
*/
public function showSites() {
$sites = $this->getConfigValue('multisites');
asort($sites);
foreach ($sites as $key => $site) {
$this->say(sprintf('%s', $site));
}
$this->say(sprintf('Total sites: %s', count($sites)));
}

/**
* Copy databases from production sites to staging sites. Includes option to
* copy to dev sites.
*
* @command sdss:sync-stage
* @aliases stage
*
* @option exclude Comma separated list of database names to skip.
* @option force Force copying of databases even if they were already copied
* recently.
*/
public function syncStaging(array $options = [
'exclude' => NULL,
'force' => FALSE,
'env' => 'test',
'no-notify' => FALSE,
]) {
$this->connectAcquiaApi();
$from_uuid = $this->getEnvironmentUuid('prod');
$to_uuid = $this->getEnvironmentUuid($options['env']);

$this->taskStartedTime = time() - (60 * 60 * 24);

$sites = $this->getSitesToSync($options);
if (empty($options['no-interaction']) && !$this->confirm(sprintf('Are you sure you wish to stage the following sites: <comment>%s</comment>', implode(', ', $sites)))) {
return;
}
$count = count($sites);
$concurrent_copies = 5;
$in_progress = [];
while (!empty($sites)) {
if (count($in_progress) >= $concurrent_copies) {
// Check for completion.
foreach ($in_progress as $key => $database_name) {
if ($this->databaseCopyFinished($database_name)) {
unset($in_progress[$key]);
}
}
}

$copy_these = array_splice($sites, 0, $concurrent_copies - count($in_progress));
foreach ($copy_these as $database_name) {
$in_progress[] = $database_name;
$this->say(sprintf('Copying database %s', $database_name));
$access_token = $this->getAccessToken();
$client = new Client();
$response = $client->post("https://cloud.acquia.com/api/environments/$to_uuid/databases", [
'headers' => ['Authorization' => "Bearer $access_token"],
'json' => ['name' => $database_name, 'source' => $from_uuid],
]);
$message = json_decode((string) $response->getBody(), TRUE, 512, JSON_THROW_ON_ERROR);
$this->say($message['message']);
}
echo '.';
sleep(30);
}
$this->yell("$count database have been copied to staging.");

$root = $this->getConfigValue('repo.root');
if (file_exists("$root/keys/secrets.settings.php")) {
include "$root/keys/secrets.settings.php";
}
if (!$options['no-notify'] && getenv('SLACK_NOTIFICATION_URL')) {
$client = new Client();
$client->post(getenv('SLACK_NOTIFICATION_URL'), [
'form_params' => [
'payload' => json_encode([
'username' => 'Acquia Cloud',
'text' => sprintf('%s Databases have been copied to %s environment.', $count, $options['env']),
'icon_emoji' => 'information_source',
]),
],
]);
}
}

/**
* Call the API and using the notifications, find out if it's done copying.
*
* @param string $database_name
* Acquia database name.
*
* @return bool
* If the database has been copied in the past 12 hours.
*/
protected function databaseCopyFinished(string $database_name): bool {
$access_token = $this->getAccessToken();
$client = new Client();
$created_since = date('c', time() - (60 * 60 * 12));
$response = $client->get("https://cloud.acquia.com/api/applications/{$this->appId}/notifications", [
'headers' => ['Authorization' => "Bearer $access_token"],
'query' => [
'filter' => "event=DatabaseCopied;description=@*$database_name*;status!=in-progress;created_at>=$created_since",
],
]);
$message = json_decode((string) $response->getBody(), TRUE, 512, JSON_THROW_ON_ERROR);
return $message['total'] > 0;
}

/**
* Call the API and fetch the OAuth token.
*
* @return string
* Access bearer token.
*/
protected function getAccessToken(): string {
if (isset($this->accessToken['expires']) && time() <= $this->accessToken['expires']) {
return $this->accessToken['token'];
}

$client = new Client();
$response = $client->post('https://accounts.acquia.com/api/auth/oauth/token', [
'form_params' => [
'client_id' => getenv('ACQUIA_KEY'),
'client_secret' => getenv('ACQUIA_SECRET'),
'grant_type' => 'client_credentials',
],
]);
$response_body = json_decode((string) $response->getBody(), TRUE, 512, JSON_THROW_ON_ERROR);
$this->accessToken = [
'token' => $response_body['access_token'],
'expires' => time() + $response_body['expires_in'] - 60,
];
return $this->accessToken['token'];
}

/**
* Create the Acquia cloud conf file that holds the key and secret creds.
*
Expand All @@ -92,6 +234,42 @@ protected function connectAcquiaApi() {
self::traitConnectAcquiaApi();
}

/**
* Get an overall list of database names to sync.
*
* @param array $options
* Array of keyed command options.
*
* @return array
* Array of database names to sync.
*/
protected function getSitesToSync(array $options) {
$sites = $this->getConfigValue('multisites');
foreach ($sites as $key => &$db_name) {
$db_name = $db_name == 'default' ? 'stanfordsos' : $db_name;

if (strpos($db_name, 'sandbox') !== FALSE) {
unset($sites[$key]);
continue;
}

if(!$options['force']) {
$this->say(sprintf('Checking if %s has recently been copied', $db_name));
if ($this->databaseCopyFinished($db_name)) {
unset($sites[$key]);
}
}
}
asort($sites);
$sites = array_values($sites);
if (!empty($options['exclude'])) {
$exclude = explode(',', $options['exclude']);

$sites = array_diff($sites, $exclude);
}
return array_values($sites);
}

/**
* Ask the user for a new stanford url and validate the entry.
*
Expand Down
10 changes: 7 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,12 @@
"type": "package",
"package": {
"name": "stanford-earth/stanford_earth_r25",
"version": "8.1.10",
"version": "8.1.12",
"type": "drupal-custom-module-rooms-site",
"source": {
"type": "git",
"url": "https://github.com/stanford-earth/stanford_earth_r25",
"reference": "8.1.10"
"reference": "8.1.12"
}
}
}
Expand Down Expand Up @@ -200,7 +200,8 @@
"su-sws/stanford_media": "^10.0",
"su-sws/stanford_migrate": "^8.3",
"su-sws/stanford_profile_helper": "^9.3",
"su-sws/stanford_samlauth": "^1.0"
"su-sws/stanford_samlauth": "^1.0",
"su-sws/stanford_syndication": "^1.0"
},
"require-dev": {
"acquia/blt-drupal-test": "^1.0",
Expand Down Expand Up @@ -324,6 +325,9 @@
},
"drupal/ui_patterns": {
"Ui Patterns Views Fixes": "patches/contrib/ui_patterns_views-preview.patch"
},
"su-sws/stanford_profile_helper": {
"Remove paragraph layout restrictions from stanford_layout_paragraphs": "patches/stanford/stanford_layout_paragraphs.patch"
}
}
},
Expand Down
37 changes: 34 additions & 3 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 24 additions & 0 deletions docroot/profiles/sdss/sdss_profile/config/sdssrooms/.htaccess
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Deny all requests from Apache 2.4+.
<IfModule mod_authz_core.c>
Require all denied
</IfModule>

# Deny all requests from Apache 2.0-2.2.
<IfModule !mod_authz_core.c>
Deny from all
</IfModule>

# Turn off all options we don't need.
Options -Indexes -ExecCGI -Includes -MultiViews

# Set the catch-all handler to prevent scripts from being executed.
SetHandler Drupal_Security_Do_Not_Remove_See_SA_2006_006
<Files *>
# Override the handler again if we're run later in the evaluation list.
SetHandler Drupal_Security_Do_Not_Remove_See_SA_2013_003
</Files>

# If we know how to do it safely, disable the PHP engine entirely.
<IfModule mod_php5.c>
php_flag engine off
</IfModule>
Loading

0 comments on commit 7383312

Please sign in to comment.