aboutsummaryrefslogtreecommitdiffhomepage
path: root/crates/shirabe/src/util
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2026-06-10 02:41:34 +0900
committernsfisis <nsfisis@gmail.com>2026-06-10 02:46:18 +0900
commit2d474e91e49c7343d28198eff2b5bbbed9afbcee (patch)
tree8c1ab321dfa5ddc1ca9d2871eb06a6fde6b2970b /crates/shirabe/src/util
parente583112899cbea7494ffdd73d7de380dd5f808c4 (diff)
downloadphp-shirabe-2d474e91e49c7343d28198eff2b5bbbed9afbcee.tar.gz
php-shirabe-2d474e91e49c7343d28198eff2b5bbbed9afbcee.tar.zst
php-shirabe-2d474e91e49c7343d28198eff2b5bbbed9afbcee.zip
feat(phase-c): resolve cross-module phase-b TODOs
Diffstat (limited to 'crates/shirabe/src/util')
-rw-r--r--crates/shirabe/src/util/http_downloader.rs3
-rw-r--r--crates/shirabe/src/util/platform.rs22
-rw-r--r--crates/shirabe/src/util/remote_filesystem.rs6
3 files changed, 8 insertions, 23 deletions
diff --git a/crates/shirabe/src/util/http_downloader.rs b/crates/shirabe/src/util/http_downloader.rs
index 5d0eae6..434dedb 100644
--- a/crates/shirabe/src/util/http_downloader.rs
+++ b/crates/shirabe/src/util/http_downloader.rs
@@ -779,7 +779,8 @@ impl HttpDownloader {
);
http_map.insert("ignore_errors".to_string(), Box::new(PhpMixed::Bool(true)));
ctx_options.insert("http".to_string(), PhpMixed::Array(http_map));
- // TODO(phase-b): file_get_contents only takes a path; stream context arg dropped.
+ // TODO(phase-c): file_get_contents only takes a path; the stream context arg is dropped
+ // until the PHP stream-context layer is modeled.
let _ = stream_context_create(&ctx_options, None);
let test_connectivity = file_get_contents("https://8.8.8.8");
Silencer::restore();
diff --git a/crates/shirabe/src/util/platform.rs b/crates/shirabe/src/util/platform.rs
index 3866a12..6a0c2d0 100644
--- a/crates/shirabe/src/util/platform.rs
+++ b/crates/shirabe/src/util/platform.rs
@@ -186,7 +186,6 @@ impl Platform {
return false;
}
- // TODO(phase-b): Silencer::call returns Result; PHP returns the value or false on error
let file_contents = Silencer::call(|| Ok(file_get_contents("/proc/version")))
.ok()
.flatten()
@@ -294,7 +293,8 @@ impl Platform {
Some(f) => f,
None => {
if defined("STDOUT") {
- // TODO(phase-b): map STDOUT to the runtime stdout resource
+ // TODO(phase-c): map the STDOUT constant to a runtime stdout resource; depends
+ // on the unmodeled PHP stream/resource layer.
todo!("STDOUT constant")
} else {
let fd = fopen("php://stdout", "w");
@@ -330,7 +330,6 @@ impl Platform {
return true;
}
- // TODO(phase-b): Silencer::call wraps the fstat call (`@fstat($fd)`)
let stat = Silencer::call(|| Ok(fstat(fd)));
let stat = match stat {
Ok(s) => s,
@@ -427,25 +426,8 @@ impl Platform {
"/dev/null".to_string()
}
- /// PHP: PHP_OS — returns the OS PHP was built on.
- pub fn php_os() -> &'static str {
- // TODO(phase-b): map to actual OS name (e.g. "Darwin", "Linux", "WINNT").
- todo!()
- }
-
/// PHP: rename($from, $to) — wrap the std rename so callers can use Platform::rename.
pub fn rename(from: &str, to: &str) -> bool {
std::fs::rename(from, to).is_ok()
}
-
- /// PHP: mkdir($pathname, $mode, $recursive)
- pub fn mkdir(pathname: &str, _mode: u32, recursive: bool) -> bool {
- // TODO(phase-b): honor mode bits on Unix
- let result = if recursive {
- std::fs::create_dir_all(pathname)
- } else {
- std::fs::create_dir(pathname)
- };
- result.is_ok()
- }
}
diff --git a/crates/shirabe/src/util/remote_filesystem.rs b/crates/shirabe/src/util/remote_filesystem.rs
index bd4aaa8..dc6a2a4 100644
--- a/crates/shirabe/src/util/remote_filesystem.rs
+++ b/crates/shirabe/src/util/remote_filesystem.rs
@@ -720,7 +720,8 @@ impl RemoteFilesystem {
}
let mut caught_e: Option<anyhow::Error> = None;
- // TODO(phase-b): wrap PHP's `file_get_contents` with stream context and error capture.
+ // TODO(phase-c): wrap PHP's `file_get_contents` with stream context and error capture;
+ // depends on the unmodeled PHP stream-context layer.
let outer: Result<Option<String>, anyhow::Error> = Ok(None);
match outer {
Ok(v) => result = v,
@@ -743,7 +744,8 @@ impl RemoteFilesystem {
*response_headers = http_get_last_response_headers().unwrap_or_default();
http_clear_last_response_headers();
} else {
- // TODO(phase-b): read the magic `$http_response_header` PHP variable.
+ // TODO(phase-c): read the magic `$http_response_header` PHP variable; depends on the
+ // unmodeled PHP stream layer that populates it.
*response_headers = Vec::new();
}