From bf7dedb90aaea4b9a07c5657aa9da57c2ec9b18e Mon Sep 17 00:00:00 2001 From: Jared Hancock <jared@osticket.com> Date: Mon, 28 Mar 2016 20:35:06 -0500 Subject: [PATCH] i18n: Fix slowness of DNS queries on system information Also, add build version and path information for the PHAR files listed as language packs. --- include/class.plugin.php | 5 ++++- include/cli/modules/i18n.php | 2 ++ include/staff/system.inc.php | 8 ++++++-- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/include/class.plugin.php b/include/class.plugin.php index 9d15bd359..d565b9059 100644 --- a/include/class.plugin.php +++ b/include/class.plugin.php @@ -550,7 +550,10 @@ abstract class Plugin { $P = new Phar($phar); $sig = $P->getSignature(); $info = array(); - if ($r = dns_get_record($sig['hash'].'.'.self::$verify_domain, DNS_TXT)) { + $ignored = null; + if ($r = dns_get_record($sig['hash'].'.'.self::$verify_domain.'.', + DNS_TXT, $ignored, $ignored, true) + ) { foreach ($r as $rec) { foreach (explode(';', $rec['txt']) as $kv) { list($k, $v) = explode('=', trim($kv)); diff --git a/include/cli/modules/i18n.php b/include/cli/modules/i18n.php index 0931361dd..d1a5fa824 100644 --- a/include/cli/modules/i18n.php +++ b/include/cli/modules/i18n.php @@ -318,6 +318,8 @@ class i18n_Compiler extends Module { if (!function_exists('openssl_get_privatekey')) $this->fail('OpenSSL extension required for signing'); + if (!$options['pkey'] || !file_exists($options['pkey'])) + $this->fail('Signing private key (-P) required'); $private = openssl_get_privatekey( file_get_contents($options['pkey'])); if (!$private) diff --git a/include/staff/system.inc.php b/include/staff/system.inc.php index ee70faefb..3a3834851 100644 --- a/include/staff/system.inc.php +++ b/include/staff/system.inc.php @@ -180,8 +180,12 @@ if (!$lv) { ?> Plugin::showVerificationBadge($info['path']); ?> </h3> - <div><?php echo __('Version'); ?>: <?php echo $manifest['Version']; ?>, - <?php echo __('Built'); ?>: <?php echo $manifest['Build-Date']; ?> + <div><?php echo sprintf('<code>%s</code> — %s', $info['code'], + str_replace(ROOT_DIR, '', $info['path'])); ?> + <br/> <?php echo __('Version'); ?>: <?php echo $manifest['Version']; + ?>, <?php echo sprintf(__('for version %s'), + 'v'.($manifest['Phrases-Version'] ?: '1.9')); ?> + <br/> <?php echo __('Built'); ?>: <?php echo $manifest['Build-Date']; ?> </div> <?php } } ?> -- GitLab