https://bugzilla.wikimedia.org/show_bug.cgi?id=28512

--- Comment #4 from Mark A. Hershberger <[email protected]> 2011-04-13 
19:45:53 UTC ---
note that your suggestion ignores cases of tilde expansion like ~www/ which
would expand to the www user's home directory.  You would have to call,  This
looks more complex than I initially anticipated:

  if ( substr( $value, 0, 1 ) == '~') {
    $home = getenv("HOME");
    if ( is_string($home) && $value == "~" ) {
      $value = "$home/";
    } else if ( is_string( $home ) && substr( $value, 0, 2 ) == '~/' ) {
      $value = $home . substr($value, 1);
    } else if ( substr( $value, 0, 1 ) == '~' &&
      strlen( $value ) > 2 &&
      function_exists( "posix_getpwnam" ) ) {
      $offset = strpos( $value, "/" );
      if($offset == false ) {
        $offset = strlen($value);
        $value = "$value/";
      }

      $pwent = posix_getpwnam( substr( $value, 1, $offset - 1 ) );
      if( isset( $pwent['dir'] ) ) {
        $value = $pwent['dir'] . substr( $value, $offset );
      }
    }
  }
  if ( substr( $value, 0, 1 ) == '~') {
    die( "Couldn't expand the tilde\n" );
  }

-- 
Configure bugmail: https://bugzilla.wikimedia.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
You are on the CC list for the bug.

_______________________________________________
Wikibugs-l mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/wikibugs-l

Reply via email to