HEX
Server: LiteSpeed
System: Linux linux31.centraldnserver.com 4.18.0-553.83.1.lve.el8.x86_64 #1 SMP Wed Nov 12 10:04:12 UTC 2025 x86_64
User: salamatk (1501)
PHP: 8.1.33
Disabled: show_source, system, shell_exec, passthru, exec, popen, proc_open
Upload Files
File: //proc/thread-self/cwd/dup-installer/libs/DupArchive/Processors/DupArchiveDirectoryProcessor.php
<?php

/**
 *
 * @package   Duplicator
 * @copyright (c) 2021, Snapcreek LLC
 */

namespace Duplicator\Libs\DupArchive\Processors;

use Duplicator\Libs\DupArchive\Headers\DupArchiveDirectoryHeader;
use Duplicator\Libs\DupArchive\States\DupArchiveCreateState;
use Duplicator\Libs\Snap\SnapIO;

class DupArchiveDirectoryProcessor
{
    /**
     * Undocumented function
     *
     * @param DupArchiveCreateState $createState           create state
     * @param resource              $archiveHandle         archive resource
     * @param string                $sourceDirectoryPath   source directory path
     * @param string                $relativeDirectoryPath relative dirctory path
     *
     * @return void
     */
    public static function writeDirectoryToArchive(
        DupArchiveCreateState $createState,
        $archiveHandle,
        $sourceDirectoryPath,
        $relativeDirectoryPath
    ) {
        $directoryHeader = new DupArchiveDirectoryHeader();

        $directoryHeader->permissions        = substr(sprintf('%o', fileperms($sourceDirectoryPath)), -4);
        $directoryHeader->mtime              = SnapIO::filemtime($sourceDirectoryPath);
        $directoryHeader->relativePath       = $relativeDirectoryPath;
        $directoryHeader->relativePathLength = strlen($directoryHeader->relativePath);

        $directoryHeader->writeToArchive($archiveHandle);

        // Just increment this here - the actual state save is on the outside after timeout or completion of all directories
        $createState->currentDirectoryIndex++;
    }
}