From 14f2acfd38c71650cc74a7c42a827a7f7265cccc Mon Sep 17 00:00:00 2001 From: Liam Morland Date: Mon, 11 Jan 2021 14:49:56 -0500 Subject: [PATCH 1/2] Coding standards --- devops/uw_devops.inc | 4 ++-- devops/uw_devops.sites.inc | 2 -- uw_wcms_tools.drupal.modules.inc | 2 +- uw_wcms_tools.gitlab.inc | 2 +- uw_wcms_tools.module | 1 + uw_wcms_tools.tickets.inc | 2 +- 6 files changed, 6 insertions(+), 7 deletions(-) diff --git a/devops/uw_devops.inc b/devops/uw_devops.inc index aaaafd5..ccc9beb 100644 --- a/devops/uw_devops.inc +++ b/devops/uw_devops.inc @@ -273,8 +273,8 @@ function pool_info($fqdn = FALSE) { foreach ($pools as &$pool) { $pool['host'] .= 'uwaterloo.ca'; $pool['dbmach'] .= '.uwaterloo.ca'; - foreach ($pool['engine'] as &$engine) { - $engine .= '.uwaterloo.ca'; + foreach (array_keys($pool['engine']) as $key) { + $pool['engine'][$key] .= '.uwaterloo.ca'; } } } diff --git a/devops/uw_devops.sites.inc b/devops/uw_devops.sites.inc index 16c9117..ea22f50 100644 --- a/devops/uw_devops.sites.inc +++ b/devops/uw_devops.sites.inc @@ -33,7 +33,6 @@ function create_skeleton($site_url, $profile_version_name, array $redirects = ar $pool_info = pool_info(); $engine = $pool_info[$pool]['engine']; $dbmach = $pool_info[$pool]['dbmach']; - $host = $pool_info[$pool]['host']; echo "Checking if destination profile exists...\n"; if (!$drupal_root = valid_drupal_root($engine[0], WEB_ROOT . '/' . $profile_version_name)) { @@ -569,7 +568,6 @@ function drush_install_site($pool, $url_path, $profile = NULL, array $site_argum echo "Starting Drush site install...\n"; $file_path = url_path_to_file_path($url_path); - $file_path_root = get_drupal_root($pool, $url_path) . '/sites/' . $file_path; if (!$profile) { $profile = get_profile_version($pool, $url_path); diff --git a/uw_wcms_tools.drupal.modules.inc b/uw_wcms_tools.drupal.modules.inc index 2e34aec..b3697bd 100644 --- a/uw_wcms_tools.drupal.modules.inc +++ b/uw_wcms_tools.drupal.modules.inc @@ -39,7 +39,7 @@ function uw_wcms_tools_contrib_module_update_form_validate(array $form, array &$ $form_state['values']['version'] = $matches[2]; } else { - form_set_error('url', 'Invalid module update URL.'); + form_set_error('url', t('Invalid module update URL.')); } } diff --git a/uw_wcms_tools.gitlab.inc b/uw_wcms_tools.gitlab.inc index 48f6a15..7573b99 100644 --- a/uw_wcms_tools.gitlab.inc +++ b/uw_wcms_tools.gitlab.inc @@ -497,7 +497,7 @@ function uw_wcms_tools_gitlab_project_create(string $group, string $path): array if ($r['http_status'] === 201) { // Settings do not all save on creation, so update them here. uw_wcms_tools_gitlab_project_update_features($r['body']->id); - $teams = uw_wcms_tools_gitlab_project_ms_teams_integration_update($r['body']->id); + uw_wcms_tools_gitlab_project_ms_teams_integration_update($r['body']->id); } return $r; diff --git a/uw_wcms_tools.module b/uw_wcms_tools.module index 4525b5d..84cf737 100644 --- a/uw_wcms_tools.module +++ b/uw_wcms_tools.module @@ -12,6 +12,7 @@ function uw_wcms_tools_menu() { $items = array(); $items['wcms-tools'] = [ 'page callback' => 'drupal_goto', + // Always allow redirect. 'access callback' => TRUE, ]; $items['wcms-tools/tickets'] = [ diff --git a/uw_wcms_tools.tickets.inc b/uw_wcms_tools.tickets.inc index 8296bea..edb915a 100644 --- a/uw_wcms_tools.tickets.inc +++ b/uw_wcms_tools.tickets.inc @@ -47,7 +47,7 @@ function uw_wcms_tools_ticket_create_form_validate(array $form, array &$form_sta $type = 'RT'; } if (!$id) { - form_set_error('url', 'Invalid ticket ID.'); + form_set_error('url', t('Invalid ticket ID.')); } $form_state['values']['ticket_id'] = $id; $form_state['values']['ticket_type'] = $type; -- GitLab From a5f60dd59bab508375c56967d19e84d2bdf494fc Mon Sep 17 00:00:00 2001 From: Liam Morland Date: Mon, 11 Jan 2021 14:41:39 -0500 Subject: [PATCH 2/2] Allow renaming of sites that have a makefile if a makefile exists at the new name --- devops/uw_devops.sites.inc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/devops/uw_devops.sites.inc b/devops/uw_devops.sites.inc index ea22f50..7d3933b 100644 --- a/devops/uw_devops.sites.inc +++ b/devops/uw_devops.sites.inc @@ -679,7 +679,7 @@ function site_copy_full($from_url, $to, $create_skeleton = TRUE) { throw new Exception('"from" and "to" are the same place.'); } - if ($from_url_path !== $to_url_path && site_makefile_exists($from_url_path)) { + if ($from_url_path !== $to_url_path && site_makefile_exists($from_url_path) && !site_makefile_exists($to_url_path)) { throw new Exception('Site has a makefile. You must rename it before copying so that the skeleton will have the makefile built in it.'); } -- GitLab