Skip to content

Commit c3d5ba9

Browse files
committed
Latest library.
1 parent 0f42fcb commit c3d5ba9

File tree

5 files changed

+68
-20
lines changed

5 files changed

+68
-20
lines changed

installers/nix-tar-gz/install-support/dir_helper.php

+31-7
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22
// Directory helper functions.
3-
// (C) 2018 CubicleSoft. All Rights Reserved.
3+
// (C) 2022 CubicleSoft. All Rights Reserved.
44

55
class DirHelper
66
{
@@ -68,11 +68,35 @@ public static function SetPermissions($path, $dirowner, $dirgroup, $dirperms, $f
6868
{
6969
$path = rtrim(str_replace("\\", "/", $path), "/");
7070

71+
if (is_string($dirowner))
72+
{
73+
$dirowner = (function_exists("posix_getpwnam") ? @posix_getpwnam($dirowner) : false);
74+
if ($dirowner !== false) $dirowner = $dirowner["uid"];
75+
}
76+
77+
if (is_string($dirgroup))
78+
{
79+
$dirgroup = (function_exists("posix_getgrnam") ? @posix_getgrnam($dirgroup) : false);
80+
if ($dirgroup !== false) $dirgroup = $dirgroup["gid"];
81+
}
82+
83+
if (is_string($fileowner))
84+
{
85+
$fileowner = (function_exists("posix_getpwnam") ? @posix_getpwnam($fileowner) : false);
86+
if ($fileowner !== false) $fileowner = $fileowner["uid"];
87+
}
88+
89+
if (is_string($filegroup))
90+
{
91+
$filegroup = (function_exists("posix_getgrnam") ? @posix_getgrnam($filegroup) : false);
92+
if ($filegroup !== false) $filegroup = $filegroup["gid"];
93+
}
94+
7195
if (!isset($exclude[$path]))
7296
{
73-
if ($dirowner !== false) @chown($path, $dirowner);
74-
if ($dirgroup !== false) @chgrp($path, $dirgroup);
75-
if ($dirperms !== false) @chmod($path, $dirperms);
97+
if ($dirowner !== false && @fileowner($path) !== $dirownwer) @chown($path, $dirowner);
98+
if ($dirgroup !== false && @filegroup($path) !== $dirgroup) @chgrp($path, $dirgroup);
99+
if ($dirperms !== false && @fileperms($path) & 07777 !== $dirperms) @chmod($path, $dirperms);
76100
}
77101

78102
$dir = @opendir($path);
@@ -88,9 +112,9 @@ public static function SetPermissions($path, $dirowner, $dirgroup, $dirperms, $f
88112
}
89113
else
90114
{
91-
if ($fileowner !== false) @chown($path . "/" . $file, $fileowner);
92-
if ($filegroup !== false) @chgrp($path . "/" . $file, $filegroup);
93-
if ($fileperms !== false) @chmod($path . "/" . $file, $fileperms);
115+
if ($fileowner !== false && @fileowner($path . "/" . $file) !== $fileowner) @chown($path . "/" . $file, $fileowner);
116+
if ($filegroup !== false && @filegroup($path . "/" . $file) !== $filegroup) @chgrp($path . "/" . $file, $filegroup);
117+
if ($fileperms !== false && @fileperms($path . "/" . $file) & 07777 !== $fileperms) @chmod($path . "/" . $file, $fileperms);
94118
}
95119
}
96120
}

installers/osx-tar-gz/install-support/process_helper.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,7 @@ public static function GetTCPPipes(&$pipes, $servertoken, $proc, $waitfor = 0.5,
294294
if (!isset($pipes[$num2]) || $pipes[$num2] !== false) fclose($client->fp);
295295
else
296296
{
297-
$pipes[$num2] = $fp;
297+
$pipes[$num2] = $client->fp;
298298

299299
$pipesleft--;
300300

@@ -536,7 +536,7 @@ public static function Wait($proc, &$pipes, $stdindata = "", $timeout = -1, $out
536536
if ($timeleft < 0) $timeleft = 0;
537537
}
538538

539-
if (!count($readfps) && !count($writefps)) usleep(($timeleft !== false && $timeleft < 0.25 ? $timeleft : 250000));
539+
if (!count($readfps) && !count($writefps)) usleep(($timeleft !== false && $timeleft < 0.25 ? (int)($timeleft * 1000000) : 250000));
540540
else
541541
{
542542
$exceptfps = NULL;

installers/osx-tar-gz/install-support/www/support/dir_helper.php

+31-7
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22
// Directory helper functions.
3-
// (C) 2018 CubicleSoft. All Rights Reserved.
3+
// (C) 2022 CubicleSoft. All Rights Reserved.
44

55
class DirHelper
66
{
@@ -68,11 +68,35 @@ public static function SetPermissions($path, $dirowner, $dirgroup, $dirperms, $f
6868
{
6969
$path = rtrim(str_replace("\\", "/", $path), "/");
7070

71+
if (is_string($dirowner))
72+
{
73+
$dirowner = (function_exists("posix_getpwnam") ? @posix_getpwnam($dirowner) : false);
74+
if ($dirowner !== false) $dirowner = $dirowner["uid"];
75+
}
76+
77+
if (is_string($dirgroup))
78+
{
79+
$dirgroup = (function_exists("posix_getgrnam") ? @posix_getgrnam($dirgroup) : false);
80+
if ($dirgroup !== false) $dirgroup = $dirgroup["gid"];
81+
}
82+
83+
if (is_string($fileowner))
84+
{
85+
$fileowner = (function_exists("posix_getpwnam") ? @posix_getpwnam($fileowner) : false);
86+
if ($fileowner !== false) $fileowner = $fileowner["uid"];
87+
}
88+
89+
if (is_string($filegroup))
90+
{
91+
$filegroup = (function_exists("posix_getgrnam") ? @posix_getgrnam($filegroup) : false);
92+
if ($filegroup !== false) $filegroup = $filegroup["gid"];
93+
}
94+
7195
if (!isset($exclude[$path]))
7296
{
73-
if ($dirowner !== false) @chown($path, $dirowner);
74-
if ($dirgroup !== false) @chgrp($path, $dirgroup);
75-
if ($dirperms !== false) @chmod($path, $dirperms);
97+
if ($dirowner !== false && @fileowner($path) !== $dirownwer) @chown($path, $dirowner);
98+
if ($dirgroup !== false && @filegroup($path) !== $dirgroup) @chgrp($path, $dirgroup);
99+
if ($dirperms !== false && @fileperms($path) & 07777 !== $dirperms) @chmod($path, $dirperms);
76100
}
77101

78102
$dir = @opendir($path);
@@ -88,9 +112,9 @@ public static function SetPermissions($path, $dirowner, $dirgroup, $dirperms, $f
88112
}
89113
else
90114
{
91-
if ($fileowner !== false) @chown($path . "/" . $file, $fileowner);
92-
if ($filegroup !== false) @chgrp($path . "/" . $file, $filegroup);
93-
if ($fileperms !== false) @chmod($path . "/" . $file, $fileperms);
115+
if ($fileowner !== false && @fileowner($path . "/" . $file) !== $fileowner) @chown($path . "/" . $file, $fileowner);
116+
if ($filegroup !== false && @filegroup($path . "/" . $file) !== $filegroup) @chgrp($path . "/" . $file, $filegroup);
117+
if ($fileperms !== false && @fileperms($path . "/" . $file) & 07777 !== $fileperms) @chmod($path . "/" . $file, $fileperms);
94118
}
95119
}
96120
}

installers/osx-tar-gz/install-support/www/support/process_helper.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,7 @@ public static function GetTCPPipes(&$pipes, $servertoken, $proc, $waitfor = 0.5,
294294
if (!isset($pipes[$num2]) || $pipes[$num2] !== false) fclose($client->fp);
295295
else
296296
{
297-
$pipes[$num2] = $fp;
297+
$pipes[$num2] = $client->fp;
298298

299299
$pipesleft--;
300300

@@ -536,7 +536,7 @@ public static function Wait($proc, &$pipes, $stdindata = "", $timeout = -1, $out
536536
if ($timeleft < 0) $timeleft = 0;
537537
}
538538

539-
if (!count($readfps) && !count($writefps)) usleep(($timeleft !== false && $timeleft < 0.25 ? $timeleft : 250000));
539+
if (!count($readfps) && !count($writefps)) usleep(($timeleft !== false && $timeleft < 0.25 ? (int)($timeleft * 1000000) : 250000));
540540
else
541541
{
542542
$exceptfps = NULL;

support/process_helper.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,7 @@ public static function GetTCPPipes(&$pipes, $servertoken, $proc, $waitfor = 0.5,
294294
if (!isset($pipes[$num2]) || $pipes[$num2] !== false) fclose($client->fp);
295295
else
296296
{
297-
$pipes[$num2] = $fp;
297+
$pipes[$num2] = $client->fp;
298298

299299
$pipesleft--;
300300

@@ -536,7 +536,7 @@ public static function Wait($proc, &$pipes, $stdindata = "", $timeout = -1, $out
536536
if ($timeleft < 0) $timeleft = 0;
537537
}
538538

539-
if (!count($readfps) && !count($writefps)) usleep(($timeleft !== false && $timeleft < 0.25 ? $timeleft : 250000));
539+
if (!count($readfps) && !count($writefps)) usleep(($timeleft !== false && $timeleft < 0.25 ? (int)($timeleft * 1000000) : 250000));
540540
else
541541
{
542542
$exceptfps = NULL;

0 commit comments

Comments
 (0)