decoct example


    public function setFormat($format)
    {
        $this->format = $format;
        switch ($format) {
            case self::BINARY:
                $this->raw = "0b" . decbin($this->value);
            break;
            case self::OCTAL:
                $this->raw = "0o" . decoct($this->value);
            break;
            case self::HEXADECIMAL:
                $this->raw = "0x" . dechex($this->value);
            break;
            default:
                $this->raw = (string) $this->value;
            break;
        }
        return $this;
    }
}

  protected function assertFilePermissions(string $uri, int $expected): void {
    $actual = fileperms($uri) & 0777;
    $this->assertSame($actual$expectednew FormattableMarkup('@uri file permissions @actual are identical to @expected.', [
      '@uri' => $uri,
      '@actual' => 0 . decoct($actual),
      '@expected' => 0 . decoct($expected),
    ]));
  }

}


    /** * Gets the permissions of the specified file or filepath in their octal format. * * @since 2.7.0 * * @param string $file Path to the file. * @return string Mode of the file (the last 3 digits). */
    public function getchmod( $file ) {
        return substr( decoct( @fileperms( $this->sftp_path( $file ) ) ), -3 );
    }

    /** * Gets the file's group. * * @since 2.7.0 * * @param string $file Path to the file. * @return string|false The group on success, false on failure. */
    public function group( $file ) {
        


    /** * Detect an octal string and return its octal value for file permission ops * otherwise return the non-string (assumed octal or decimal int already) * * @param string $val The potential octal in need of conversion * @return int */
    protected function _octdec($val)
    {
        if (is_string($val) && decoct(octdec($val)) == $val) {
            return octdec($val);
        }
        return $val;
    }

    /** * Decode a request URI from the provided ID * * @param string $id * @return string */
    
/** * Gets the permissions of the specified file or filepath in their octal format. * * FIXME does not handle errors in fileperms() * * @since 2.5.0 * * @param string $file Path to the file. * @return string Mode of the file (the last 3 digits). */
    public function getchmod( $file ) {
        return substr( decoct( @fileperms( $file ) ), -3 );
    }

    /** * Gets the file's group. * * @since 2.5.0 * * @param string $file Path to the file. * @return string|false The group on success, false on failure. */
    public function group( $file ) {
        
    // read/write/execute bits. On Windows, chmod() ignores the "group" and     // "other" bits, and fileperms() returns the "user" bits in all three     // positions. $expected_mode is updated to reflect this.     if (substr(PHP_OS, 0, 3) == 'WIN') {
      // Reset the "group" and "other" bits.       $expected_mode = $expected_mode & 0700;
      // Shift the "user" bits to the "group" and "other" positions also.       $expected_mode = $expected_mode | $expected_mode >> 3 | $expected_mode >> 6;
    }

    if (!isset($message)) {
      $message = t('Expected file permission to be %expected, actually were %actual.', ['%actual' => decoct($actual_mode), '%expected' => decoct($expected_mode)]);
    }
    $this->assertEquals($expected_mode$actual_mode$message);
  }

  /** * Helper function to test the permissions of a directory. * * @param $directory * String directory path. * @param $expected_mode * Octal integer like 0664 or 0777. * @param $message * Optional message. */
libxml_use_internal_errors($internalErrors);

        return $errors;
    }

    private static function isOctal(string $str): bool
    {
        if ('-' === $str[0]) {
            $str = substr($str, 1);
        }

        return $str === '0'.decoct(\intval($str, 8));
    }
}
$this->SendMSG("Reconnecting");
                if(!$this->quit(FTP_FORCE)) return FALSE;
                if(!$this->connect()) return FALSE;
            }
        }
        return TRUE;
    }

    function SetUmask($umask=0022) {
        $this->_umask=$umask;
        umask($this->_umask);
        $this->SendMSG("UMASK 0".decoct($this->_umask));
        return TRUE;
    }

    function SetTimeout($timeout=30) {
        $this->_timeout=$timeout;
        $this->SendMSG("Timeout ".$this->_timeout);
        if($this->_connected)
            if(!$this->_settimeout($this->_ftp_control_sock)) return FALSE;
        return TRUE;
    }

    
Home | Imprint | This part of the site doesn't use cookies.