* Fix get extension files error for use softlink.

This commit is contained in:
Lufei
2022-11-30 16:57:52 +08:00
parent c9f918724e
commit 3f556e626b
2 changed files with 16 additions and 7 deletions

View File

@@ -19,10 +19,11 @@ class zfile
* @param bool $logLevel
* @param string $logFile
* @param array $excludeFiles
* @param bool $toIsLink
* @access public
* @return array copied files, count, size or message.
*/
public function copyDir($from, $to, $logLevel = false, $logFile = '', $excludeFiles = array())
public function copyDir($from, $to, $logLevel = false, $logFile = '', $excludeFiles = array(), $toIsLink = false)
{
static $copiedFiles = array();
static $errorFiles = array();
@@ -42,7 +43,16 @@ class zfile
if(!empty($log['message'])) return $log;
$from = realpath($from) . '/';
$to = realpath($to) . '/';
if(is_link($to) || $toIsLink)
{
$to = $to . '/';
$toIsLink = true;
}
else
{
$to = realpath($to) . '/';
}
$entries = scandir($from);
foreach($entries as $entry)
@@ -83,7 +93,7 @@ class zfile
{
$nextFrom = $fullEntry;
$nextTo = $to . $entry;
$result = $this->copyDir($nextFrom, $nextTo, $logLevel, $logFile);
$result = $this->copyDir($nextFrom, $nextTo, $logLevel, $logFile, array(), $toIsLink);
$count += $result['count'];
$size += $result['size'];
}

View File

@@ -780,11 +780,10 @@ class extensionModel extends model
/**
* Update an extension.
*
* @param string $extension
* @param string $status
* @param array $files
* @param string $extension
* @param array|object $data
* @access public
* @return void
* @return int
*/
public function updateExtension($extension, $data)
{