Skip to content
Snippets Groups Projects
Unverified Commit 1f7f3464 authored by Eileen McNaughton's avatar Eileen McNaughton Committed by GitHub
Browse files

Merge pull request #20270 from demeritcowboy/relative

#2590 - Remove unused function CRM_Utils_File::relativeDirectory
parents dec8450c 335c13d8
Branches
Tags
No related merge requests found
......@@ -622,38 +622,6 @@ HTACCESS;
return FALSE;
}
/**
* @param $directory
*
* @return string
* @deprecated
* Computation of a relative path requires some base.
* This implementation is problematic because it relies on an
* implicit base which was constructed problematically.
*/
public static function relativeDirectory($directory) {
// Do nothing on windows
if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
return $directory;
}
// check if directory is relative, if so return immediately
if (!self::isAbsolute($directory)) {
return $directory;
}
// make everything relative from the baseFilePath
$basePath = self::baseFilePath();
// check if basePath is a substr of $directory, if so
// return rest of string
if (substr($directory, 0, strlen($basePath)) == $basePath) {
return substr($directory, strlen($basePath));
}
// return the original value
return $directory;
}
/**
* @param $directory
* @param string $basePath
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment