-
Notifications
You must be signed in to change notification settings - Fork 34
classes_modules_uploads_wdffolderarchive.class
Represents a monitored/archived folder. This class automatically monitors the given folder for files and creates an archive for them. Note that this will need you to install 7-zip manually in the system: https://www.7-zip.org/download.html
Adds contents to the archive. This will first create (or overwrite) a file locally on disk and then add it to the archive.
Definition: public function add($path_inside_archive, $content, $keep_local=false)
Returns: bool
True if the file was added, false otherwise.
Parameters:
-
mixed $path_inside_archive
File-path inside the archive. -
mixed $content
File contents. -
mixed $keep_local
If false, the temporary file will be removed from the disk.
Checks if the archive file exists.
Definition: public function archiveExists()
Returns: bool
True if the archive file exists, false otherwise
Walks files in the archive. The flags $present_in_archive and $not_present_in_archive can be used to filter the files.
Definition: public function bool($present_in_archive, bool $present_local, $callback, $force_local_scan=false)
Returns: void
Parameters:
-
bool $present_in_archive
File must be present in the archive. -
bool $present_local
File must be present on disk. -
mixed $callback
Callback to be called for each file. If it returns FALSE, processing is aborted. -
mixed $force_local_scan
If true, buffer is skipped and local files are (re-)scanned.
Checks if a path exists inside the archive.
Definition: public function contains($path_inside_archive)
Returns: bool
True if the path exists, false otherwise
Parameters:
-
mixed $path_inside_archive
Path inside the archive
Creates an archive for each folder in the given base folder. Note that this will be the folder where the archive will be saved.
Definition: public static function CreateFromBaseFolder($folder)
Returns: array
Created archives
Parameters:
-
mixed $folder
Base folder
Removes a file or folder from the archive.
Definition: public function delete($path_inside_archive)
Returns: array
Array of file paths that were removed.
Parameters:
-
string $path_inside_archive
Path inside the archive.
Lists all files in the archive.
Definition: public function false($callback)
Returns: array
Array of files. If callback is used, will always be empty.
Parameters:
-
mixed $callback
Optional callback for each file. If it returns false, processinf is aborted
Returns file contents from the archive.
Definition: public function get($path_inside_archive)
Returns: mixed
File contents or NULL
Parameters:
-
mixed $path_inside_archive
File path inside the archive.
Removes all empty folders in the monitored folder.
Definition: public function removeEmptyLocalFolders()
Returns: void
Rescans everything and updates the archive from disk.
Definition: public function updateAll()
Returns: array
Array of files that have been added or updated.
Updates a file inside the archive from disk.
Definition: public function updateFile($path_inside_archive)
Returns: bool
True if the file was updated, false otherwise.
Parameters:
-
mixed $path_inside_archive
Path inside the archive.
Updates a folder in the archive.
Definition: public function updateFolder($path_inside_archive)
Returns: array
Array of updated files
Parameters:
-
mixed $path_inside_archive
Path inside the archive