Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add timestamp to backup directory #299

Merged
merged 4 commits into from
Sep 15, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 2 additions & 5 deletions index.php
Original file line number Diff line number Diff line change
Expand Up @@ -469,12 +469,9 @@ public function createBackup() {
];

// Create new folder for the backup
$backupFolderLocation = $this->getDataDirectoryLocation() . '/updater-'.$this->getConfigOption('instanceid').'/backups/nextcloud-'.$this->getConfigOption('version') . '/';
if(file_exists($backupFolderLocation)) {
$this->silentLog('[info] backup folder location exists');
$backupFolderLocation = $this->getDataDirectoryLocation() . '/updater-'.$this->getConfigOption('instanceid').'/backups/nextcloud-'.$this->getConfigOption('version') . '-' . time() . '/';
$this->silentLog('[info] backup folder location: ' . $backupFolderLocation);

$this->recursiveDelete($backupFolderLocation);
}
$state = mkdir($backupFolderLocation, 0750, true);
if($state === false) {
throw new \Exception('Could not create backup folder location');
Expand Down
7 changes: 2 additions & 5 deletions lib/Updater.php
Original file line number Diff line number Diff line change
Expand Up @@ -352,12 +352,9 @@ public function createBackup() {
];

// Create new folder for the backup
$backupFolderLocation = $this->getDataDirectoryLocation() . '/updater-'.$this->getConfigOption('instanceid').'/backups/nextcloud-'.$this->getConfigOption('version') . '/';
if(file_exists($backupFolderLocation)) {
$this->silentLog('[info] backup folder location exists');
$backupFolderLocation = $this->getDataDirectoryLocation() . '/updater-'.$this->getConfigOption('instanceid').'/backups/nextcloud-'.$this->getConfigOption('version') . '-' . time() . '/';
$this->silentLog('[info] backup folder location: ' . $backupFolderLocation);

$this->recursiveDelete($backupFolderLocation);
}
$state = mkdir($backupFolderLocation, 0750, true);
if($state === false) {
throw new \Exception('Could not create backup folder location');
Expand Down
Binary file modified updater.phar
Binary file not shown.
2 changes: 1 addition & 1 deletion vendor/composer/ClassLoader.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ class ClassLoader
public function getPrefixes()
{
if (!empty($this->prefixesPsr0)) {
return call_user_func_array('array_merge', $this->prefixesPsr0);
return call_user_func_array('array_merge', array_values($this->prefixesPsr0));
}

return array();
Expand Down