From cc873ccaecf92e5a765af5eed8a5d6ed5cd1764b Mon Sep 17 00:00:00 2001 From: Josh Date: Tue, 2 Dec 2025 18:46:16 -0500 Subject: [PATCH 1/6] chore(legacy): deprecate OC_Util::runningOnMac() - Easy enough query directly these days; Only used in one spot anyhow - Updated the runningOnMac method to use PHP_OS_FAMILY just for clarity until we can remove the function entirely (same result; supported since PHP ~7.4). Signed-off-by: Josh --- lib/private/legacy/OC_Util.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/private/legacy/OC_Util.php b/lib/private/legacy/OC_Util.php index bdbe0d0f1e1..6fa8ccfd9d6 100644 --- a/lib/private/legacy/OC_Util.php +++ b/lib/private/legacy/OC_Util.php @@ -733,12 +733,16 @@ class OC_Util { } /** - * Checks whether the server is running on Mac OS X + * Checks whether PHP is running directly on macOS. + * + * Note: In a Linux container, this will be false even on a macOS host + * (PHP just sees "Linux"). * * @return bool true if running on Mac OS X, false otherwise + * @deprecated 33.0.0 Query PHP_OS_FAMILY directly. */ public static function runningOnMac() { - return (strtoupper(substr(PHP_OS, 0, 6)) === 'DARWIN'); + return (PHP_OS_FAMILY === 'Darwin'); } /** From d9a7e0855c862352727896743ce9a19dbf509e83 Mon Sep 17 00:00:00 2001 From: Josh Date: Tue, 2 Dec 2025 18:48:31 -0500 Subject: [PATCH 2/6] refactor(tests): use OS constant over function Use PHP's newer PHP_OS_FAMILY constant. - Allows us to drop a legacy OC_Util method. - This test isn't even enabled at the moment. Signed-off-by: Josh --- tests/lib/Files/ViewTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/lib/Files/ViewTest.php b/tests/lib/Files/ViewTest.php index b9f6b1a7373..0ff5d010c0d 100644 --- a/tests/lib/Files/ViewTest.php +++ b/tests/lib/Files/ViewTest.php @@ -809,7 +809,7 @@ class ViewTest extends \Test\TestCase { */ $folderName = 'abcdefghijklmnopqrstuvwxyz012345678901234567890123456789'; $tmpdirLength = strlen(Server::get(ITempManager::class)->getTemporaryFolder()); - if (\OC_Util::runningOnMac()) { + if (PHP_OS_FAMILY === 'Darwin') { // macOS $depth = ((1024 - $tmpdirLength) / 57); } else { $depth = ((4000 - $tmpdirLength) / 57); From aa498654c5327b7cd1720ef2c5abf9c2d4adcbc6 Mon Sep 17 00:00:00 2001 From: Josh Date: Tue, 2 Dec 2025 18:51:11 -0500 Subject: [PATCH 3/6] refactor(setup): use OS constant rather than function (macOS) PHP_OS_FAMILY - Facilitates elimination of a legacy OC_Util method - `runningOnMac()` -- yes, really! ;-) - Supported since PHP late 7.x-era Signed-off-by: Josh --- lib/private/Setup.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/private/Setup.php b/lib/private/Setup.php index 8781127b30a..95a4032be32 100644 --- a/lib/private/Setup.php +++ b/lib/private/Setup.php @@ -185,10 +185,11 @@ class Setup { } } - if (\OC_Util::runningOnMac()) { + // Check if running directly on macOS (note: Linux containers on macOS will not trigger this) + if (PHP_OS_FAMILY === 'Darwin') { $errors[] = [ 'error' => $this->l10n->t( - 'Mac OS X is not supported and %s will not work properly on this platform. ' + 'macOS is not supported and %s will not work properly on this platform. ' . 'Use it at your own risk!', [$this->defaults->getProductName()] ), From f38c8c3d7c8bb4315055a8c44ce8936f6c1828df Mon Sep 17 00:00:00 2001 From: Carl Schwan Date: Wed, 3 Dec 2025 11:10:18 +0100 Subject: [PATCH 4/6] fix(formatting): Fix formatting issue Signed-off-by: Carl Schwan --- lib/private/legacy/OC_Util.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/private/legacy/OC_Util.php b/lib/private/legacy/OC_Util.php index 6fa8ccfd9d6..ef4f34ae33c 100644 --- a/lib/private/legacy/OC_Util.php +++ b/lib/private/legacy/OC_Util.php @@ -733,9 +733,9 @@ class OC_Util { } /** - * Checks whether PHP is running directly on macOS. + * Checks whether PHP is running directly on macOS. * - * Note: In a Linux container, this will be false even on a macOS host + * Note: In a Linux container, this will be false even on a macOS host * (PHP just sees "Linux"). * * @return bool true if running on Mac OS X, false otherwise From d95ce6ac92f7e98eab0c1e4cda65c770e12ffc16 Mon Sep 17 00:00:00 2001 From: Josh Date: Thu, 4 Dec 2025 16:46:55 -0500 Subject: [PATCH 5/6] chore: drop no longer needed runningOnMac method Removed deprecated method 'runningOnMac' that checks if PHP is running on macOS. Signed-off-by: Josh --- lib/private/legacy/OC_Util.php | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/lib/private/legacy/OC_Util.php b/lib/private/legacy/OC_Util.php index ef4f34ae33c..fd87537cec7 100644 --- a/lib/private/legacy/OC_Util.php +++ b/lib/private/legacy/OC_Util.php @@ -732,19 +732,6 @@ class OC_Util { } } - /** - * Checks whether PHP is running directly on macOS. - * - * Note: In a Linux container, this will be false even on a macOS host - * (PHP just sees "Linux"). - * - * @return bool true if running on Mac OS X, false otherwise - * @deprecated 33.0.0 Query PHP_OS_FAMILY directly. - */ - public static function runningOnMac() { - return (PHP_OS_FAMILY === 'Darwin'); - } - /** * Handles the case that there may not be a theme, then check if a "default" * theme exists and take that one From 511f54324abd96eca5c8fc6f03e9949f3e96affa Mon Sep 17 00:00:00 2001 From: Josh Date: Thu, 4 Dec 2025 16:48:42 -0500 Subject: [PATCH 6/6] chore: drop unused Darwin range test variation Signed-off-by: Josh --- tests/lib/Files/ViewTest.php | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/tests/lib/Files/ViewTest.php b/tests/lib/Files/ViewTest.php index 0ff5d010c0d..e7ce3ee9526 100644 --- a/tests/lib/Files/ViewTest.php +++ b/tests/lib/Files/ViewTest.php @@ -805,15 +805,11 @@ class ViewTest extends \Test\TestCase { $ds = DIRECTORY_SEPARATOR; /* * 4096 is the maximum path length in file_cache.path in *nix - * 1024 is the max path length in mac */ $folderName = 'abcdefghijklmnopqrstuvwxyz012345678901234567890123456789'; $tmpdirLength = strlen(Server::get(ITempManager::class)->getTemporaryFolder()); - if (PHP_OS_FAMILY === 'Darwin') { // macOS - $depth = ((1024 - $tmpdirLength) / 57); - } else { - $depth = ((4000 - $tmpdirLength) / 57); - } + $depth = ((4000 - $tmpdirLength) / 57); + foreach (range(0, $depth - 1) as $i) { $longPath .= $ds . $folderName; $result = $rootView->mkdir($longPath);