Commit bfa1325c authored by alain's avatar alain 🐙
Browse files

remove updraft

parent 4ab81fac
This diff is collapsed.
This diff is collapsed.
<?php
if (!defined('ABSPATH')) die('No direct access.');
class Automatic_Upgrader_Skin extends Automatic_Upgrader_Skin_Main {
public function feedback($string, ...$args) { // phpcs:ignore PHPCompatibility.LanguageConstructs.NewLanguageConstructs.t_ellipsisFound, VariableAnalysis.CodeAnalysis.VariableAnalysis.UnusedVariable -- spread operator is not supported in PHP < 5.5 but WP 5.3 supports PHP 5.6 minimum
parent::updraft_feedback($string);
}
}
<?php
// @codingStandardsIgnoreFile
if (!defined('ABSPATH')) die('No direct access.');
// Extracted from 4.5.2/wordpress/wp-admin/includes/class-wp-upgrader-skins.php; with the bulk_*() methods added since they are not in the base class on all WP versions.
// Needed only on WP < 3.7
/**
* Upgrader Skin for Automatic WordPress Upgrades
*
* Extracted from 4.5.2/wordpress/wp-admin/includes/class-wp-upgrader-skins.php; with the bulk_*() methods added since they are not in the base class on all WP versions.
* Needed only on WP < 3.7
*
* This skin is designed to be used when no output is intended, all output
* is captured and stored for the caller to process and log/email/discard.
*
* @package WordPress
* @subpackage Upgrader
* @since 3.7.0
*/
class Automatic_Upgrader_Skin_Main extends WP_Upgrader_Skin {
protected $messages = array();
/**
* Request filesystem credentials
*
* @param bool $error Check if there is an error: default is false
* @param string $context Context for credentails
* @param bool $allow_relaxed_file_ownership Check if relaxed file ownership is allowed
* @return bool
*/
public function request_filesystem_credentials($error = false, $context = '', $allow_relaxed_file_ownership = false) {
if ($context) {
$this->options['context'] = $context;
}
// TODO: fix up request_filesystem_credentials(), or split it, to allow us to request a no-output version
// This will output a credentials form in event of failure, We don't want that, so just hide with a buffer
ob_start();
$result = parent::request_filesystem_credentials($error, $context, $allow_relaxed_file_ownership);
ob_end_clean();
return $result;
}
/**
* Get update message
*
* @return array reti=urns an array of messages
*/
public function get_upgrade_messages() {
return $this->messages;
}
/**
* Feedback
*
* @param string|array|WP_Error $data THis is the data to be used for the feedback
*/
protected function updraft_feedback($data) {
if (is_wp_error($data)) {
$string = $data->get_error_message();
} elseif (is_array($data)) {
return;
} else {
$string = $data;
}
if (!empty($this->upgrader->strings[$string]))
$string = $this->upgrader->strings[$string];
if (false !== strpos($string, '%')) {
$args = func_get_args();
$args = array_splice($args, 1);
if (!empty($args))
$string = vsprintf($string, $args);
}
$string = trim($string);
// Only allow basic HTML in the messages, as it'll be used in emails/logs rather than direct browser output.
$string = wp_kses($string, array(
'a' => array(
'href' => true
),
'br' => true,
'em' => true,
'strong' => true,
));
if (empty($string))
return;
$this->messages[] = $string;
}
public function header() {
ob_start();
}
public function footer() {
$output = ob_get_clean();
if (!empty($output))
$this->feedback($output);
}
/**
* @access public
*/
public function bulk_header() {}
public function bulk_footer() {
}
}
global $updraftplus;
$wp_version = $updraftplus->get_wordpress_version();
if (version_compare($wp_version, '5.3', '>=')) {
if (!class_exists('Automatic_Upgrader_Skin')) require_once(UPDRAFTPLUS_DIR.'/central/classes/automatic-upgrader-skin-compatibility.php');
} else {
class Automatic_Upgrader_Skin extends Automatic_Upgrader_Skin_Main {
public function feedback($string) {
parent::updraft_feedback($string);
}
}
}
\ No newline at end of file
<?php
/**
* Returns an instance of the host plugin class where the UpdraftCentral "central" folder is being
* integrated.
*/
class UpdraftCentral_Factory {
/**
* Creates a host plugin instance for the given plugin name if found. Otherwise, it will return null
*
* @param string $plugin The name of the host plugin that the "central" folder is currently embedded
* @return object|null
*/
public static function create_host($plugin) {
// N.B. You can add additional host plugins here. Just make sure that you will create
// a host class for that particular plugin (see updraftplus/central/updraftplus.php as an example).
$mapped_classes = array(
'updraftplus' => 'UpdraftPlus_Host',
// 'wp-optimize' => 'WPOptimize_Host'
);
if (!isset($mapped_classes[$plugin])) return null;
$host_class = $mapped_classes[$plugin];
if (!class_exists($host_class)) {
$central_folder = defined('UPDRAFTCENTRAL_CLIENT_DIR') ? UPDRAFTCENTRAL_CLIENT_DIR : dirname(__FILE__);
if (file_exists($central_folder.'/'.$plugin.'.php')) {
include_once($central_folder.'/'.$plugin.'.php');
} else {
return null;
}
}
return $host_class::instance();// phpcs:ignore PHPCompatibility.Syntax.NewDynamicAccessToStatic.Found
}
}
global $updraftcentral_host_plugin;
$updraftcentral_host_plugin = UpdraftCentral_Factory::create_host(defined('UPDRAFTCENTRAL_HOST_PLUGIN') ? UPDRAFTCENTRAL_HOST_PLUGIN : 'updraftplus');
<?php
/**
* This interface is the basic blueprint of the host (plugin) methods needed by UpdraftCentral
* for it to work and function properly.
*/
interface UpdraftCentral_Host_Interface {
public function get_current_clean_url();
public function get_plugin_name();
public function is_host_dir_set();
public function get_host_dir();
public function is_time_limit_set();
public function get_time_limit();
public function get_logline_filter();
public function get_auth_headers_filter();
public function get_login_key_filter();
public function get_central_localkeys();
public function update_central_localkeys($value, $use_cache = true, $autoload = 'yes');
public function get_debug_mode();
public function get_udrpc($indicator_name);
public function register_wp_http_option_hooks($register = true);
public function get_wordpress_version();
public function get_class_name();
public function get_instance();
public function get_admin_instance();
public function get_option_class();
public function has_options();
public function update_option($option, $value, $use_cache = true, $autoload = 'yes');
public function get_option($option, $default = null);
public function get_version();
public function admin_page_url();
public function get_filesystem_functions();
public function has_filesystem_functions();
public function get_udcom_destination();
public function get_googlecloud_callback_url();
public function get_googlecloud_client_id();
public function is_force_debug();
public function has_autobackup_addon();
public function get_disk_space_used($entity, $format = 'text');
public function get_autobackup_default($default = true);
public function debugtools_dashboard();
}
<?php
if (!defined('UPDRAFTCENTRAL_CLIENT_DIR')) die('No access.');
// Load the posts command class since we're going to be extending it for our page module service/command
// class in order to minimize redundant shareable methods.
if (!class_exists('UpdraftCentral_Posts_Commands')) require_once('posts.php');
/**
* Handles Pages Commands
*/
class UpdraftCentral_Pages_Commands extends UpdraftCentral_Posts_Commands {
protected $post_type = 'page';
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment