Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: stop using $TestServer and related variables #1870

Open
mcdurdin opened this issue Feb 13, 2025 · 0 comments · May be fixed by #1894
Open

refactor: stop using $TestServer and related variables #1870

mcdurdin opened this issue Feb 13, 2025 · 0 comments · May be fixed by #1894
Assignees
Labels
Milestone

Comments

@mcdurdin
Copy link
Member

There are only a few references left to $TestServer, and there are a few other very old related variables that are probably unused. It would be good to get rid of them as a part of the work done in KeymanHosts (e.g. keymanapp/shared-sites#53) to make future maintenance of this simpler.

This issue covers help.keyman.com and keymanweb.com.

12 results - 4 files

help.keyman.com\_includes\includes\__kmwheader.php:
  83      default:
  84:       global $TestServer;
  85:       if($TestServer) {
  86          return false;   // We should never get this except briefly while documenting a new major version.

help.keyman.com\_includes\includes\servervars.php:
  30  
  31:   $TestServer = false;
  32  

  37    function cdn($file) {
  38:     global $cdn, $TestServer;
  39:     $use_cdn = !$TestServer || (isset($_REQUEST['cdn']) && $_REQUEST['cdn'] == 'force');
  40      if($use_cdn && $cdn && array_key_exists('/'.$file, $cdn)) {

keymanweb.com\inc\servervars.php:
  38      // $site_protocol is used only by util.php at this time.
  39:   $TestServer = (KeymanHosts::Instance()->Tier() == KeymanHosts::TIER_DEVELOPMENT) ||
  40      (KeymanHosts::Instance()->Tier() == KeymanHosts::TIER_TEST) ? true : false;
  41:   $site_protocol = $TestServer ? 'http://' : 'https://';
  42  

  52    function cdn($file) {
  53:     global $cdn, $staticDomain, $TestServer;
  54:     $use_cdn = !$TestServer || (isset($_REQUEST['cdn']) && $_REQUEST['cdn'] == 'force');
  55      if($use_cdn && $cdn && array_key_exists('/'.$file, $cdn)) {

keymanweb.com\inc\util.php:
  33      }
  34:     global $TestServer;
  35:     if(isset($TestServer) && $TestServer) { echo "<pre>"; debug_print_backtrace();echo "</pre>"; }
  36      exit('Invalid parameter');

Other variables to eliminate in keymanweb.com are:

  $site_suffix 
  $site_protocol 
  $url_keymanweb_res 
  $staticDomainRoot
  $site_keymanwebhelp
  $site_keymanwebdemo
  $site_keyman       
  $staticDomain

Other variables to eliminate in help.keyman.com are:

  $keyman_com
  $site_protocol 
  $site_tavultesoft 
  $site_securetavultesoft 
  $downloadsDomain

At the same time, review servervars.php on all the 5 main sites for additional low-hanging-fruit obsolete variables.

@mcdurdin mcdurdin added this to the B18S1 milestone Feb 13, 2025
@mcdurdin mcdurdin self-assigned this Feb 13, 2025
@mcdurdin mcdurdin added this to Keyman Feb 13, 2025
@mcdurdin mcdurdin moved this to Todo in Keyman Feb 13, 2025
@darcywong00 darcywong00 modified the milestones: B18S1, B18S2 Feb 15, 2025
mcdurdin added a commit that referenced this issue Feb 24, 2025
Also removed $site_securetavultesoft and $downloadsDomain.

Fixes: #1870
@mcdurdin mcdurdin linked a pull request Feb 24, 2025 that will close this issue
@mcdurdin mcdurdin moved this from Todo to In Progress in Keyman Feb 24, 2025
mcdurdin added a commit to keymanapp/keymanweb.com that referenced this issue Feb 24, 2025
Removed demoDomain, KeymanWeb_StaticRoot js variables.

Removed $site_suffix, $site_protocol, $site_keymanwebhelp,
$site_keymanwebdemo, $site_keyman, $staticDomain and $TestServer php
variables.

Relates-to: keymanapp/help.keyman.com#1870
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: In Progress
Development

Successfully merging a pull request may close this issue.

2 participants