Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Address comments on #2492 #2499

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/3x.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ jobs:
env:
TERMINUS_TOKEN: ${{ secrets.TERMINUS_TOKEN }}
TERMINUS_SITE: ${{ secrets.TERMINUS_SITE }}
TERMINUS_SITE_WP: ${{ secrets.TERMINUS_SITE_WP }}
TERMINUS_SITE_WP_NETWORK: ${{ secrets.TERMINUS_SITE_WP_NETWORK }}
TERMINUS_ORG: ${{ secrets.TERMINUS_ORG }}
TERMINUS_BASE_DIR: ${{ secrets.TERMINUS_BASE_DIR }}
TERMINUS_PLUGINS_DIR: ${{ secrets.TERMINUS_PLUGINS_DIR }}
Expand Down
12 changes: 10 additions & 2 deletions src/Collections/TerminusCollection.php
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,16 @@ public function fetch()
'type' => gettype($model_data),
'bad_data' => $bad_data
];
$this->logger->error($error_message, $context);
break;

// verbose logging for debugging
$this->logger->debug($error_message, $context);

// less information for more user-facing messages, but a problem has occurred and we're skipping this
// item so we should still surface a user-facing message
$this->logger->warn("Model data missing for {id}", ['id' => $id,]);

// skip this item since it lacks useful data
continue;
}
if (!isset($model_data->id)) {
$model_data->id = $id;
Expand Down
3 changes: 3 additions & 0 deletions src/Commands/StructuredListTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,9 @@ private function addDatetimeRenderer(AbstractStructuredList $list, array $date_a
$list->addRendererFunction(
function ($key, $cell_data) use ($config, $date_attributes) {
if (!is_numeric($key) && in_array($key, $date_attributes)) {
if (empty($cell_data)) {
return '-';
}
return $config->formatDatetime($cell_data);
}
return $cell_data;
Expand Down
13 changes: 9 additions & 4 deletions src/Models/Environment.php
Original file line number Diff line number Diff line change
Expand Up @@ -168,10 +168,15 @@ public function cloneDatabase(Environment $from_env, array $options = [])
if (isset($options['updatedb'])) {
$options['updatedb'] = (int)$options['updatedb'];
}
$params = array_merge(
['from_environment' => $from_env->getName(),],
$options
);
$params = [
'from_environment' => $from_env->getName(),
'updatedb' => $options['updatedb'] ?? 0,
'clear_cache' => $options['clear_cache'] ?? false,
];
if (!empty($options['from_url']) && !empty($options['to_url'])) {
$params['wp_replace_siteurl']['from_url'] = $options['from_url'];
$params['wp_replace_siteurl']['to_url'] = $options['to_url'];
}
return $this->getWorkflows()->create(
'clone_database',
compact('params')
Expand Down
1 change: 1 addition & 0 deletions src/Request/Request.php
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,7 @@ private function createRetryDecider(): callable
}
}

// It's been observed in the wild that sometimes $response is null. Get a different error message in that case.
if (is_object($response) && is_object($response->getBody()) && $response->getBody()->getContents() !== '') {
$error = $response->getBody()->getContents();
} elseif (null !== $exception && '' != $exception->getMessage()) {
Expand Down
1 change: 1 addition & 0 deletions src/Terminus.php
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,7 @@ private function addBuiltInCommandsAndHooks()
{
// List of all hooks and commands. Update via 'composer update-class-lists'
$this->commands = [
'Consolidation\\Filter\\Hooks\\FilterHooks',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good find; wonder when this got dropped.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That didn't... those are more recent changes already on 3.x that I merged back. I closed this PR because I merged the 3.x changes back to Jordan's branch too but they were still showing in this PR, and they're not real changes, so I made a new PR that doesn't show them.

'Pantheon\\Terminus\\Hooks\\Authorizer',
'Pantheon\\Terminus\\Hooks\\RoleValidator',
'Pantheon\\Terminus\\Hooks\\SiteEnvLookup',
Expand Down