first commit

This commit is contained in:
2026-02-08 21:16:11 +01:00
commit e17b7026fd
8881 changed files with 1160453 additions and 0 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,142 @@
<?php
/**
* Akeeba Engine
*
* @package akeebaengine
* @copyright Copyright (c)2006-2022 Nicholas K. Dionysopoulos / Akeeba Ltd
* @license GNU General Public License version 3, or later
*/
namespace Akeeba\Engine\Dump;
defined('AKEEBAENGINE') || die();
use Akeeba\Engine\Base\Exceptions\ErrorException;
use Akeeba\Engine\Base\Part;
use Akeeba\Engine\Dump\Base as DumpBase;
use Akeeba\Engine\Factory;
use RuntimeException;
class Native extends Part
{
/** @var DumpBase */
private $_engine = null;
/**
* Implements the constructor of the class
*
* @return void
*/
public function __construct()
{
parent::__construct();
Factory::getLog()->debug(__CLASS__ . " :: New instance");
}
/**
* Runs the preparation for this part. Should set _isPrepared
* to true
*
* @return void
*/
protected function _prepare()
{
Factory::getLog()->debug(__CLASS__ . " :: Processing parameters");
$options = null;
// Get the DB connection parameters
if (is_array($this->_parametersArray))
{
$driver = $this->_parametersArray['driver'] ?? 'mysql';
$prefix = $this->_parametersArray['prefix'] ?? '';
if (($driver == 'mysql') && !function_exists('mysql_connect'))
{
$driver = 'mysqli';
}
$options = [
'driver' => $driver,
'host' => $this->_parametersArray['host'] ?? '',
'port' => $this->_parametersArray['port'] ?? '',
'user' => $this->_parametersArray['user'] ?? ($this->_parametersArray['username'] ?? ''),
'password' => $this->_parametersArray['password'] ?? '',
'database' => $this->_parametersArray['database'] ?? '',
'prefix' => is_null($prefix) ? '' : $prefix,
];
$options['ssl'] = $this->_parametersArray['ssl'] ?? [];
$options['ssl'] = is_array($options['ssl']) ? $options['ssl'] : [];
$options['ssl']['enable'] = (bool) ($options['ssl']['enable'] ?? $this->_parametersArray['dbencryption'] ?? false);
$options['ssl']['cipher'] = ($options['ssl']['cipher'] ?? $this->_parametersArray['dbsslcipher'] ?? null) ?: null;
$options['ssl']['ca'] = ($options['ssl']['ca'] ?? $this->_parametersArray['dbsslca'] ?? null) ?: null;
$options['ssl']['capath'] = ($options['ssl']['capath'] ?? $this->_parametersArray['dbsslcapath'] ?? null) ?: null;
$options['ssl']['key'] = ($options['ssl']['key'] ?? $this->_parametersArray['dbsslkey'] ?? null) ?: null;
$options['ssl']['cert'] = ($options['ssl']['cert'] ?? $this->_parametersArray['dbsslcert'] ?? null) ?: null;
$options['ssl']['verify_server_cert'] = (bool) (($options['ssl']['verify_server_cert'] ?? $this->_parametersArray['dbsslverifyservercert'] ?? false) ?: false);
}
$db = Factory::getDatabase($options);
if ($db->getErrorNum() > 0)
{
$error = $db->getErrorMsg();
throw new RuntimeException(__CLASS__ . ' :: Database Error: ' . $error);
}
$driverType = $db->getDriverType();
$className = '\\Akeeba\\Engine\\Dump\\Native\\' . ucfirst($driverType);
// Check if we have a native dump driver
if (!class_exists($className, true))
{
$this->setState(self::STATE_ERROR);
throw new ErrorException('Akeeba Engine does not have a native dump engine for ' . $driverType . ' databases');
}
Factory::getLog()->debug(__CLASS__ . " :: Instanciating new native database dump engine $className");
$this->_engine = new $className;
$this->_engine->setup($this->_parametersArray);
$this->_engine->callStage('_prepare');
$this->setState($this->_engine->getState());
}
/**
* Runs the finalisation process for this part. Should set
* _isFinished to true.
*
* @return void
*/
protected function _finalize()
{
$this->_engine->callStage('_finalize');
$this->setState($this->_engine->getState());
}
/**
* Runs the main functionality loop for this part. Upon calling,
* should set the _isRunning to true. When it finished, should set
* the _hasRan to true. If an error is encountered, setError should
* be used.
*
* @return void
*/
protected function _run()
{
$this->_engine->callStage('_run');
$this->setState($this->_engine->getState());
$this->setStep($this->_engine->getStep());
$this->setSubstep($this->_engine->getSubstep());
$this->partNumber = $this->_engine->partNumber;
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,71 @@
<?php
/**
* Akeeba Engine
*
* @package akeebaengine
* @copyright Copyright (c)2006-2022 Nicholas K. Dionysopoulos / Akeeba Ltd
* @license GNU General Public License version 3, or later
*/
namespace Akeeba\Engine\Dump\Native;
defined('AKEEBAENGINE') || die();
use Akeeba\Engine\Dump\Base;
use Akeeba\Engine\Factory;
/**
* Dump class for the "None" database driver (ie no database used by the application)
*/
class None extends Base
{
public function __construct()
{
parent::__construct();
}
/**
* Populates the table arrays with the information for the db entities to backup
*
* @return void
*/
protected function getTablesToBackup()
{
}
/**
* Runs a step of the database dump
*
* @return void
*/
protected function stepDatabaseDump()
{
Factory::getLog()->info("Reminder: database definitions using the 'None' driver result in no data being backed up.");
$this->setState(self::STATE_FINISHED);
}
/**
* Return the current database name by querying the database connection object (e.g. SELECT DATABASE() in MySQL)
*
* @return string
*/
protected function getDatabaseNameFromConnection()
{
return '';
}
protected function _run()
{
Factory::getLog()->info("Reminder: database definitions using the 'None' driver result in no data being backed up.");
$this->setState(self::STATE_POSTRUN);
}
protected function _finalize()
{
Factory::getLog()->info("Reminder: database definitions using the 'None' driver result in no data being backed up.");
$this->setState(self::STATE_FINISHED);
}
}

View File

@@ -0,0 +1,28 @@
<?php
/**
* Akeeba Engine
*
* @package akeebaengine
* @copyright Copyright (c)2006-2022 Nicholas K. Dionysopoulos / Akeeba Ltd
* @license GNU General Public License version 3, or later
*/
namespace Akeeba\Engine\Dump\Native;
defined('AKEEBAENGINE') || die();
use RuntimeException;
/**
* Dump class for the "None" database driver (ie no database used by the application)
*/
class Sqlite extends None
{
public function __construct()
{
parent::__construct();
throw new RuntimeException("Please do not add SQLite databases, they are files. If they are under your site's root they are backed up automatically. Otherwise use the Off-site Directories Inclusion to include them in the backup.");
}
}

View File

@@ -0,0 +1,81 @@
{
"_information": {
"title": "COM_AKEEBA_CONFIG_ENGINE_DUMP_NATIVE_TITLE",
"description": "COM_AKEEBA_CONFIG_ENGINE_DUMP_NATIVE_DESCRIPTION"
},
"engine.dump.divider.common": {
"default": "0",
"type": "separator",
"title": "COM_AKEEBA_CONFIG_DUMP_DIVIDER_COMMON",
"bold": "1"
},
"engine.dump.common.blankoutpass": {
"default": "0",
"type": "bool",
"title": "COM_AKEEBA_CONFIG_BLANKOUTPASS_TITLE",
"description": "COM_AKEEBA_CONFIG_BLANKOUTPASS_DESCRIPTION"
},
"engine.dump.common.extended_inserts": {
"default": "1",
"type": "bool",
"title": "COM_AKEEBA_CONFIG_EXTENDEDINSERTS_TITLE",
"description": "COM_AKEEBA_CONFIG_EXTENDEDINSERTS_DESCRIPTION"
},
"engine.dump.common.packet_size": {
"default": "131072",
"type": "integer",
"min": "1",
"max": "1048576",
"shortcuts": "16384|32768|65536|131072|262144|524288|1048576",
"scale": "1024",
"uom": "KB",
"title": "COM_AKEEBA_CONFIG_MAXPACKET_TITLE",
"description": "COM_AKEEBA_CONFIG_MAXPACKET_DESCRIPTION"
},
"engine.dump.common.splitsize": {
"default": "524288",
"type": "integer",
"min": "0",
"max": "10485760",
"shortcuts": "524288|1048576|2097152|5242880|10485760",
"scale": "1048576",
"uom": "MB",
"title": "COM_AKEEBA_CONFIG_SPLITDBDUMP_TITLE",
"description": "COM_AKEEBA_CONFIG_SPLITDBDUMP_DESCRIPTION"
},
"engine.dump.common.batchsize": {
"default": "1000",
"type": "integer",
"min": "0",
"max": "100000",
"shortcuts": "10|20|50|100|200|500|1000",
"scale": "1",
"uom": "queries",
"title": "COM_AKEEBA_CONFIG_BACTHSIZE_TITLE",
"description": "COM_AKEEBA_CONFIG_BACTHSIZE_DESCRIPTION"
},
"engine.dump.divider.mysql": {
"default": "0",
"type": "separator",
"title": "COM_AKEEBA_CONFIG_DUMP_DIVIDER_MYSQL",
"bold": "1"
},
"engine.dump.native.advanced_entitites": {
"default": "0",
"type": "bool",
"title": "COM_AKEEBA_CONFIG_MYSQL5FEATURES_ENABLE_TITLE",
"description": "COM_AKEEBA_CONFIG_MYSQL5FEATURES_ENABLE_DESCRIPTION"
},
"engine.dump.native.nodependencies": {
"default": "0",
"type": "bool",
"title": "COM_AKEEBA_CONFIG_NODEPENDENCIES_TITLE",
"description": "COM_AKEEBA_CONFIG_NODEPENDENCIES_DESCRIPTION"
},
"engine.dump.native.nobtree": {
"default": "1",
"type": "bool",
"title": "COM_AKEEBA_CONFIG_MYSQLNOBTREE_TITLE",
"description": "COM_AKEEBA_CONFIG_MYSQLNOBTREE_TIP"
}
}