Skip to content
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
10 changes: 8 additions & 2 deletions index.php
Original file line number Diff line number Diff line change
Expand Up @@ -508,7 +508,10 @@ public function createBackup(): void {
}

foreach ($this->getRecursiveDirectoryIterator($this->nextcloudDir, $excludedElements) as $absolutePath => $fileInfo) {
$relativePath = explode($this->nextcloudDir, $absolutePath)[1];
$relativePath = explode($this->nextcloudDir, $absolutePath, 2)[1] ?? null;
if ($relativePath === null) {
throw new \Exception($absolutePath . ' is not in ' . $this->nextcloudDir);
}
$relativeDirectory = dirname($relativePath);

// Create folder if it doesn't exist
Expand Down Expand Up @@ -1180,7 +1183,10 @@ private function moveWithExclusions(string $dataLocation, array $excludedElement

}

$fileName = explode($dataLocation, $path)[1];
$fileName = explode($dataLocation, $path, 2)[1] ?? null;
if ($fileName === null) {
throw new \Exception('Could not move ' . $path . ' as it’s not in ' . $dataLocation);
}

if ($fileInfo->isFile()) {
if (!file_exists($this->nextcloudDir . '/' . dirname($fileName))) {
Expand Down
10 changes: 8 additions & 2 deletions lib/Updater.php
Original file line number Diff line number Diff line change
Expand Up @@ -492,7 +492,10 @@ public function createBackup(): void {
}

foreach ($this->getRecursiveDirectoryIterator($this->nextcloudDir, $excludedElements) as $absolutePath => $fileInfo) {
$relativePath = explode($this->nextcloudDir, $absolutePath)[1];
$relativePath = explode($this->nextcloudDir, $absolutePath, 2)[1] ?? null;
if ($relativePath === null) {
throw new \Exception($absolutePath . ' is not in ' . $this->nextcloudDir);
}
$relativeDirectory = dirname($relativePath);

// Create folder if it doesn't exist
Expand Down Expand Up @@ -1164,7 +1167,10 @@ private function moveWithExclusions(string $dataLocation, array $excludedElement

}

$fileName = explode($dataLocation, $path)[1];
$fileName = explode($dataLocation, $path, 2)[1] ?? null;
if ($fileName === null) {
throw new \Exception('Could not move ' . $path . ' as it’s not in ' . $dataLocation);
}

if ($fileInfo->isFile()) {
if (!file_exists($this->nextcloudDir . '/' . dirname($fileName))) {
Expand Down
2 changes: 1 addition & 1 deletion tests/checkSameCodeBase.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ function findDiffPos($original, $copy) {
* @var SplFileInfo $fileInfo
*/
foreach ($iterator as $path => $fileInfo) {
$fileName = explode($libDir, $path)[1];
$fileName = explode($libDir, $path, 2)[1];

if (in_array($fileName, $excludedFiles, true)) {
continue;
Expand Down
Binary file modified updater.phar
Binary file not shown.
4 changes: 2 additions & 2 deletions vendor/composer/installed.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
'name' => '__root__',
'pretty_version' => 'dev-master',
'version' => 'dev-master',
'reference' => '4123450c26d24ffaa60b2b495e0d8aa934cd982e',
'reference' => 'aa4d3f66efadf70396c0ab758da5d105bade36e2',
'type' => 'library',
'install_path' => __DIR__ . '/../../',
'aliases' => array(),
Expand All @@ -13,7 +13,7 @@
'__root__' => array(
'pretty_version' => 'dev-master',
'version' => 'dev-master',
'reference' => '4123450c26d24ffaa60b2b495e0d8aa934cd982e',
'reference' => 'aa4d3f66efadf70396c0ab758da5d105bade36e2',
'type' => 'library',
'install_path' => __DIR__ . '/../../',
'aliases' => array(),
Expand Down
Loading