コード例 #1
0
ファイル: WinCacheUScenario.java プロジェクト: OSTC/PFTT2
 @Override
 public boolean isSupported(
     ConsoleManager cm,
     Host host,
     PhpBuild build,
     ScenarioSet scenario_set,
     EScenarioSetPermutationLayer layer) {
   if (!host.isWindows()) {
     if (cm != null) {
       cm.println(EPrintType.CLUE, getClass(), "Scenario only supported on Windows.");
     }
     return false;
   } else if (!build.isX86()) {
     if (cm != null) {
       cm.println(
           EPrintType.CLUE,
           getClass(),
           "Must use X86 build for this scenario: " + build.getBuildPath());
     }
     return false;
   } else if (!build.isNTS(host)) {
     if (cm != null) {
       cm.println(
           EPrintType.CLUE,
           getClass(),
           "Must use NTS build for this scenario: " + build.getBuildPath());
     }
     return false;
   } else if (!(
   // LATER? Apache FastCGI support on Windows
   scenario_set.contains(CliScenario.class)
       || scenario_set.contains(IISScenario.class)
       // WinCacheU should support builtin web server b/c (low priority though):
       //  web developers use wincache's user cache in their applications
       //  web developers like to use the builtin web server to run/test their application
       || scenario_set.contains(BuiltinWebServerScenario.class))) {
     if (cm != null) {
       cm.println(
           EPrintType.CLUE,
           getClass(),
           "Must load CLI, IIS or Builtin Web scenario. Try adding `iis` to your -config.");
     }
     return false;
   } else {
     return true;
   }
 }
コード例 #2
0
ファイル: WinCacheUScenario.java プロジェクト: OSTC/PFTT2
  public IScenarioSetup setup(
      ConsoleManager cm,
      Host host,
      PhpBuild build,
      ScenarioSet scenario_set,
      EScenarioSetPermutationLayer layer) {
    if (!host.isWindows() || !build.isNTS(host)) return SETUP_FAILED;

    String dll_path;
    EBuildBranch branch;
    try {
      branch = build.getVersionBranch(cm, host);
    } catch (Exception ex) {
      ex.printStackTrace();
      return SETUP_FAILED;
    }
    if (set_dll != null) {
      dll_path = set_dll.getPath();
    } else {
      switch (branch) {
        case PHP_5_3:
          dll_path = getDllPath53(host);
          break;
        case PHP_5_4:
          dll_path = getDllPath54(host);
          break;
        default:
          dll_path = getDllPath55Plus(host);
          break;
      }
    }
    // install wincache
    try {
      host.copy(dll_path, build.getDefaultExtensionDir() + "/php_wincache.dll");
    } catch (Exception ex) {
      ex.printStackTrace();
      return SETUP_FAILED;
    }

    cm.println(EPrintType.CLUE, getClass(), "Found WinCache in: " + dll_path);

    return new WinCacheUScenarioSetup();
  }