diff options
| author | nsfisis <nsfisis@gmail.com> | 2026-06-03 20:10:17 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2026-06-03 20:10:17 +0900 |
| commit | eacd2abcc53659a9fa20b1274a30ac4d9ad8bdb6 (patch) | |
| tree | 22affc2abef924f4f8bbe7ccec920689c9c01783 /crates/shirabe-php-shim | |
| parent | 26daafaae3713cd94ce32354e6404d95e06c568c (diff) | |
| download | php-shirabe-eacd2abcc53659a9fa20b1274a30ac4d9ad8bdb6.tar.gz php-shirabe-eacd2abcc53659a9fa20b1274a30ac4d9ad8bdb6.tar.zst php-shirabe-eacd2abcc53659a9fa20b1274a30ac4d9ad8bdb6.zip | |
feat(php-shim): align fwrite/touch2/PHP_OS_FAMILY/PHP_URL_SCHEME with PHP
Adjust fwrite to return int|false equivalent (Option<i64>), add touch2
with mtime, implement PHP_OS_FAMILY via std::env::consts::OS, and swap
the PHP_URL_HOST placeholders for the now-available PHP_URL_SCHEME.
Wire these into locker, filesystem, platform, and remote_filesystem.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Diffstat (limited to 'crates/shirabe-php-shim')
| -rw-r--r-- | crates/shirabe-php-shim/src/lib.rs | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/crates/shirabe-php-shim/src/lib.rs b/crates/shirabe-php-shim/src/lib.rs index b265111..cb487a2 100644 --- a/crates/shirabe-php-shim/src/lib.rs +++ b/crates/shirabe-php-shim/src/lib.rs @@ -536,7 +536,7 @@ pub fn fopen(_file: &str, _mode: &str) -> PhpMixed { todo!() } -pub fn fwrite(_file: PhpMixed, _data: &str, _length: i64) { +pub fn fwrite(_file: PhpMixed, _data: &str, _length: i64) -> Option<i64> { todo!() } @@ -863,6 +863,23 @@ pub fn touch(_path: &str) -> bool { todo!() } +pub fn touch2(_path: &str, _mtime: i64) -> bool { + todo!() +} + +/// PHP `PHP_OS_FAMILY` constant: the family of the host OS. +/// One of "Windows", "BSD", "Darwin", "Solaris", "Linux", "Unknown". +pub fn php_os_family() -> &'static str { + match std::env::consts::OS { + "linux" | "android" => "Linux", + "macos" | "ios" => "Darwin", + "windows" => "Windows", + "freebsd" | "dragonfly" | "netbsd" | "openbsd" => "BSD", + "solaris" | "illumos" => "Solaris", + _ => "Unknown", + } +} + pub fn chmod(_path: &str, _mode: u32) -> bool { todo!() } |
