aboutsummaryrefslogtreecommitdiffhomepage
path: root/crates/shirabe/src/cache.rs
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2026-08-18 04:47:02 +0900
committernsfisis <nsfisis@gmail.com>2026-08-18 04:47:18 +0900
commitced1f9aa91ee36857fec9664c9ccd86ba2310821 (patch)
tree630ea3eb3b0e710403669de9ba6a78a421e182a8 /crates/shirabe/src/cache.rs
parent6b7c6cb9a3d1cdf93f261238c1edbc70706a33c7 (diff)
downloadphp-shirabe-ced1f9aa91ee36857fec9664c9ccd86ba2310821.tar.gz
php-shirabe-ced1f9aa91ee36857fec9664c9ccd86ba2310821.tar.zst
php-shirabe-ced1f9aa91ee36857fec9664c9ccd86ba2310821.zip
refactor(function-exists): drop checks for always-present capabilities
function_exists() returns false in PHP when a function is blocked by disable_functions, when its extension is not compiled in, or when the PHP version predates it. None of those apply to a native binary.
Diffstat (limited to 'crates/shirabe/src/cache.rs')
-rw-r--r--crates/shirabe/src/cache.rs16
1 files changed, 6 insertions, 10 deletions
diff --git a/crates/shirabe/src/cache.rs b/crates/shirabe/src/cache.rs
index edfe584c..a8e4fb26 100644
--- a/crates/shirabe/src/cache.rs
+++ b/crates/shirabe/src/cache.rs
@@ -8,9 +8,9 @@ use crate::util::Silencer;
use chrono::Utc;
use shirabe_php_shim::{
ErrorException, bin2hex, clearstatcache, date_format_to_strftime, dirname, disk_free_space,
- file_exists, file_get_contents, file_put_contents, filemtime, function_exists, hash_file,
- is_dir, is_writable, mkdir, php_regex, preg_is_match, preg_match, preg_replace, random_bytes,
- random_int, rename, time, unlink,
+ file_exists, file_get_contents, file_put_contents, filemtime, hash_file, is_dir, is_writable,
+ mkdir, php_regex, preg_is_match, preg_match, preg_replace, random_bytes, random_int, rename,
+ time, unlink,
};
use shirabe_symfony_finder::Finder;
use std::sync::Mutex;
@@ -195,13 +195,9 @@ impl Cache {
// Remove partial file.
unlink(&temp_file_name);
- let free_space = if function_exists("disk_free_space") {
- disk_free_space(dirname(&temp_file_name))
- .map(|space| space.to_string())
- .unwrap_or_default()
- } else {
- "unknown".to_string()
- };
+ let free_space = disk_free_space(dirname(&temp_file_name))
+ .map(|space| space.to_string())
+ .unwrap_or_default();
let message = format!(
"<warning>Writing {} into cache failed after {} of {} bytes written, only {} bytes of free space available</warning>",
temp_file_name,