a0c6332372
Generic: Repo Health / Release configuration (push) Has been cancelled
Generic: Repo Health / Scripts governance (push) Has been cancelled
Generic: Repo Health / Repository health (push) Has been cancelled
Generic: Repo Health / Report Issues (push) Has been cancelled
Generic: Repo Health / Site Health (push) Has been cancelled
Generic: Repo Health / Access control (push) Has been cancelled
Universal: Auto Version Bump / Version Bump (push) Has been cancelled
The mokobackup→mokojoombackup rename created double-nested directories (e.g. com_mokojoombackup/com_mokojoombackup/). Joomla installer could not find files at the expected paths. Flattened all packages. Authored-by: Moko Consulting Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
64 lines
1.4 KiB
PHP
64 lines
1.4 KiB
PHP
<?php
|
|
|
|
/**
|
|
* @package MokoJoomBackup
|
|
* @subpackage com_mokojoombackup
|
|
* @author Moko Consulting <hello@mokoconsulting.tech>
|
|
* @copyright Copyright (C) 2026 Moko Consulting. All rights reserved.
|
|
* @license GNU General Public License version 3 or later; see LICENSE
|
|
*/
|
|
|
|
namespace Joomla\Component\MokoJoomBackup\Administrator\Engine;
|
|
|
|
defined('_JEXEC') or die;
|
|
|
|
class TarGzArchiver implements ArchiverInterface
|
|
{
|
|
private \PharData $tar;
|
|
private string $tarPath;
|
|
|
|
public function open(string $path): void
|
|
{
|
|
// PharData creates .tar first, then we compress to .tar.gz
|
|
// Strip .gz to get the .tar path for initial creation
|
|
$this->tarPath = preg_replace('/\.gz$/', '', $path);
|
|
|
|
// Remove existing files to avoid "already exists" errors
|
|
if (is_file($this->tarPath)) {
|
|
@unlink($this->tarPath);
|
|
}
|
|
|
|
if (is_file($path)) {
|
|
@unlink($path);
|
|
}
|
|
|
|
$this->tar = new \PharData($this->tarPath);
|
|
}
|
|
|
|
public function addFromString(string $localName, string $contents): void
|
|
{
|
|
$this->tar->addFromString($localName, $contents);
|
|
}
|
|
|
|
public function addFile(string $filePath, string $localName): void
|
|
{
|
|
$this->tar->addFile($filePath, $localName);
|
|
}
|
|
|
|
public function close(): void
|
|
{
|
|
// Compress the .tar to .tar.gz
|
|
$this->tar->compress(\Phar::GZ);
|
|
|
|
// Remove the uncompressed .tar
|
|
if (is_file($this->tarPath)) {
|
|
@unlink($this->tarPath);
|
|
}
|
|
}
|
|
|
|
public function getExtension(): string
|
|
{
|
|
return 'tar.gz';
|
|
}
|
|
}
|