From cfb48750e1c4516d620617723ce234b783d50c8b Mon Sep 17 00:00:00 2001 From: Tim Otten Date: Sat, 22 Feb 2020 16:39:21 -0800 Subject: [PATCH] (NFC) Update civicrm-setup to current civilint --- setup/plugins/blocks/advanced.tpl.php | 3 +- setup/plugins/blocks/components.tpl.php | 3 +- setup/plugins/blocks/header.tpl.php | 15 +++---- setup/plugins/blocks/install.tpl.php | 3 +- setup/plugins/blocks/l10n.tpl.php | 3 +- setup/plugins/blocks/opt-in.disabled.php | 3 +- setup/plugins/blocks/opt-in.tpl.php | 3 +- setup/plugins/blocks/requirements.tpl.php | 3 +- setup/plugins/blocks/sample-data.tpl.php | 3 +- .../GenerateSiteKey.civi-setup.php | 24 +++++------ setup/res/finished.Backdrop.php | 2 +- setup/src/Setup/DrupalUtil.php | 40 +++++++++---------- setup/src/Setup/UI/Event/UIConstructEvent.php | 6 +-- 13 files changed, 59 insertions(+), 52 deletions(-) diff --git a/setup/plugins/blocks/advanced.tpl.php b/setup/plugins/blocks/advanced.tpl.php index 9ff3dc16d7..971d22c1fd 100644 --- a/setup/plugins/blocks/advanced.tpl.php +++ b/setup/plugins/blocks/advanced.tpl.php @@ -1,4 +1,5 @@ - +

diff --git a/setup/plugins/blocks/components.tpl.php b/setup/plugins/blocks/components.tpl.php index 27c007deeb..0c129709b4 100644 --- a/setup/plugins/blocks/components.tpl.php +++ b/setup/plugins/blocks/components.tpl.php @@ -1,4 +1,5 @@ - +

diff --git a/setup/plugins/blocks/header.tpl.php b/setup/plugins/blocks/header.tpl.php index 65bf8f1625..274900a498 100644 --- a/setup/plugins/blocks/header.tpl.php +++ b/setup/plugins/blocks/header.tpl.php @@ -1,11 +1,12 @@ - +
-
-


-
- +
+


+
+

diff --git a/setup/plugins/blocks/install.tpl.php b/setup/plugins/blocks/install.tpl.php index c2da1c3c1b..81e005f1ab 100644 --- a/setup/plugins/blocks/install.tpl.php +++ b/setup/plugins/blocks/install.tpl.php @@ -1,4 +1,5 @@ - +
+

Learn more about using CiviCRM in other languages.', array(1 => 'http://wiki.civicrm.org/confluence/pages/viewpage.action?pageId=88408149', 2 => '_blank')); ?>

diff --git a/setup/plugins/blocks/opt-in.disabled.php b/setup/plugins/blocks/opt-in.disabled.php index 9a9beb777b..6c471163ac 100644 --- a/setup/plugins/blocks/opt-in.disabled.php +++ b/setup/plugins/blocks/opt-in.disabled.php @@ -18,7 +18,8 @@ if (!defined('CIVI_SETUP')) { \Civi\Setup::log()->info(sprintf('[%s] Register blocks', basename(__FILE__))); $e->getCtrl()->blocks['opt-in'] = array( - 'is_active' => TRUE, // FIXME + // FIXME + 'is_active' => TRUE, 'file' => __DIR__ . DIRECTORY_SEPARATOR . 'opt-in.tpl.php', 'class' => 'if-no-errors', 'weight' => 55, diff --git a/setup/plugins/blocks/opt-in.tpl.php b/setup/plugins/blocks/opt-in.tpl.php index ca51a55b40..fb05218bf9 100644 --- a/setup/plugins/blocks/opt-in.tpl.php +++ b/setup/plugins/blocks/opt-in.tpl.php @@ -1,4 +1,5 @@ - +

diff --git a/setup/plugins/blocks/requirements.tpl.php b/setup/plugins/blocks/requirements.tpl.php index f33063504f..0066bfd157 100644 --- a/setup/plugins/blocks/requirements.tpl.php +++ b/setup/plugins/blocks/requirements.tpl.php @@ -1,4 +1,5 @@ - +

+

diff --git a/setup/plugins/installFiles/GenerateSiteKey.civi-setup.php b/setup/plugins/installFiles/GenerateSiteKey.civi-setup.php index b055f32f1c..41928788dc 100644 --- a/setup/plugins/installFiles/GenerateSiteKey.civi-setup.php +++ b/setup/plugins/installFiles/GenerateSiteKey.civi-setup.php @@ -17,18 +17,18 @@ if (!defined('CIVI_SETUP')) { return preg_replace(';[^a-zA-Z0-9];', '', base64_encode($bits)); }; - if (!empty($e->getModel()->siteKey)) { - // skip - } - elseif (function_exists('random_bytes')) { - $e->getModel()->siteKey = $toAlphanum(random_bytes(32)); - } - elseif (function_exists('openssl_random_pseudo_bytes')) { - $e->getModel()->siteKey = $toAlphanum(openssl_random_pseudo_bytes(32)); - } - else { - throw new \RuntimeException("Failed to generate a random site key"); - } + if (!empty($e->getModel()->siteKey)) { + // skip + } + elseif (function_exists('random_bytes')) { + $e->getModel()->siteKey = $toAlphanum(random_bytes(32)); + } + elseif (function_exists('openssl_random_pseudo_bytes')) { + $e->getModel()->siteKey = $toAlphanum(openssl_random_pseudo_bytes(32)); + } + else { + throw new \RuntimeException("Failed to generate a random site key"); + } \Civi\Setup::log()->info(sprintf('[%s] Done %s', basename(__FILE__), 'installFiles')); diff --git a/setup/res/finished.Backdrop.php b/setup/res/finished.Backdrop.php index d62cdc6d62..51db493792 100644 --- a/setup/res/finished.Backdrop.php +++ b/setup/res/finished.Backdrop.php @@ -29,7 +29,7 @@ $backdropURL .= "index.php?q=civicrm/admin/configtask&reset=1"; $output .= "

  • " . ts("Backdrop user permissions have been automatically set - giving anonymous and authenticated users access to public CiviCRM forms and features. We recommend that you review these permissions to ensure that they are appropriate for your requirements (learn more...)", array( 1 => "target='_blank' href='{$backdropPermissionsURL}'", 2 => "target='_blank' href='http://wiki.civicrm.org/confluence/display/CRMDOC/Default+Permissions+and+Roles'", - )) . "
  • "; +)) . ""; $output .= "
  • " . ts("Use the Configuration Checklist to review and configure settings for your new site", array(1 => "target='_blank' href='$backdropURL'")) . "
  • "; $output .= $commonOutputMessage; $output .= ''; diff --git a/setup/src/Setup/DrupalUtil.php b/setup/src/Setup/DrupalUtil.php index 61405bc45c..5e8090a4b4 100644 --- a/setup/src/Setup/DrupalUtil.php +++ b/setup/src/Setup/DrupalUtil.php @@ -33,7 +33,7 @@ class DrupalUtil { static $siteDir = ''; if ($siteDir) { - return $siteDir; + return $siteDir; } // The SCRIPT_FILENAME check was copied over from the 'install/index.php' system. @@ -43,32 +43,32 @@ class DrupalUtil { $sites = DIRECTORY_SEPARATOR . 'sites' . DIRECTORY_SEPARATOR; $modules = DIRECTORY_SEPARATOR . 'modules' . DIRECTORY_SEPARATOR; preg_match("/" . preg_quote($sites, DIRECTORY_SEPARATOR) . - "([\-a-zA-Z0-9_.]+)" . - preg_quote($modules, DIRECTORY_SEPARATOR) . "/", - $_SERVER['SCRIPT_FILENAME'], $matches + "([\-a-zA-Z0-9_.]+)" . + preg_quote($modules, DIRECTORY_SEPARATOR) . "/", + $_SERVER['SCRIPT_FILENAME'], $matches ); $siteDir = isset($matches[1]) ? $matches[1] : 'default'; if (strtolower($siteDir) == 'all') { - // For this case - use drupal's way of finding out multi-site directory - $uri = explode(DIRECTORY_SEPARATOR, $_SERVER['SCRIPT_FILENAME']); - $server = explode('.', implode('.', array_reverse(explode(':', rtrim($_SERVER['HTTP_HOST'], '.'))))); - for ($i = count($uri) - 1; $i > 0; $i--) { - for ($j = count($server); $j > 0; $j--) { - $dir = implode('.', array_slice($server, -$j)) . implode('.', array_slice($uri, 0, $i)); - if (file_exists($cmsPath . DIRECTORY_SEPARATOR . - 'sites' . DIRECTORY_SEPARATOR . $dir - )) { - $siteDir = $dir; - return $siteDir; - } - } - } - $siteDir = 'default'; + // For this case - use drupal's way of finding out multi-site directory + $uri = explode(DIRECTORY_SEPARATOR, $_SERVER['SCRIPT_FILENAME']); + $server = explode('.', implode('.', array_reverse(explode(':', rtrim($_SERVER['HTTP_HOST'], '.'))))); + for ($i = count($uri) - 1; $i > 0; $i--) { + for ($j = count($server); $j > 0; $j--) { + $dir = implode('.', array_slice($server, -$j)) . implode('.', array_slice($uri, 0, $i)); + if (file_exists($cmsPath . DIRECTORY_SEPARATOR . + 'sites' . DIRECTORY_SEPARATOR . $dir + )) { + $siteDir = $dir; + return $siteDir; + } + } + } + $siteDir = 'default'; } return $siteDir; - */ + */ } } diff --git a/setup/src/Setup/UI/Event/UIConstructEvent.php b/setup/src/Setup/UI/Event/UIConstructEvent.php index d3740587d7..89d36c7447 100644 --- a/setup/src/Setup/UI/Event/UIConstructEvent.php +++ b/setup/src/Setup/UI/Event/UIConstructEvent.php @@ -2,8 +2,6 @@ namespace Civi\Setup\UI\Event; use Civi\Setup\Event\BaseSetupEvent; -use Civi\Setup\Event\SetupControllerInterface; -use Civi\Setup\UI\SetupController; /** * Create a web-based UI for handling the installation. @@ -15,14 +13,14 @@ class UIConstructEvent extends BaseSetupEvent { protected $ctrl; /** - * @return SetupControllerInterface + * @return \Civi\Setup\Event\SetupControllerInterface */ public function getCtrl() { return $this->ctrl; } /** - * @param SetupControllerInterface $ctrl + * @param \Civi\Setup\Event\SetupControllerInterface $ctrl */ public function setCtrl($ctrl) { $this->ctrl = $ctrl; -- 2.25.1