diff --git a/build.php b/build.php index 4672732b..322f4d71 100644 --- a/build.php +++ b/build.php @@ -1,4 +1,4 @@ '; + // If run from CLI, set the Hesk URL as host name + if (isset($_SERVER['SERVER_NAME'])) { + $host = $_SERVER['SERVER_NAME']; + } else { + global $hesk_settings; + + $parts = parse_url($hesk_settings['hesk_url']); + + if (empty($parts['host'])) { + $host = gethostname(); + $host = str_replace('>', '', $host); + } else { + $host = $parts['host']; + } + } + + return '<' . $id . '.' . gmdate('YmdHis') . '@' . $host . '>'; } // END hesk_generateMessageID() diff --git a/inc/footer.inc.php b/inc/footer.inc.php index e1bfcf3b..36d51985 100644 --- a/inc/footer.inc.php +++ b/inc/footer.inc.php @@ -60,10 +60,10 @@ https://www.hesk.com/buy.php $hesk_settings['hesk_license']('HAgc3R5bGU9InRleHQtYWxpZ246Y2VudGVyIj48c3BhbiBjb GFzcz0ic21hbGxlciI+Jm5ic3A7PGJyIC8+UG93ZXJlZCBieSA8YSBocmVmPSJodHRwczovL3d3dy5oZ XNrLmNvbSIgY2xhc3M9InNtYWxsZXIiIHRpdGxlPSJGcmVlIFBIUCBIZWxwIERlc2sgU29mdHdhcmUiP -khlbHAgRGVzayBTb2Z0d2FyZTwvYT4gPGI+SEVTSzwvYj4sIGJyb3VnaHQgdG8geW91IGJ5IDxhIGhyZ -WY9Imh0dHBzOi8vd3d3LnN5c2FpZC5jb20vP3V0bV9zb3VyY2U9SGVzayZhbXA7dXRtX21lZGl1bT1jc -GMmYW1wO3V0bV9jYW1wYWlnbj1IZXNrUHJvZHVjdF9Ub19IUCI+U3lzQWlkPC9hPjwvc3Bhbj48L3A+' -,"\120"); +khlbHAgRGVzayBTb2Z0d2FyZTwvYT4gPGI+SEVTSzwvYj4sIGluIHBhcnRuZXJzaGlwIHdpdGggPGEga +HJlZj0iaHR0cHM6Ly93d3cuc3lzYWlkLmNvbS8/dXRtX3NvdXJjZT1IZXNrJmFtcDt1dG1fbWVkaXVtP +WNwYyZhbXA7dXRtX2NhbXBhaWduPUhlc2tQcm9kdWN0X1RvX0hQIj5TeXNBaWQgVGVjaG5vbG9naWVzP +C9hPjwvc3Bhbj48L3A+',"\120"); include(HESK_PATH . 'footer.txt'); diff --git a/install/install_functions.inc.php b/install/install_functions.inc.php index bdf76f78..9e977660 100644 --- a/install/install_functions.inc.php +++ b/install/install_functions.inc.php @@ -15,8 +15,8 @@ if (!defined('IN_SCRIPT')) {die('Invalid attempt');} // We will be installing this HESK version: -define('HESK_NEW_VERSION','2.8.1'); -define('MODS_FOR_HESK_NEW_VERSION','2018.1.0'); +define('HESK_NEW_VERSION','2.8.2'); +define('MODS_FOR_HESK_NEW_VERSION','2018.1.1'); define('REQUIRE_PHP_VERSION','5.3.0'); define('REQUIRE_MYSQL_VERSION','5.0.7'); diff --git a/install/migrations/core.php b/install/migrations/core.php index 69b65f84..6a4c6c0b 100644 --- a/install/migrations/core.php +++ b/install/migrations/core.php @@ -231,5 +231,8 @@ function getAllMigrations() { 173 => new UpdateMigration('3.3.1', '3.3.0', 173), // 2018.1.0 174 => new UpdateMigration('2018.1.0', '3.3.1', 174), + // 2018.1.1 + 175 => new \vv201811\MigrateServiceMessageLanguages(175), + 176 => new UpdateMigration('2018.1.1', '2018.1.0', 176), ); } \ No newline at end of file diff --git a/install/migrations/vv201811/MigrateServiceMessageLanguages.php b/install/migrations/vv201811/MigrateServiceMessageLanguages.php new file mode 100644 index 00000000..69504795 --- /dev/null +++ b/install/migrations/vv201811/MigrateServiceMessageLanguages.php @@ -0,0 +1,49 @@ + $info) { + $languageMap[$name] = $info['folder']; + } + } + + $mfh_language = $languageMap[$row['language']]; + + hesk_dbQuery("UPDATE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "service_messages` + SET `mfh_language` = '" . hesk_dbEscape($mfh_language) . "' WHERE `id` = " . intval($row['id'])); + } + } + + function innerDown($hesk_settings) { + // Get all service messages with non-null language (only HESK will populate this; MFH won't) + $rs = hesk_dbQuery("SELECT `id`, `mfh_language` FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "service_messages`"); + + $language_map = array(); + while ($row = hesk_dbFetchAssoc($rs)) { + // Get the language + if (count($language_map) === 0) { + // Initialize the map for the first run + foreach($hesk_settings['languages'] as $name => $info) { + $language_map[$info['folder']] = $name; + } + } + + $language = $row['mfh_language'] === 'ALL' ? 'NULL' : "'" . hesk_dbEscape($language_map[$row['mfh_language']]) . "'"; + + hesk_dbQuery("UPDATE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "service_messages` + SET `language` = {$language} WHERE `id` = " . intval($row['id'])); + } + } +} \ No newline at end of file