Lista de Classes
- App\Middleware\Cors
- App\Middleware\Auth
- App\Middleware\Env
- AppMin
- Application
- Route
- Data\Database
- Data\Db2Database
- Data\OdbcDatabase
- Data\Validator
- Data\KeyValue\SqliteStorage
- Data\Log\FileLogger
- Data\Log\HtmlLogger
- Encoding\Base64Url
- Encoding\Json
- Encoding\Utf8
- Environment\DotEnv
- Environment\System
- FileSystem\Search
- FileSystem\Security
- FileSystem\Sync
- Lang\I18N
- Lang\L10N
- Lang\Time
- Media\Image
- Net\Config
- Net\Email
- Net\HttpClient
- Net\HttpResponse
- Net\IP
- Net\SmtpClient
- Security\Crypto
- Security\Password
- Security\Crypto\Encryption
- Security\Crypto\FileEncryption
- Security\Crypto\JWT
- Security\Crypto\PublicKey
- Security\Crypto\Random
- Security\Crypto\SignedData
- Security\Web\CsrfSession
- Security\Web\CsrfStateless
- Security\Web\RateLimit
- Web\Request
- Web\Response
FastSitePHP\FileSystem\Sync
File System Sync
This class provides the ability for syncing of all files and directories from one directory to another directory. This class compares files using a hash (defaults to 'sha256') and updates the files if different. Additionally new files, deleted files, new empty directories, and deleted directories are handled.
Código Fonte
Métodos
function dirFrom($new_value = null)
Get or set the directory to sync from (source directory).
Retorna: string | $this
function dirTo($new_value = null)
Get or set the directory to sync to (destination directory).
Retorna: string | $this
function excludeNames(array $new_value = null)
Get or set an array of files/dir names to exclude. If a file/dir matches any names in the list then it will be excluded from the result. This property does not handle files in nested directories. For nested files use [excludeRegExPaths()].
Retorna: array | $this
excludeRegExPaths(array $new_value = null)
Get or set an array of files/dir regex path expressions to exclude. If part of the full path matches any regex in the list then it will be excluded from the result.
Example usage:
$sync->excludeRegExPaths(['/node_modules/']);
Retorna: array | $this
function summaryTitle($new_value = null)
Get or set the summary title used for report output when calling [printResults()]. Defaults to 'File System Sync Results'.
Retorna: string | $this
function dryRun($new_value = null)
Get or set a dry run boolean value for testing. When set to [true] no changes will be made when calling [sync()]. Defaults to [false].
Retorna: bool | $this
function hashAlgo($new_value = null)
Get or set the hashing algorithm for comparing files when syncing. Defaults to 'sha256'.
Retorna: string | $this
function sync()
Sync files and directories (folders) from [dirFrom(path)] to [dirTo(path)]. The sync is recursive so all files and directories are synced in all sub-directories.
To view the results of the sync call [printResults()] after calling this function.
Retorna: $this
function printResults()
Output the result of [sync()] as a text summary. This includes a list of all affected files and directories and summary counts. This function will typically be used for CLI output, however if used on a web server then <br> will be used for line breaks.
Retorna: string