function PclZip::privDirCheck in Loft Data Grids 6.2
Same name and namespace in other branches
- 7.2 vendor/phpoffice/phpexcel/Classes/PHPExcel/Shared/PCLZip/pclzip.lib.php \PclZip::privDirCheck()
1 call to PclZip::privDirCheck()
- PclZip::privExtractFile in vendor/
phpoffice/ phpexcel/ Classes/ PHPExcel/ Shared/ PCLZip/ pclzip.lib.php
File
- vendor/
phpoffice/ phpexcel/ Classes/ PHPExcel/ Shared/ PCLZip/ pclzip.lib.php, line 4992
Class
Code
function privDirCheck($p_dir, $p_is_dir = false) {
$v_result = 1;
// ----- Remove the final '/'
if ($p_is_dir && substr($p_dir, -1) == '/') {
$p_dir = substr($p_dir, 0, strlen($p_dir) - 1);
}
// ----- Check the directory availability
if (is_dir($p_dir) || $p_dir == "") {
return 1;
}
// ----- Extract parent directory
$p_parent_dir = dirname($p_dir);
// ----- Just a check
if ($p_parent_dir != $p_dir) {
// ----- Look for parent directory
if ($p_parent_dir != "") {
if (($v_result = $this
->privDirCheck($p_parent_dir)) != 1) {
return $v_result;
}
}
}
// ----- Create the directory
if (!@mkdir($p_dir, 0777)) {
// ----- Error log
PclZip::privErrorLog(PCLZIP_ERR_DIR_CREATE_FAIL, "Unable to create directory '{$p_dir}'");
// ----- Return
return PclZip::errorCode();
}
// ----- Return
return $v_result;
}