Uploaded image for project: 'Providence'
  1. PROV-2293

Automatic detection of utilities in path.

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Minor
    • Resolution: Won't Do
    • Affects versions: 1.7.5
    • Fix versions: None
    • Components: Providence Libraries
    • Labels:
      None
    • Environment:
      Windows 7, Bitnami WAMP

      Description

      All system utilities used by CA and available in PATH can be automatically located for both Windows and Posix systems using something like this ('where' is available on Windows 2003+; use executable name without extension, and a fully qualified path should be returned for Windows and Posix):

      # Goes into setup.php
      if (defined('PHP_WINDOWS_VERSION_BUILD')) {
          define('__CA_SYSTEM_WINDOWS__', true);
      }

      public static function getExecutable($name) {
          if (__CA_SYSTEM_WINDOWS__) {
              $cmdWhich = 'where ' . $name;
          } else {
              $cmdWhich = 'which ' . $name;
          }

          putenv('Path=' . getenv('Path')); // Somehow, only after this statement is executed, the environment variable PATH is updated with components added by SetEnv in Apache conf files.
          $executablePath = shell_exec($cmdWhich);

          if ($executablePath) {
              $executableCache[$name] = $executablePath;
              return $executablePath;
          } else {
              $executableCache[$name] = false;
              return false;
          }
      }

      $tool_name = 'exiftool';
      getExecutable($tool_name);

        Attachments

          Activity

            People

            • Assignee:
              Seth
              Reporter:
              oper251
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: