Skip to content

Commit daab055

Browse files
author
Sam Tuke
authored
Merge pull request #525 from phpList/notification-logic
Improve notification logic
2 parents 1c49993 + e579300 commit daab055

File tree

2 files changed

+6
-16
lines changed

2 files changed

+6
-16
lines changed

public_html/lists/admin/index.php

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -521,23 +521,15 @@ function mb_strtolower($string)
521521
echo Info($GLOBALS['I18N']->get('Running in testmode, no emails will be sent. Check your config file.'));
522522
}
523523

524-
if (!strpos(VERSION, 'dev')){
524+
if (!strpos(VERSION, 'dev')) {
525525

526526
$updaterdir = __DIR__ . '/../updater';
527527

528528
include 'updateLib.php';
529529

530-
if (showUpdateNotification()) {
531-
try {
532-
533-
$updateNotif = checkForUpdate('init.php');
534-
535-
} catch (Exception $e) {
536-
537-
echo s('Error: '), $e->getMessage(), "\n";
538-
539-
}
530+
if (showUpdateNotification() && (getCurrentphpListVersion() !== false) && extension_loaded('curl')) {
540531

532+
$updateNotif = checkForUpdate('init.php');
541533
$moreInfo = '<a href="https://www.phplist.com/download?utm_source=pl' . VERSION . '&amp;utm_medium=updatedownload&amp;utm_campaign=phpList" title="' . s('Download the new version') . '" target="_blank">' . s('Download the new version') . '</a>';
542534

543535
if (file_exists($updaterdir) && ALLOW_UPDATER) {

public_html/lists/admin/updateLib.php

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@
33
* Get Current phpList Version.
44
*
55
* @param string $path Production version location
6-
* @return mixed
7-
* @throws Exception
6+
* @return string|bool
87
*/
98
function getCurrentphpListVersion($path = '')
109
{
@@ -13,11 +12,10 @@ function getCurrentphpListVersion($path = '')
1312
preg_match_all('/define\(\"VERSION\",\"(.*)\"\);/', $version, $matches);
1413

1514
if (isset($matches[1][0])) {
16-
1715
return $matches[1][0];
16+
} else {
17+
return false;
1818
}
19-
20-
throw new Exception(s('No production version found.'));
2119
}
2220

2321
/**

0 commit comments

Comments
 (0)