From 0d2b4cd3cceebe55b2e89c95ae10102901eb7774 Mon Sep 17 00:00:00 2001 From: Demian Katz <demian.katz@villanova.edu> Date: Thu, 11 Oct 2012 14:54:16 -0400 Subject: [PATCH] Eliminated [GoogleSearch] setting (search API is now deprecated and should no longer be used -- no reason to support in VuFind 2); created central method for storing warnings in \VuFind\Config\Upgrade (for easier debugging, etc.). --- config/vufind/config.ini | 11 ----- module/VuFind/src/VuFind/Config/Upgrade.php | 49 ++++++++++++++++----- 2 files changed, 38 insertions(+), 22 deletions(-) diff --git a/config/vufind/config.ini b/config/vufind/config.ini index 051a44dd400..dcde0581105 100644 --- a/config/vufind/config.ini +++ b/config/vufind/config.ini @@ -413,17 +413,6 @@ url = "http://syndetics.com" url = "http://contentcafe2.btol.com" pw = "Password" -; Web Search is Optional. The Web Search is powered by Google. -; To use enter your Google Web Search key and the domain the of your library -; website. -; The side_recommend setting is used to load recommendations modules; see -; searches.ini for a list of options (though not all will work in this context). -; You can set it to false if you do not want to display any recommendations. -;[GoogleSearch] -;key = MyGoogleSearchKey -;domain = library.myuniversity.edu -;side_recommend[] = CatalogResults:lookfor - ; Summon is Optional. See also the separate Summon.ini file. ;[Summon] ;apiId = myAccessId diff --git a/module/VuFind/src/VuFind/Config/Upgrade.php b/module/VuFind/src/VuFind/Config/Upgrade.php index af2abde59d0..95a86bee202 100644 --- a/module/VuFind/src/VuFind/Config/Upgrade.php +++ b/module/VuFind/src/VuFind/Config/Upgrade.php @@ -109,6 +109,18 @@ class Upgrade return $this->warnings; } + /** + * Add a warning message. + * + * @param string $msg Warning message. + * + * @return void + */ + protected function addWarning($msg) + { + $this->warnings[] = $msg; + } + /** * Support function -- merge the contents of two arrays parsed from ini files. * @@ -313,10 +325,12 @@ class Upgrade if (!file_exists(APPLICATION_PATH . '/themes/' . $theme) || !is_dir(APPLICATION_PATH . '/themes/' . $theme) ) { - $this->warnings[] = "WARNING: This version of VuFind does not support " + $this->addWarning( + "WARNING: This version of VuFind does not support " . "the {$theme} theme. Your config.ini [Site] {$setting} setting " . "has been reset to the default: {$default}. You may need to " - . "reimplement your custom theme."; + . "reimplement your custom theme." + ); $this->newConfigs['config.ini']['Site'][$setting] = $default; } } @@ -357,19 +371,30 @@ class Upgrade && stristr($newConfig['Content']['coverimages'], 'amazon'); if ($hasAmazonReview || $hasAmazonCover) { if (!isset($newConfig['Content']['amazonsecret'])) { - $this->warnings[] - = 'WARNING: You have Amazon content enabled but are missing ' + $this->addWarning( + 'WARNING: You have Amazon content enabled but are missing ' . 'the required amazonsecret setting in the [Content] section ' - . 'of config.ini'; + . 'of config.ini' + ); } if (!isset($newConfig['Content']['amazonassociate'])) { - $this->warnings[] - = 'WARNING: You have Amazon content enabled but are missing ' + $this->addWarning( + 'WARNING: You have Amazon content enabled but are missing ' . 'the required amazonassociate setting in the [Content] section' - . ' of config.ini'; + . ' of config.ini' + ); } } + // Warn the user if they have enabled a deprecated Google API: + if (isset($newConfig['GoogleSearch'])) { + unset($newConfig['GoogleSearch']); + $this->addWarning( + 'The [GoogleSearch] section of config.ini is no ' + . 'longer supported due to changes in Google APIs.' + ); + } + // Warn the user if they are using an unsupported theme: $this->checkTheme('theme', 'blueprint'); $this->checkTheme('mobile_theme', 'jquerymobile'); @@ -684,10 +709,12 @@ class Upgrade $driver = isset($this->newConfigs['config.ini']['Catalog']['driver']) ? $this->newConfigs['config.ini']['Catalog']['driver'] : ''; if (empty($driver)) { - $this->warnings[] = "WARNING: Could not find ILS driver setting."; + $this->addWarning("WARNING: Could not find ILS driver setting."); } else if (!file_exists($this->oldDir . '/' . $driver . '.ini')) { - $this->warnings[] = "WARNING: Could not find {$driver}.ini file; " - . "check your ILS driver configuration."; + $this->addWarning( + "WARNING: Could not find {$driver}.ini file; " + . "check your ILS driver configuration." + ); } else { $this->saveUnmodifiedConfig($driver . '.ini'); } -- GitLab