From eacd2abcc53659a9fa20b1274a30ac4d9ad8bdb6 Mon Sep 17 00:00:00 2001 From: nsfisis Date: Wed, 3 Jun 2026 20:10:17 +0900 Subject: feat(php-shim): align fwrite/touch2/PHP_OS_FAMILY/PHP_URL_SCHEME with PHP Adjust fwrite to return int|false equivalent (Option), 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 --- crates/shirabe-php-shim/src/lib.rs | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) (limited to 'crates/shirabe-php-shim/src') 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 { 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!() } -- cgit v1.3.1