◆ _checkBackupsDir()
Check backups directory existence and whether it's writeable
- Returns
- void
- Exceptions
-
Definition at line 283 of file Filesystem.php.
287 if (!
is_dir($backupsDir)) {
288 $backupsDirParentDirectory = basename($backupsDir);
290 if (!is_writeable($backupsDirParentDirectory)) {
291 throw new NotEnoughPermissions(
292 new Phrase(
'Cant create backups directory')
301 throw new NotEnoughPermissions(
302 new Phrase(
'Backups directory is not writeable')
mkdir($pathname, $mode=0777, $recursive=false, $context=null)
◆ _getTarTmpPath()
Generate tmp name for tarball
- Returns
- string
Definition at line 312 of file Filesystem.php.
314 $tmpName =
'~tmp-' . microtime(
true) .
'.tar';
◆ addIgnorePaths()
Add path that should be ignoring when creating or rolling back backup
- Parameters
-
- Returns
- $this
Definition at line 217 of file Filesystem.php.
220 if (!in_array(
$paths, $this->_ignorePaths)) {
221 $this->_ignorePaths[] =
$paths;
elseif(isset( $params[ 'redirect_parent']))
◆ create()
Implementation Create Backup functionality for Filesystem
- Exceptions
-
- Returns
- boolean
Implements BackupInterface.
Definition at line 105 of file Filesystem.php.
108 ignore_user_abort(
true);
110 $this->_lastOperationSucceed =
false;
114 $fsHelper =
new Helper();
116 $filesInfo = $fsHelper->getInfo(
123 if (!$filesInfo[
'readable']) {
124 throw new NotEnoughPermissions(
125 new Phrase(
'Not enough permissions to read files for backup')
132 $tarPacker =
new Tar();
136 throw new LocalizedException(
137 new Phrase(
'Failed to create backup')
143 $gzPacker =
new Gz();
144 $gzPacker->pack($tarTmpPath, $backupPath);
147 throw new LocalizedException(
148 new Phrase(
'Failed to create backup')
154 $this->_lastOperationSucceed =
true;
validateAvailableDiscSpace($backupDir, $size)
◆ getFtpConnectString()
Get ftp connection string
- Returns
- string
Definition at line 272 of file Filesystem.php.
274 return 'ftp://' . $this->_ftpUser .
':' . $this->_ftpPass .
'@' . $this->_ftpHost .
$this->_ftpPath;
◆ getFtpPath()
Getter for $_ftpPath variable
- Returns
- string
Definition at line 262 of file Filesystem.php.
◆ getIgnorePaths()
Get paths that should be ignored while creating or rolling back backup procedure
- Returns
- array
Definition at line 237 of file Filesystem.php.
◆ getRollBackFs()
◆ getRollBackFtp()
◆ getType()
◆ rollback()
Implementation Rollback functionality for Filesystem
- Exceptions
-
- Returns
- bool
Implements BackupInterface.
Definition at line 85 of file Filesystem.php.
87 $this->_lastOperationSucceed =
false;
90 ignore_user_abort(
true);
93 $rollbackWorker->run();
95 $this->_lastOperationSucceed =
true;
◆ setBackupsDir()
setBackupsDir |
( |
|
$backupsDir | ) |
|
◆ setUseFtp()
setUseFtp |
( |
|
$host, |
|
|
|
$username, |
|
|
|
$password, |
|
|
|
$path |
|
) |
| |
Force class to use ftp for rollback procedure
- Parameters
-
string | $host | |
string | $username | |
string | $password | |
string | $path | |
- Returns
- $this
Definition at line 189 of file Filesystem.php.
191 $this->_useFtp =
true;
192 $this->_ftpHost = $host;
193 $this->_ftpUser = $username;
194 $this->_ftpPass = $password;
195 $this->_ftpPath =
$path;
◆ validateAvailableDiscSpace()
validateAvailableDiscSpace |
( |
|
$backupDir, |
|
|
|
$size |
|
) |
| |
Validate if disk space is available for creating backup
- Parameters
-
string | $backupDir | |
int | $size | |
- Returns
- void
- Exceptions
-
Definition at line 166 of file Filesystem.php.
169 $requiredSpace = 2 * $size;
170 if ($requiredSpace > $freeSpace) {
171 throw new NotEnoughFreeSpace(
173 'Warning: necessary space for backup is ' . (ceil($requiredSpace) / 1024)
174 .
'MB, but your free disc space is ' . (ceil($freeSpace) / 1024) .
'MB.'
◆ $_ftpHost
◆ $_ftpPass
◆ $_ftpPath
◆ $_ftpUser
◆ $_ignorePaths
◆ $_useFtp
◆ $rollBackFs
◆ $rollBackFtp
The documentation for this class was generated from the following file: