forked from LiveCarta/LiveCartaWP
Changed source root directory
This commit is contained in:
@@ -0,0 +1,250 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* custom hosting manager
|
||||
* singleton class
|
||||
*
|
||||
* Standard: PSR-2
|
||||
*
|
||||
* @package SC\DUPX\DB
|
||||
* @link http://www.php-fig.org/psr/psr-2/
|
||||
*/
|
||||
|
||||
defined('ABSPATH') || defined('DUPXABSPATH') || exit;
|
||||
|
||||
use Duplicator\Installer\Core\Params\PrmMng;
|
||||
use Duplicator\Installer\Core\Params\Items\ParamForm;
|
||||
use Duplicator\Libs\Snap\SnapWP;
|
||||
|
||||
require_once(DUPX_INIT . '/classes/host/interface.host.php');
|
||||
require_once(DUPX_INIT . '/classes/host/class.godaddy.host.php');
|
||||
require_once(DUPX_INIT . '/classes/host/class.wpengine.host.php');
|
||||
require_once(DUPX_INIT . '/classes/host/class.wordpresscom.host.php');
|
||||
require_once(DUPX_INIT . '/classes/host/class.liquidweb.host.php');
|
||||
require_once(DUPX_INIT . '/classes/host/class.pantheon.host.php');
|
||||
require_once(DUPX_INIT . '/classes/host/class.flywheel.host.php');
|
||||
require_once(DUPX_INIT . '/classes/host/class.siteground.host.php');
|
||||
|
||||
class DUPX_Custom_Host_Manager
|
||||
{
|
||||
const HOST_GODADDY = 'godaddy';
|
||||
const HOST_WPENGINE = 'wpengine';
|
||||
const HOST_WORDPRESSCOM = 'wordpresscom';
|
||||
const HOST_LIQUIDWEB = 'liquidweb';
|
||||
const HOST_PANTHEON = 'pantheon';
|
||||
const HOST_FLYWHEEL = 'flywheel';
|
||||
const HOST_SITEGROUND = 'siteground';
|
||||
|
||||
/**
|
||||
*
|
||||
* @var self
|
||||
*/
|
||||
protected static $instance = null;
|
||||
|
||||
/**
|
||||
* this var prevent multiple params inizialization.
|
||||
* it's useful on development to prevent an infinite loop in class constructor
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
private $initialized = false;
|
||||
|
||||
/**
|
||||
* custom hostings list
|
||||
*
|
||||
* @var DUPX_Host_interface[]
|
||||
*/
|
||||
private $customHostings = array();
|
||||
|
||||
/**
|
||||
* active custom hosting in current server
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
private $activeHostings = array();
|
||||
|
||||
/**
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public static function getInstance()
|
||||
{
|
||||
if (is_null(self::$instance)) {
|
||||
self::$instance = new self();
|
||||
}
|
||||
return self::$instance;
|
||||
}
|
||||
|
||||
/**
|
||||
* init custom histings
|
||||
*/
|
||||
private function __construct()
|
||||
{
|
||||
$this->customHostings[DUPX_WPEngine_Host::getIdentifier()] = new DUPX_WPEngine_Host();
|
||||
$this->customHostings[DUPX_GoDaddy_Host::getIdentifier()] = new DUPX_GoDaddy_Host();
|
||||
$this->customHostings[DUPX_WordpressCom_Host::getIdentifier()] = new DUPX_WordpressCom_Host();
|
||||
$this->customHostings[DUPX_Liquidweb_Host::getIdentifier()] = new DUPX_Liquidweb_Host();
|
||||
$this->customHostings[DUPX_Pantheon_Host::getIdentifier()] = new DUPX_Pantheon_Host();
|
||||
$this->customHostings[DUPX_Flywheel_Host::getIdentifier()] = new DUPX_Flywheel_Host();
|
||||
$this->customHostings[DUPX_Siteground_Host::getIdentifier()] = new DUPX_Siteground_Host();
|
||||
}
|
||||
|
||||
/**
|
||||
* execute the active custom hostings inizialization only one time.
|
||||
*
|
||||
* @return boolean
|
||||
* @throws Exception
|
||||
*/
|
||||
public function init()
|
||||
{
|
||||
if ($this->initialized) {
|
||||
return true;
|
||||
}
|
||||
foreach ($this->customHostings as $cHost) {
|
||||
if (!($cHost instanceof DUPX_Host_interface)) {
|
||||
throw new Exception('Host must implemnete DUPX_Host_interface');
|
||||
}
|
||||
if ($cHost->isHosting()) {
|
||||
$this->activeHostings[] = $cHost->getIdentifier();
|
||||
$cHost->init();
|
||||
}
|
||||
}
|
||||
$this->initialized = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* return the lisst of current custom active hostings
|
||||
*
|
||||
* @return DUPX_Host_interface[]
|
||||
*/
|
||||
public function getActiveHostings()
|
||||
{
|
||||
$result = array();
|
||||
foreach ($this->customHostings as $cHost) {
|
||||
if ($cHost->isHosting()) {
|
||||
$result[] = $cHost->getIdentifier();
|
||||
}
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* return true if current identifier hostoing is active
|
||||
*
|
||||
* @param string $identifier
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isHosting($identifier)
|
||||
{
|
||||
return isset($this->customHostings[$identifier]) && $this->customHostings[$identifier]->isHosting();
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return boolean|string return false if isn't managed manage hosting of manager hosting
|
||||
*/
|
||||
public function isManaged()
|
||||
{
|
||||
if ($this->isHosting(self::HOST_WPENGINE)) {
|
||||
return self::HOST_WPENGINE;
|
||||
} elseif ($this->isHosting(self::HOST_LIQUIDWEB)) {
|
||||
return self::HOST_LIQUIDWEB;
|
||||
} elseif ($this->isHosting(self::HOST_GODADDY)) {
|
||||
return self::HOST_GODADDY;
|
||||
} elseif ($this->isHosting(self::HOST_WORDPRESSCOM)) {
|
||||
return self::HOST_WORDPRESSCOM;
|
||||
} elseif ($this->isHosting(self::HOST_PANTHEON)) {
|
||||
return self::HOST_PANTHEON;
|
||||
} elseif ($this->isHosting(self::HOST_FLYWHEEL)) {
|
||||
return self::HOST_FLYWHEEL;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param type $identifier
|
||||
*
|
||||
* @return boolean|DUPX_Host_interface
|
||||
*/
|
||||
public function getHosting($identifier)
|
||||
{
|
||||
if ($this->isHosting($identifier)) {
|
||||
return $this->customHostings[$identifier];
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @todo temp function fot prevent the warnings on managed hosting.
|
||||
* This function must be removed in favor of right extraction mode will'be implemented
|
||||
*
|
||||
* @param string $extract_filename
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function skipWarningExtractionForManaged($extract_filename)
|
||||
{
|
||||
if (!$this->isManaged()) {
|
||||
return false;
|
||||
} elseif (SnapWP::isWpCore($extract_filename, SnapWP::PATH_RELATIVE)) {
|
||||
return true;
|
||||
} elseif (DUPX_ArchiveConfig::getInstance()->isChildOfArchivePath($extract_filename, array('abs', 'plugins', 'muplugins', 'themes'))) {
|
||||
return true;
|
||||
} elseif (in_array($extract_filename, DUPX_Plugins_Manager::getInstance()->getDropInsPaths())) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return bool
|
||||
* @throws Exception
|
||||
*/
|
||||
public function setManagedHostParams()
|
||||
{
|
||||
if (($managedSlug = $this->isManaged()) === false) {
|
||||
return;
|
||||
}
|
||||
|
||||
$paramsManager = PrmMng::getInstance();
|
||||
|
||||
$paramsManager->setValue(PrmMng::PARAM_WP_CONFIG, 'nothing');
|
||||
$paramsManager->setFormStatus(PrmMng::PARAM_WP_CONFIG, ParamForm::STATUS_INFO_ONLY);
|
||||
$paramsManager->setValue(PrmMng::PARAM_HTACCESS_CONFIG, 'nothing');
|
||||
$paramsManager->setFormStatus(PrmMng::PARAM_HTACCESS_CONFIG, ParamForm::STATUS_INFO_ONLY);
|
||||
$paramsManager->setValue(PrmMng::PARAM_OTHER_CONFIG, 'nothing');
|
||||
$paramsManager->setFormStatus(PrmMng::PARAM_OTHER_CONFIG, ParamForm::STATUS_INFO_ONLY);
|
||||
|
||||
$paramsManager->setValue(PrmMng::PARAM_DB_ACTION, 'empty');
|
||||
|
||||
if (DUPX_InstallerState::getInstance()->getMode() === DUPX_InstallerState::MODE_OVR_INSTALL) {
|
||||
$overwriteData = $paramsManager->getValue(PrmMng::PARAM_OVERWRITE_SITE_DATA);
|
||||
$paramsManager->setValue(PrmMng::PARAM_VALIDATION_ACTION_ON_START, DUPX_Validation_manager::ACTION_ON_START_AUTO);
|
||||
$paramsManager->setValue(PrmMng::PARAM_DB_DISPLAY_OVERWIRE_WARNING, false);
|
||||
$paramsManager->setValue(PrmMng::PARAM_DB_HOST, $overwriteData['dbhost']);
|
||||
$paramsManager->setValue(PrmMng::PARAM_DB_NAME, $overwriteData['dbname']);
|
||||
$paramsManager->setValue(PrmMng::PARAM_DB_USER, $overwriteData['dbuser']);
|
||||
$paramsManager->setValue(PrmMng::PARAM_DB_PASS, $overwriteData['dbpass']);
|
||||
$paramsManager->setValue(PrmMng::PARAM_DB_TABLE_PREFIX, $overwriteData['table_prefix']);
|
||||
$paramsManager->setFormStatus(PrmMng::PARAM_DB_ACTION, ParamForm::STATUS_INFO_ONLY);
|
||||
$paramsManager->setFormStatus(PrmMng::PARAM_DB_HOST, ParamForm::STATUS_INFO_ONLY);
|
||||
$paramsManager->setFormStatus(PrmMng::PARAM_DB_NAME, ParamForm::STATUS_INFO_ONLY);
|
||||
$paramsManager->setFormStatus(PrmMng::PARAM_DB_USER, ParamForm::STATUS_INFO_ONLY);
|
||||
$paramsManager->setFormStatus(PrmMng::PARAM_DB_PASS, ParamForm::STATUS_INFO_ONLY);
|
||||
$paramsManager->setFormStatus(PrmMng::PARAM_DB_TABLE_PREFIX, ParamForm::STATUS_INFO_ONLY);
|
||||
}
|
||||
|
||||
$paramsManager->setFormStatus(PrmMng::PARAM_URL_NEW, ParamForm::STATUS_INFO_ONLY);
|
||||
$paramsManager->setFormStatus(PrmMng::PARAM_SITE_URL, ParamForm::STATUS_INFO_ONLY);
|
||||
$paramsManager->setFormStatus(PrmMng::PARAM_PATH_NEW, ParamForm::STATUS_INFO_ONLY);
|
||||
|
||||
$this->getHosting($managedSlug)->setCustomParams();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Flywheel custom hosting class
|
||||
*
|
||||
* Standard: PSR-2
|
||||
*
|
||||
* @package SC\DUPX\DB
|
||||
* @link http://www.php-fig.org/psr/psr-2/
|
||||
*/
|
||||
|
||||
defined('ABSPATH') || defined('DUPXABSPATH') || exit;
|
||||
|
||||
use Duplicator\Installer\Core\Params\PrmMng;
|
||||
|
||||
/**
|
||||
* class for wordpress.com managed hosting
|
||||
*
|
||||
* @todo not yet implemneted
|
||||
*/
|
||||
class DUPX_Flywheel_Host implements DUPX_Host_interface
|
||||
{
|
||||
/**
|
||||
* return the current host itentifier
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function getIdentifier()
|
||||
{
|
||||
return DUPX_Custom_Host_Manager::HOST_FLYWHEEL;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool true if is current host
|
||||
*/
|
||||
public function isHosting()
|
||||
{
|
||||
// check only mu plugin file exists
|
||||
|
||||
$testFile = PrmMng::getInstance()->getValue(PrmMng::PARAM_PATH_NEW) . '/.fw-config.php';
|
||||
return file_exists($testFile);
|
||||
}
|
||||
|
||||
/**
|
||||
* the init function.
|
||||
* is called only if isHosting is true
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function init()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getLabel()
|
||||
{
|
||||
return 'Flywheel';
|
||||
}
|
||||
|
||||
/**
|
||||
* this function is called if current hosting is this
|
||||
*/
|
||||
public function setCustomParams()
|
||||
{
|
||||
$paramsManager = PrmMng::getInstance();
|
||||
|
||||
$paramsManager->setValue(PrmMng::PARAM_ARCHIVE_ENGINE_SKIP_WP_FILES, DUP_Extraction::FILTER_SKIP_WP_CORE);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* godaddy custom hosting class
|
||||
*
|
||||
* Standard: PSR-2
|
||||
*
|
||||
* @package SC\DUPX\DB
|
||||
* @link http://www.php-fig.org/psr/psr-2/
|
||||
*/
|
||||
|
||||
defined('ABSPATH') || defined('DUPXABSPATH') || exit;
|
||||
|
||||
use Duplicator\Installer\Core\Params\PrmMng;
|
||||
|
||||
/**
|
||||
* class for GoDaddy managed hosting
|
||||
*
|
||||
* @todo not yet implemneted
|
||||
*/
|
||||
class DUPX_GoDaddy_Host implements DUPX_Host_interface
|
||||
{
|
||||
/**
|
||||
* return the current host itentifier
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function getIdentifier()
|
||||
{
|
||||
return DUPX_Custom_Host_Manager::HOST_GODADDY;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool true if is current host
|
||||
*/
|
||||
public function isHosting()
|
||||
{
|
||||
// check only mu plugin file exists
|
||||
|
||||
$file = PrmMng::getInstance()->getValue(PrmMng::PARAM_PATH_MUPLUGINS_NEW) . '/gd-system-plugin.php';
|
||||
return file_exists($file);
|
||||
}
|
||||
|
||||
/**
|
||||
* the init function.
|
||||
* is called only if isHosting is true
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function init()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getLabel()
|
||||
{
|
||||
return 'GoDaddy';
|
||||
}
|
||||
|
||||
/**
|
||||
* this function is called if current hosting is this
|
||||
*/
|
||||
public function setCustomParams()
|
||||
{
|
||||
PrmMng::getInstance()->setValue(PrmMng::PARAM_IGNORE_PLUGINS, array(
|
||||
'gd-system-plugin.php',
|
||||
'object-cache.php'
|
||||
));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* liquidweb custom hosting class
|
||||
*
|
||||
* Standard: PSR-2
|
||||
*
|
||||
* @package SC\DUPX\DB
|
||||
* @link http://www.php-fig.org/psr/psr-2/
|
||||
*/
|
||||
|
||||
defined('ABSPATH') || defined('DUPXABSPATH') || exit;
|
||||
|
||||
use Duplicator\Installer\Core\Params\PrmMng;
|
||||
|
||||
class DUPX_Liquidweb_Host implements DUPX_Host_interface
|
||||
{
|
||||
/**
|
||||
* return the current host itentifier
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function getIdentifier()
|
||||
{
|
||||
return DUPX_Custom_Host_Manager::HOST_LIQUIDWEB;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool true if is current host
|
||||
*/
|
||||
public function isHosting()
|
||||
{
|
||||
// check only mu plugin file exists
|
||||
|
||||
$testFile = PrmMng::getInstance()->getValue(PrmMng::PARAM_PATH_MUPLUGINS_NEW) . '/liquid-web.php';
|
||||
return file_exists($testFile);
|
||||
}
|
||||
|
||||
/**
|
||||
* the init function.
|
||||
* is called only if isHosting is true
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function init()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* return the label of current hosting
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getLabel()
|
||||
{
|
||||
return 'Liquid Web';
|
||||
}
|
||||
|
||||
/**
|
||||
* this function is called if current hosting is this
|
||||
*/
|
||||
public function setCustomParams()
|
||||
{
|
||||
PrmMng::getInstance()->setValue(PrmMng::PARAM_IGNORE_PLUGINS, array(
|
||||
'liquidweb_mwp.php',
|
||||
'000-liquidweb-config.php',
|
||||
'liquid-web.php',
|
||||
'lw_disable_nags.php'
|
||||
));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* godaddy custom hosting class
|
||||
*
|
||||
* Standard: PSR-2
|
||||
*
|
||||
* @package SC\DUPX\DB
|
||||
* @link http://www.php-fig.org/psr/psr-2/
|
||||
*/
|
||||
|
||||
defined('ABSPATH') || defined('DUPXABSPATH') || exit;
|
||||
|
||||
use Duplicator\Installer\Core\Params\PrmMng;
|
||||
|
||||
/**
|
||||
* class for GoDaddy managed hosting
|
||||
*
|
||||
* @todo not yet implemneted
|
||||
*/
|
||||
class DUPX_Pantheon_Host implements DUPX_Host_interface
|
||||
{
|
||||
/**
|
||||
* return the current host itentifier
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function getIdentifier()
|
||||
{
|
||||
return DUPX_Custom_Host_Manager::HOST_PANTHEON;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool true if is current host
|
||||
* @throws Exception
|
||||
*/
|
||||
public function isHosting()
|
||||
{
|
||||
// check only mu plugin file exists
|
||||
|
||||
$testFile = PrmMng::getInstance()->getValue(PrmMng::PARAM_PATH_MUPLUGINS_NEW) . '/pantheon.php';
|
||||
return file_exists($testFile);
|
||||
}
|
||||
|
||||
/**
|
||||
* the init function.
|
||||
* is called only if isHosting is true
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function init()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getLabel()
|
||||
{
|
||||
return 'Pantheon';
|
||||
}
|
||||
|
||||
/**
|
||||
* this function is called if current hosting is this
|
||||
*/
|
||||
public function setCustomParams()
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Siteground custom hosting class
|
||||
*
|
||||
* Standard: PSR-2
|
||||
*
|
||||
* @package SC\DUPX\DB
|
||||
* @link http://www.php-fig.org/psr/psr-2/
|
||||
*/
|
||||
|
||||
defined('ABSPATH') || defined('DUPXABSPATH') || exit;
|
||||
|
||||
use Duplicator\Libs\Snap\SnapUtil;
|
||||
|
||||
class DUPX_Siteground_Host implements DUPX_Host_interface
|
||||
{
|
||||
/**
|
||||
* return the current host identifier
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function getIdentifier()
|
||||
{
|
||||
return DUPX_Custom_Host_Manager::HOST_SITEGROUND;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool true if is current host
|
||||
*/
|
||||
public function isHosting()
|
||||
{
|
||||
ob_start();
|
||||
SnapUtil::phpinfo(INFO_GENERAL);
|
||||
$serverinfo = ob_get_clean();
|
||||
|
||||
return (strpos($serverinfo, "siteground") !== false);
|
||||
}
|
||||
|
||||
/**
|
||||
* the init function.
|
||||
* is called only if isHosting is true
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function init()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getLabel()
|
||||
{
|
||||
return 'SiteGround';
|
||||
}
|
||||
|
||||
/**
|
||||
* this function is called if current hosting is this
|
||||
*/
|
||||
public function setCustomParams()
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,75 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* godaddy custom hosting class
|
||||
*
|
||||
* Standard: PSR-2
|
||||
*
|
||||
* @package SC\DUPX\DB
|
||||
* @link http://www.php-fig.org/psr/psr-2/
|
||||
*/
|
||||
|
||||
defined('ABSPATH') || defined('DUPXABSPATH') || exit;
|
||||
|
||||
use Duplicator\Installer\Core\Params\Descriptors\ParamDescUsers;
|
||||
use Duplicator\Installer\Utils\Log\Log;
|
||||
use Duplicator\Installer\Core\Params\PrmMng;
|
||||
|
||||
/**
|
||||
* class for wordpress.com managed hosting
|
||||
*
|
||||
* @todo not yet implemneted
|
||||
*/
|
||||
class DUPX_WordpressCom_Host implements DUPX_Host_interface
|
||||
{
|
||||
/**
|
||||
* return the current host itentifier
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function getIdentifier()
|
||||
{
|
||||
return DUPX_Custom_Host_Manager::HOST_WORDPRESSCOM;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool true if is current host
|
||||
*/
|
||||
public function isHosting()
|
||||
{
|
||||
// check only mu plugin file exists
|
||||
|
||||
$testFile = PrmMng::getInstance()->getValue(PrmMng::PARAM_PATH_MUPLUGINS_NEW) . '/wpcomsh-loader.php';
|
||||
return file_exists($testFile);
|
||||
}
|
||||
|
||||
/**
|
||||
* the init function.
|
||||
* is called only if isHosting is true
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function init()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getLabel()
|
||||
{
|
||||
return 'wordpress.com';
|
||||
}
|
||||
|
||||
/**
|
||||
* this function is called if current hosting is this
|
||||
*/
|
||||
public function setCustomParams()
|
||||
{
|
||||
$paramsManager = PrmMng::getInstance();
|
||||
|
||||
$paramsManager->setValue(PrmMng::PARAM_ARCHIVE_ENGINE_SKIP_WP_FILES, DUP_Extraction::FILTER_SKIP_WP_CORE);
|
||||
$paramsManager->setValue(PrmMng::PARAM_USERS_MODE, ParamDescUsers::USER_MODE_IMPORT_USERS);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,157 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* wpengine custom hosting class
|
||||
*
|
||||
* Standard: PSR-2
|
||||
*
|
||||
* @package SC\DUPX\DB
|
||||
* @link http://www.php-fig.org/psr/psr-2/
|
||||
*/
|
||||
|
||||
defined('ABSPATH') || defined('DUPXABSPATH') || exit;
|
||||
|
||||
use Duplicator\Installer\Core\Params\PrmMng;
|
||||
|
||||
/**
|
||||
* class for wpengine managed hosting
|
||||
*
|
||||
* @todo not yet implemneted
|
||||
*/
|
||||
class DUPX_WPEngine_Host implements DUPX_Host_interface
|
||||
{
|
||||
/**
|
||||
* return the current host itentifier
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function getIdentifier()
|
||||
{
|
||||
return DUPX_Custom_Host_Manager::HOST_WPENGINE;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool true if is current host
|
||||
*/
|
||||
public function isHosting()
|
||||
{
|
||||
// check only mu plugin file exists
|
||||
|
||||
$file = PrmMng::getInstance()->getValue(PrmMng::PARAM_PATH_MUPLUGINS_NEW) . '/wpengine-security-auditor.php';
|
||||
return file_exists($file);
|
||||
}
|
||||
|
||||
/**
|
||||
* the init function.
|
||||
* is called only if isHosting is true
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function init()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getLabel()
|
||||
{
|
||||
return 'WP Engine';
|
||||
}
|
||||
|
||||
/**
|
||||
* this function is called if current hosting is this
|
||||
*/
|
||||
public function setCustomParams()
|
||||
{
|
||||
PrmMng::getInstance()->setValue(PrmMng::PARAM_IGNORE_PLUGINS, array(
|
||||
'mu-plugin.php',
|
||||
'advanced-cache.php',
|
||||
'wpengine-security-auditor.php',
|
||||
'stop-long-comments.php',
|
||||
'slt-force-strong-passwords.php'
|
||||
));
|
||||
|
||||
$this->force_disable_plugins();
|
||||
}
|
||||
|
||||
/**
|
||||
* force disable disallowed plugins
|
||||
*
|
||||
* @link https://wpengine.com/support/disallowed-plugins/
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
private function force_disable_plugins()
|
||||
{
|
||||
$fdPlugins = PrmMng::getInstance()->getValue(PrmMng::PARAM_FORCE_DIABLE_PLUGINS);
|
||||
|
||||
if (!is_array($fdPlugins)) {
|
||||
$fdPlugins = array();
|
||||
}
|
||||
|
||||
$fdPlugins = array_merge($fdPlugins, array(
|
||||
'gd-system-plugin.php',
|
||||
'hcs.php',
|
||||
'hello.php',
|
||||
'adminer/adminer.php',
|
||||
'async-google-analytics/asyncgoogleanalytics.php',
|
||||
'backup/backup.php',
|
||||
'backup-scheduler/backup-scheduler.php',
|
||||
'backupwordpress/backupwordpress.php',
|
||||
'backwpup/backwpup.php',
|
||||
'bad-behavior/bad-behavior-wordpress.php',
|
||||
'broken-link-checker/broken-link-checker.php',
|
||||
'content-molecules/emc2_content_molecules.php',
|
||||
'contextual-related-posts/contextual-related-posts.php',
|
||||
'dynamic-related-posts/drpp.php',
|
||||
'ewww-image-optimizer/ewww-image-optimizer.php',
|
||||
'ezpz-one-click-backup/ezpz-ocb.php',
|
||||
'file-commander/wp-plugin-file-commander.php',
|
||||
'fuzzy-seo-booster/seoqueries.php',
|
||||
'google-xml-sitemaps-with-multisite-support/sitemap.php',
|
||||
'hc-custom-wp-admin-url/hc-custom-wp-admin-url.php',
|
||||
'jr-referrer/jr-referrer.php',
|
||||
'jumpple/sweetcaptcha.php',
|
||||
'missed-schedule/missed-schedule.php',
|
||||
'no-revisions/norevisions.php',
|
||||
'ozh-who-sees-ads/wp_ozh_whoseesads.php',
|
||||
'pipdig-power-pack/p3.php',
|
||||
'portable-phpmyadmin/wp-phpmyadmin.php',
|
||||
'quick-cache/quick-cache.php',
|
||||
'quick-cache-pro/quick-cache-pro.php',
|
||||
'recommend-a-friend/recommend-to-a-friend.php',
|
||||
'seo-alrp/seo-alrp.php',
|
||||
'si-captcha-for-wordpress/si-captcha.php',
|
||||
'similar-posts/similar-posts.php',
|
||||
'spamreferrerblock/spam_referrer_block.php',
|
||||
'super-post/super-post.php',
|
||||
'superslider/superslider.php',
|
||||
'sweetcaptcha-revolutionary-free-captcha-service/sweetcaptcha.php',
|
||||
'the-codetree-backup/codetree-backup.php',
|
||||
'ToolsPack/ToolsPack.php',
|
||||
'tweet-blender/tweet-blender.php',
|
||||
'versionpress/versionpress.php',
|
||||
'w3-total-cache/w3-total-cache.php',
|
||||
'wordpress-gzip-compression/ezgz.php',
|
||||
'wp-cache/wp-cache.php',
|
||||
'wp-database-optimizer/wp_database_optimizer.php',
|
||||
'wp-db-backup/wp-db-backup.php',
|
||||
'wp-dbmanager/wp-dbmanager.php',
|
||||
'wp-engine-snapshot/plugin.php',
|
||||
'wp-file-cache/file-cache.php',
|
||||
'wp-mailinglist/wp-mailinglist.php',
|
||||
'wp-phpmyadmin/wp-phpmyadmin.php',
|
||||
'wp-postviews/wp-postviews.php',
|
||||
'wp-slimstat/wp-slimstat.php',
|
||||
'wp-super-cache/wp-cache.php',
|
||||
'wp-symposium-alerts/wp-symposium-alerts.php',
|
||||
'wponlinebackup/wponlinebackup.php',
|
||||
'yet-another-featured-posts-plugin/yafpp.php',
|
||||
'yet-another-related-posts-plugin/yarpp.php'
|
||||
));
|
||||
|
||||
PrmMng::getInstance()->setValue(PrmMng::PARAM_FORCE_DIABLE_PLUGINS, $fdPlugins);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* interface for specific hostings class
|
||||
*
|
||||
* Standard: PSR-2
|
||||
*
|
||||
* @package SC\DUPX\DB
|
||||
* @link http://www.php-fig.org/psr/psr-2/
|
||||
*/
|
||||
|
||||
defined('ABSPATH') || defined('DUPXABSPATH') || exit;
|
||||
|
||||
/**
|
||||
* instaler custom host interface for cusotm hosting classes
|
||||
*/
|
||||
interface DUPX_Host_interface
|
||||
{
|
||||
/**
|
||||
* return the current host itentifier
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function getIdentifier();
|
||||
|
||||
/**
|
||||
* @return bool true if is current host
|
||||
*/
|
||||
public function isHosting();
|
||||
|
||||
/**
|
||||
* the init function.
|
||||
* is called only if isHosting is true
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function init();
|
||||
|
||||
/**
|
||||
* return the label of current hosting
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getLabel();
|
||||
|
||||
/**
|
||||
* this function is called if current hosting is this
|
||||
*/
|
||||
public function setCustomParams();
|
||||
}
|
||||
Reference in New Issue
Block a user