48 lines
981 B
PHP
48 lines
981 B
PHP
|
|
<?php
|
||
|
|
|
||
|
|
/**
|
||
|
|
* @package MokoJoomBackup
|
||
|
|
* @subpackage com_mokobackup
|
||
|
|
* @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\MokoBackup\Administrator\Table;
|
||
|
|
|
||
|
|
defined('_JEXEC') or die;
|
||
|
|
|
||
|
|
use Joomla\CMS\Table\Table;
|
||
|
|
use Joomla\Database\DatabaseDriver;
|
||
|
|
|
||
|
|
class ProfileTable extends Table
|
||
|
|
{
|
||
|
|
public function __construct(DatabaseDriver $db)
|
||
|
|
{
|
||
|
|
parent::__construct('#__mokobackup_profiles', 'id', $db);
|
||
|
|
}
|
||
|
|
|
||
|
|
public function check(): bool
|
||
|
|
{
|
||
|
|
if (empty($this->title)) {
|
||
|
|
$this->setError('Profile title is required.');
|
||
|
|
|
||
|
|
return false;
|
||
|
|
}
|
||
|
|
|
||
|
|
if (empty($this->backup_type)) {
|
||
|
|
$this->backup_type = 'full';
|
||
|
|
}
|
||
|
|
|
||
|
|
$now = date('Y-m-d H:i:s');
|
||
|
|
|
||
|
|
if (empty($this->created) || $this->created === '0000-00-00 00:00:00') {
|
||
|
|
$this->created = $now;
|
||
|
|
}
|
||
|
|
|
||
|
|
$this->modified = $now;
|
||
|
|
|
||
|
|
return true;
|
||
|
|
}
|
||
|
|
}
|