Skip to content

Commit

Permalink
5.3.0 changes
Browse files Browse the repository at this point in the history
  • Loading branch information
idanbenezra committed Feb 5, 2023
1 parent 59fb6ff commit fbe3d2d
Show file tree
Hide file tree
Showing 17 changed files with 452 additions and 96 deletions.
53 changes: 36 additions & 17 deletions Account/Account.inc
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ namespace JetBackup\Core\Panel\Integration\Account;

use JetBackup\Core\Exception\PanelException;
use JetBackup\Core\Panel\Integration\Quota;
use JetBackup\Core\Restore\RestoreAccount\PostRestoreData;
use JetBackup\Core\Snapshot\SnapshotItem;

defined( '__JETBACKUP__' ) or die( 'Restricted access' );

Expand All @@ -24,6 +26,13 @@ interface Account {
*/
public function getUsername(): string;

/**
* provide informative name for the account (this field is optional and can return empty string)
*
* @return string the account nickname
*/
public function getNickname(): string;

/**
* provides the main domain of the account.
*
Expand All @@ -39,17 +48,23 @@ interface Account {
public function getHomeDir(): string;

/**
* @return string
* provide the account homedir folder owner
*
* @return string the account homedir folder owner
*/
public function getHomeDirOwner(): string;

/**
* @return string
* provide the account homedir folder group
*
* @return string the account homedir folder group
*/
public function getHomeDirGroup(): string;

/**
* @return int
* provide the homedir folder permissions (e.g. 0751)
*
* @return int the homedir folder permissions
*/
public function getHomeDirPermissions(): int;

Expand All @@ -68,9 +83,10 @@ interface Account {
public function getUniqueId(): string;

/**
* provides an array of directories to exclude from the user home directory.
* provides an array of directories to exclude from the user home directory (in rsync format).
* everything that the panel stores in the user home directory and is not a part of
* the user home directory, for example mail folder.
* e.g. `["/imap/***","/.cagefs/***"]`
*
* @return array array of directories to exclude from the user home directory.
*/
Expand Down Expand Up @@ -107,9 +123,9 @@ interface Account {
/**
* provides the package of the account.
*
* @return string|null the account's package.
* @return Package the account's package.
*/
public function getPackage():? string;
public function getPackage(): Package;

/**
* provides the packages list of the account (reseller).
Expand Down Expand Up @@ -306,9 +322,9 @@ interface Account {
public function isLoginOnly(): bool;

/**
* provides the custom data of the account (optional, can returns an empty string).
* provides the custom data of the account (optional, can return an empty string).
* it includes any information that the panel needs for the account.
* its an internal data of the panel, it can receives whatever the panel needs,
* it's an internal data of the panel, it can receive whatever the panel needs,
* the data will be backed up and restored as is.
*
* @return string the custom data of the account.
Expand All @@ -331,15 +347,18 @@ interface Account {
public function remove();

/**
* @param Config|null $config
* @param Database[]|null $databases
* @param DatabaseUser[]|null $database_users
* @param EmailAccount[]|null $emails
* @param Domain[]|null $domains
* @param FTPAccount[]|null $ftps
* @param Certificate[]|null $certificates
* @param string|null $cronjob
* preformed before each restore
*
* @param SnapshotItem[] $items
* @throws PanelException throws if there is an issue with the post restore script.
*/
public function preRestore();

/**
* preformed after each restore
*
* @param PostRestoreData $data
* @throws PanelException throws if there is an issue with the post restore script.
*/
public function postRestore(Config $config=null, $databases=null, $database_users=null, $emails=null, $domains=null, $ftps=null, $certificates=null, $cronjob=null);
public function postRestore(PostRestoreData $data);
}
8 changes: 4 additions & 4 deletions Account/Certificate.inc
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ interface Certificate {

/**
* provides the panel id.
* the the panel id needs to be as follow 'namespace_name'.
* e.g. 'MyCompany_PanelName'.
* the panel id needs to be as follows 'MyCompany_PanelName'.
* e.g. 'JetApps_cPanel'.
*
* @return string represents the panel.
*/
Expand Down Expand Up @@ -54,9 +54,9 @@ interface Certificate {
public function getCAChain(): string;

/**
* provides the custom data of the certificate (optional, can returns an empty string).
* provides the custom data of the certificate (optional, can return an empty string).
* it includes any information that the panel needs for the certificate.
* its an internal data of the panel, it can receives whatever the panel needs,
* it's an internal data of the panel, it can receive whatever the panel needs,
* the data will be backed up and restored as is.
*
* @return string the custom data of the certificate.
Expand Down
15 changes: 11 additions & 4 deletions Account/Config.inc
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ interface Config {

/**
* provides the panel id.
* the the panel id needs to be as follow 'namespace_name'.
* e.g. 'MyCompany_PanelName'.
* the panel id needs to be as follows 'MyCompany_PanelName'.
* e.g. 'JetApps_cPanel'.
*
* @return string represents the panel.
*/
Expand Down Expand Up @@ -61,9 +61,9 @@ interface Config {
/**
* provides the package of the account.
*
* @return string|null the account package.
* @return Package the account package.
*/
public function getPackage():? string;
public function getPackage(): Package;

/**
* provides the owner of the account.
Expand Down Expand Up @@ -96,6 +96,13 @@ interface Config {
*/
public function isSuspended(): bool;

/**
* returns true if the account was suspended in the backup and false otherwise.
*
* @return bool is the account suspended or not.
*/
public function isSuspendedReal(): bool;

/**
* returns true if the account is root and false otherwise.
*
Expand Down
14 changes: 10 additions & 4 deletions Account/Database.inc
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
namespace JetBackup\Core\Panel\Integration\Account;

use JetBackup\Core\Exception\PanelException;
use JetBackup\Core\Panel\Integration\DatabaseAuth;

defined( '__JETBACKUP__' ) or die( 'Restricted access' );

Expand Down Expand Up @@ -49,8 +50,8 @@ interface Database {

/**
* provides the panel id.
* the the panel id needs to be as follow 'namespace_name'.
* e.g. 'MyCompany_PanelName'.
* the panel id needs to be as follows 'MyCompany_PanelName'.
* e.g. 'JetApps_cPanel'.
*
* @return string represents the panel.
*/
Expand All @@ -75,15 +76,20 @@ interface Database {
public function getEngine(): int;

/**
* provides the custom data of the database (optional, can returns an empty string).
* provides the custom data of the database (optional, can return an empty string).
* it includes any information that the panel needs for the database.
* its an internal data of the panel, it can receives whatever the panel needs,
* it's an internal data of the panel, it can receive whatever the panel needs,
* the data will be backed up and restored as is.
*
* @return string the custom data of the database.
*/
public function getCustomData(): string;

/**
* @return DatabaseAuth|null
*/
public function getAuth():? DatabaseAuth;

/**
* removes the database.
*
Expand Down
10 changes: 5 additions & 5 deletions Account/DatabaseUser.inc
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ interface DatabaseUser {

/**
* provides the panel id.
* the the panel id needs to be as follow 'namespace_name'.
* e.g. 'MyCompany_PanelName'.
* the panel id needs to be as follows 'MyCompany_PanelName'.
* e.g. 'JetApps_cPanel'.
*
* @return string represents the panel.
*/
Expand All @@ -28,7 +28,7 @@ interface DatabaseUser {
/**
* provides the name of the database user.
*
* @return string|null the database user name.
* @return string|null the database username.
*/
public function getName():? string;

Expand Down Expand Up @@ -60,9 +60,9 @@ interface DatabaseUser {
public function getPrivileges(): array;

/**
* provides the custom data of the database user (optional, can returns an empty string).
* provides the custom data of the database user (optional, can return an empty string).
* it includes any information that the panel needs for the database user.
* its an internal data of the panel, it can receives whatever the panel needs,
* it's an internal data of the panel, it can receive whatever the panel needs,
* the data will be backed up and restored as is.
*
* @return string the custom data of the database user.
Expand Down
3 changes: 2 additions & 1 deletion Account/DatabaseUserPrivileges.inc
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,9 @@ interface DatabaseUserPrivileges {

/**
* provides the database user grants.
* e.g. ["INSERT","UPDATE","SELECT"]
*
* @return array an array with all of the database user grants.
* @return array an array with all the database user grants.
*/
public function getGrants(): array;
}
36 changes: 25 additions & 11 deletions Account/Domain.inc
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ interface Domain {
*/
const TYPE_ADDON_DOMAIN = 2;
/**
* a sub domain type.
* a subdomain type.
* a subdomain is a subset of an existing larger domain (main/addon domain).
* @var int
*/
Expand All @@ -46,8 +46,8 @@ interface Domain {

/**
* provides the panel id.
* the the panel id needs to be as follow 'namespace_name'.
* e.g. 'MyCompany_PanelName'.
* the panel id needs to be as follows 'MyCompany_PanelName'.
* e.g. 'JetApps_cPanel'.
*
* @return string represents the panel.
*/
Expand All @@ -72,32 +72,46 @@ interface Domain {
*
* @return int the domain type (see @uses for available domain types).
*
* @uses \JetBackup\Core\Panel\Integration\Account\Domain::TYPE_MAIN_DOMAIN main domain type.
* @uses \JetBackup\Core\Panel\Integration\Account\Domain::TYPE_ADDON_DOMAIN addon domain type.
* @uses \JetBackup\Core\Panel\Integration\Account\Domain::TYPE_SUBDOMAIN sub domain type.
* @uses \JetBackup\Core\Panel\Integration\Account\Domain::TYPE_ALIAS alias domain type.
* @uses Domain::TYPE_MAIN_DOMAIN main domain type.
* @uses Domain::TYPE_ADDON_DOMAIN addon domain type.
* @uses Domain::TYPE_SUBDOMAIN subdomain type.
* @uses Domain::TYPE_ALIAS alias domain type.
*/
public function getType(): int;

/**
* provides the account IP
*
* @return string|null
*/
public function getIPAddress():? string;

/**
* provides the parent domain of the domain.
*
* @return Domain the parent domain of this domain.
* @return null|Domain the parent domain of this domain.
* @throws PanelException
*/
public function getParent():? Domain;

/**
* provides the path to the zone file of the domain.
*
* @return string the path to the zone file of the domain.
* @return null|string the path to the zone file of the domain.
*/
public function getZoneFile():? string;

/**
* provides the custom data of the domain (optional, can returns an empty string).
* provides the domain php details
*
* @return PHPDetails|null
*/
public function getPHPDetails():? PHPDetails;

/**
* provides the custom data of the domain (optional, can return an empty string).
* it includes any information that the panel needs for the domain.
* its an internal data of the panel, it can receives whatever the panel needs,
* it's an internal data of the panel, it can receive whatever the panel needs,
* the data will be backed up and restored as is.
*
* @return string the custom data of the domain.
Expand Down
12 changes: 6 additions & 6 deletions Account/EmailAccount.inc
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ interface EmailAccount {

/**
* provides the panel id.
* the the panel id needs to be as follow 'namespace_name'.
* e.g. 'MyCompany_PanelName'.
* the panel id needs to be as follows 'MyCompany_PanelName'.
* e.g. 'JetApps_cPanel'.
*
* @return string represents the panel.
*/
Expand Down Expand Up @@ -48,9 +48,9 @@ interface EmailAccount {
public function getQuota(): int;

/**
* provides the send limit of the email account.
* provides the "send limit" of the email account.
*
* @return int the send limit of the email account.
* @return int the "send limit" of the email account.
*/
public function getSendLimit(): int;

Expand All @@ -69,9 +69,9 @@ interface EmailAccount {
public function getFilters(): array;

/**
* provides the custom data of the email account (optional, can returns an empty string).
* provides the custom data of the email account (optional, can return an empty string).
* it includes any information that the panel needs for the email account.
* its an internal data of the panel, it can receives whatever the panel needs,
* it's an internal data of the panel, it can receive whatever the panel needs,
* the data will be backed up and restored as is.
*
* @return string the custom data of the email account.
Expand Down
8 changes: 4 additions & 4 deletions Account/FTPAccount.inc
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ interface FTPAccount {

/**
* provides the panel id.
* the the panel id needs to be as follow 'namespace_name'.
* e.g. 'MyCompany_PanelName'.
* the panel id needs to be as follows 'MyCompany_PanelName'.
* e.g. 'JetApps_cPanel'.
*
* @return string represents the panel.
*/
Expand Down Expand Up @@ -56,9 +56,9 @@ interface FTPAccount {
public function getPath(): string;

/**
* provides the custom data of the ftp account (optional, can returns an empty string).
* provides the custom data of the ftp account (optional, can return an empty string).
* it includes any information that the panel needs for the ftp account.
* its an internal data of the panel, it can receives whatever the panel needs,
* it's an internal data of the panel, it can receive whatever the panel needs,
* the data will be backed up and restored as is.
*
* @return string the custom data of the ftp account.
Expand Down
Loading

0 comments on commit fbe3d2d

Please sign in to comment.