Skip to content
Permalink
Browse files

Merge pull request #4629 from vanilla/feature/upgrade-warning

Add an upgrade warning for PHP and MySQL to all settings pages
  • Loading branch information...
DaazKu committed Oct 12, 2016
2 parents 97c065a + d5459af commit 4ebdf6a393212c12cf1b655e5883b121026805b9
Showing with 27 additions and 1 deletion.
  1. +27 −1 applications/dashboard/settings/class.hooks.php
@@ -74,8 +74,9 @@ public function base_render_before($Sender) {
$MessageModule = new MessageModule($Sender, $Message);
if ($SignInOnly) { // Insert special messages even in SignIn popup
echo $MessageModule;
} elseif ($Sender->deliveryType() == DELIVERY_TYPE_ALL)
} elseif ($Sender->deliveryType() == DELIVERY_TYPE_ALL) {
$Sender->addModule($MessageModule);
}
}
$Sender->MessagesLoaded = '1'; // Fixes a bug where render gets called more than once and messages are loaded/displayed redundantly.
}
@@ -137,6 +138,31 @@ public function base_render_before($Sender) {
$Sender->addDefinition("TagHint", t("TagHint", "Start to type..."));
}
/**
* Aggressively prompt users to upgrade PHP version.
*
* @param $sender
*/
public function settingsController_render_before($sender) {
// Set this in your config to dismiss our upgrade warnings. Not recommended.
if (c('Vanilla.WarnedMeToUpgrade') === 'PHP 5.6') {
return;
}
if (version_compare(phpversion(), '5.6') < 0) {
$UpgradeMessage = ['Content' => 'Upgrade to <b>PHP 5.6</b> or higher immediately. Version '.phpversion().' is no longer supported.', 'AssetTarget' => 'Content', 'CssClass' => 'WarningMessage'];
$MessageModule = new MessageModule($sender, $UpgradeMessage);
$sender->addModule($MessageModule);
}
$mysqlVersion = gdn::sql()->version();
if (version_compare($mysqlVersion, '5.6') < 0) {
$UpgradeMessage = ['Content' => 'We recommend using <b>MySQL 5.6</b> or higher. Version '.htmlspecialchars($mysqlVersion).' will not support all upcoming Vanilla features.', 'AssetTarget' => 'Content', 'CssClass' => 'InfoMessage'];
$MessageModule = new MessageModule($sender, $UpgradeMessage);
$sender->addModule($MessageModule);
}
}
/**
* @param $Sender
*/

0 comments on commit 4ebdf6a

Please sign in to comment.
You can’t perform that action at this time.