Edit File by line
/home/barbar84/www/wp-conte.../plugins/worker/src/MMB
File: Installer.php
<?php
[0] Fix | Delete
[1] Fix | Delete
/*************************************************************
[2] Fix | Delete
* installer.class.php
[3] Fix | Delete
* Upgrade WordPress
[4] Fix | Delete
* Copyright (c) 2011 Prelovac Media
[5] Fix | Delete
* www.prelovac.com
[6] Fix | Delete
**************************************************************/
[7] Fix | Delete
class MMB_Installer extends MMB_Core
[8] Fix | Delete
{
[9] Fix | Delete
public function __construct()
[10] Fix | Delete
{
[11] Fix | Delete
@set_time_limit(600);
[12] Fix | Delete
parent::__construct();
[13] Fix | Delete
@include_once ABSPATH.'wp-admin/includes/file.php';
[14] Fix | Delete
@include_once ABSPATH.'wp-admin/includes/plugin.php';
[15] Fix | Delete
@include_once ABSPATH.'wp-admin/includes/theme.php';
[16] Fix | Delete
@include_once ABSPATH.'wp-admin/includes/misc.php';
[17] Fix | Delete
@include_once ABSPATH.'wp-admin/includes/template.php';
[18] Fix | Delete
@include_once ABSPATH.'wp-admin/includes/class-wp-upgrader.php';
[19] Fix | Delete
[20] Fix | Delete
global $wp_filesystem;
[21] Fix | Delete
[22] Fix | Delete
if (!$this->check_if_pantheon() && !$wp_filesystem) {
[23] Fix | Delete
WP_Filesystem();
[24] Fix | Delete
}
[25] Fix | Delete
}
[26] Fix | Delete
[27] Fix | Delete
public function mmb_maintenance_mode($enable = false, $maintenance_message = '')
[28] Fix | Delete
{
[29] Fix | Delete
global $wp_filesystem;
[30] Fix | Delete
[31] Fix | Delete
$maintenance_message .= '<?php $upgrading = '.time().'; ?>';
[32] Fix | Delete
[33] Fix | Delete
$file = $wp_filesystem->abspath().'.maintenance';
[34] Fix | Delete
if ($enable) {
[35] Fix | Delete
$wp_filesystem->delete($file);
[36] Fix | Delete
$wp_filesystem->put_contents($file, $maintenance_message, FS_CHMOD_FILE);
[37] Fix | Delete
} else {
[38] Fix | Delete
$wp_filesystem->delete($file);
[39] Fix | Delete
}
[40] Fix | Delete
}
[41] Fix | Delete
[42] Fix | Delete
public function install_remote_file($params)
[43] Fix | Delete
{
[44] Fix | Delete
global $wp_filesystem;
[45] Fix | Delete
extract($params);
[46] Fix | Delete
$network_activate = isset($params['network_activate']) ? $params['network_activate'] : false;
[47] Fix | Delete
[48] Fix | Delete
if (!isset($package) || empty($package)) {
[49] Fix | Delete
return array(
[50] Fix | Delete
'error' => '<p>No files received. Internal error.</p>',
[51] Fix | Delete
);
[52] Fix | Delete
}
[53] Fix | Delete
[54] Fix | Delete
if (!$this->is_server_writable()) {
[55] Fix | Delete
return array(
[56] Fix | Delete
'error' => 'Failed, please <a target="_blank" href="http://managewp.com/user-guide/faq/my-pluginsthemes-fail-to-update-or-i-receive-a-yellow-ftp-warning">add FTP details</a>',
[57] Fix | Delete
);
[58] Fix | Delete
}
[59] Fix | Delete
[60] Fix | Delete
if (defined('WP_INSTALLING') && file_exists(ABSPATH.'.maintenance')) {
[61] Fix | Delete
return array(
[62] Fix | Delete
'error' => '<p>Site under maintanace.</p>',
[63] Fix | Delete
);
[64] Fix | Delete
}
[65] Fix | Delete
[66] Fix | Delete
if (!class_exists('WP_Upgrader')) {
[67] Fix | Delete
include_once ABSPATH.'wp-admin/includes/class-wp-upgrader.php';
[68] Fix | Delete
}
[69] Fix | Delete
[70] Fix | Delete
/** @handled class */
[71] Fix | Delete
$upgrader = new WP_Upgrader(mwp_container()->getUpdaterSkin());
[72] Fix | Delete
$upgrader->init();
[73] Fix | Delete
$destination = $type == 'themes' ? WP_CONTENT_DIR.'/themes' : WP_PLUGIN_DIR;
[74] Fix | Delete
$clear_destination = isset($clear_destination) ? $clear_destination : false;
[75] Fix | Delete
[76] Fix | Delete
foreach ($package as $package_url) {
[77] Fix | Delete
$key = basename($package_url);
[78] Fix | Delete
$install_info[$key] = @$upgrader->run(
[79] Fix | Delete
array(
[80] Fix | Delete
'package' => $package_url,
[81] Fix | Delete
'destination' => $destination,
[82] Fix | Delete
'clear_destination' => $clear_destination, //Do not overwrite files.
[83] Fix | Delete
'clear_working' => true,
[84] Fix | Delete
'hook_extra' => array(),
[85] Fix | Delete
)
[86] Fix | Delete
);
[87] Fix | Delete
}
[88] Fix | Delete
[89] Fix | Delete
if (defined('WP_ADMIN') && WP_ADMIN) {
[90] Fix | Delete
global $wp_current_filter;
[91] Fix | Delete
$wp_current_filter[] = 'load-update-core.php';
[92] Fix | Delete
[93] Fix | Delete
if (function_exists('wp_clean_update_cache')) {
[94] Fix | Delete
/** @handled function */
[95] Fix | Delete
wp_clean_update_cache();
[96] Fix | Delete
}
[97] Fix | Delete
[98] Fix | Delete
/** @handled function */
[99] Fix | Delete
wp_update_plugins();
[100] Fix | Delete
[101] Fix | Delete
array_pop($wp_current_filter);
[102] Fix | Delete
[103] Fix | Delete
/** @handled function */
[104] Fix | Delete
set_current_screen();
[105] Fix | Delete
do_action('load-update-core.php');
[106] Fix | Delete
[107] Fix | Delete
/** @handled function */
[108] Fix | Delete
wp_version_check();
[109] Fix | Delete
[110] Fix | Delete
/** @handled function */
[111] Fix | Delete
wp_version_check(array(), true);
[112] Fix | Delete
}
[113] Fix | Delete
[114] Fix | Delete
$wrongFileType = false;
[115] Fix | Delete
if ($type == 'plugins') {
[116] Fix | Delete
$wrongFileType = true;
[117] Fix | Delete
include_once ABSPATH.'wp-admin/includes/plugin.php';
[118] Fix | Delete
$all_plugins = get_plugins();
[119] Fix | Delete
foreach ($all_plugins as $plugin_slug => $plugin) {
[120] Fix | Delete
$plugin_dir = preg_split('/\//', $plugin_slug);
[121] Fix | Delete
foreach ($install_info as $key => $install) {
[122] Fix | Delete
if (!$install || is_wp_error($install)) {
[123] Fix | Delete
continue;
[124] Fix | Delete
}
[125] Fix | Delete
if ($install['destination_name'] == $plugin_dir[0]) {
[126] Fix | Delete
$wrongFileType = false;
[127] Fix | Delete
if ($activate) {
[128] Fix | Delete
$install_info[$key]['activated'] = activate_plugin($plugin_slug, '', $network_activate);
[129] Fix | Delete
}
[130] Fix | Delete
[131] Fix | Delete
$install_info[$key]['basename'] = $plugin_slug;
[132] Fix | Delete
$install_info[$key]['full_name'] = $plugin['Name'];
[133] Fix | Delete
$install_info[$key]['version'] = $plugin['Version'];
[134] Fix | Delete
}
[135] Fix | Delete
}
[136] Fix | Delete
}
[137] Fix | Delete
}
[138] Fix | Delete
[139] Fix | Delete
if ($type == 'themes') {
[140] Fix | Delete
$wrongFileType = true;
[141] Fix | Delete
if (count($install_info) == 1) {
[142] Fix | Delete
global $wp_themes;
[143] Fix | Delete
include_once ABSPATH.'wp-includes/theme.php';
[144] Fix | Delete
[145] Fix | Delete
$wp_themes = null;
[146] Fix | Delete
unset($wp_themes); //prevent theme data caching
[147] Fix | Delete
if (function_exists('wp_get_theme')) {
[148] Fix | Delete
foreach ($install_info as $key => $install) {
[149] Fix | Delete
if (!$install || is_wp_error($install)) {
[150] Fix | Delete
continue;
[151] Fix | Delete
}
[152] Fix | Delete
[153] Fix | Delete
$theme = wp_get_theme($install['destination_name']);
[154] Fix | Delete
if ($theme->errors() !== false) {
[155] Fix | Delete
$install_info[$key] = $theme->errors();
[156] Fix | Delete
continue;
[157] Fix | Delete
}
[158] Fix | Delete
[159] Fix | Delete
$wrongFileType = false;
[160] Fix | Delete
if ($activate) {
[161] Fix | Delete
$install_info[$key]['activated'] = switch_theme($theme->Template, $theme->Stylesheet);
[162] Fix | Delete
}
[163] Fix | Delete
[164] Fix | Delete
$install_info[$key]['full_name'] = $theme->name;
[165] Fix | Delete
$install_info[$key]['version'] = $theme->version;
[166] Fix | Delete
}
[167] Fix | Delete
} else {
[168] Fix | Delete
$all_themes = get_themes();
[169] Fix | Delete
foreach ($all_themes as $theme_name => $theme_data) {
[170] Fix | Delete
foreach ($install_info as $key => $install) {
[171] Fix | Delete
if (!$install || is_wp_error($install)) {
[172] Fix | Delete
continue;
[173] Fix | Delete
}
[174] Fix | Delete
[175] Fix | Delete
if ($theme_data['Template'] == $install['destination_name'] || $theme_data['Stylesheet'] == $install['destination_name']) {
[176] Fix | Delete
$wrongFileType = false;
[177] Fix | Delete
if ($activate) {
[178] Fix | Delete
$install_info[$key]['activated'] = switch_theme($theme_data['Template'], $theme_data['Stylesheet']);
[179] Fix | Delete
}
[180] Fix | Delete
$install_info[$key]['full_name'] = $theme_data->name;
[181] Fix | Delete
$install_info[$key]['version'] = $theme_data->version;
[182] Fix | Delete
}
[183] Fix | Delete
}
[184] Fix | Delete
}
[185] Fix | Delete
}
[186] Fix | Delete
}
[187] Fix | Delete
}
[188] Fix | Delete
[189] Fix | Delete
// Can generate "E_NOTICE: ob_clean(): failed to delete buffer. No buffer to delete."
[190] Fix | Delete
@ob_clean();
[191] Fix | Delete
$this->mmb_maintenance_mode(false);
[192] Fix | Delete
[193] Fix | Delete
if (mwp_container()->getRequestStack()->getMasterRequest()->getProtocol() >= 1) {
[194] Fix | Delete
// WP_Error won't get JSON encoded, so unwrap the error here.
[195] Fix | Delete
foreach ($install_info as $key => $value) {
[196] Fix | Delete
if ($value instanceof WP_Error) {
[197] Fix | Delete
$install_info[$key] = array(
[198] Fix | Delete
'error' => $value->get_error_message(),
[199] Fix | Delete
'code' => $value->get_error_code(),
[200] Fix | Delete
);
[201] Fix | Delete
} elseif ($wrongFileType) {
[202] Fix | Delete
$otherType = $type === 'themes' ? 'plugins' : $type;
[203] Fix | Delete
$install_info[$key] = array(
[204] Fix | Delete
'error' => 'You can\'t install '.$type.' on '.$otherType.' page.',
[205] Fix | Delete
'code' => 'wrong_type_of_file',
[206] Fix | Delete
);
[207] Fix | Delete
}
[208] Fix | Delete
}
[209] Fix | Delete
}
[210] Fix | Delete
[211] Fix | Delete
return $install_info;
[212] Fix | Delete
}
[213] Fix | Delete
[214] Fix | Delete
private function ithemes_updater_compatiblity()
[215] Fix | Delete
{
[216] Fix | Delete
// Check for the iThemes updater class
[217] Fix | Delete
if (empty($GLOBALS['ithemes_updater_path']) ||
[218] Fix | Delete
!file_exists($GLOBALS['ithemes_updater_path'].'/settings.php')
[219] Fix | Delete
) {
[220] Fix | Delete
return;
[221] Fix | Delete
}
[222] Fix | Delete
[223] Fix | Delete
// Include iThemes updater
[224] Fix | Delete
require_once $GLOBALS['ithemes_updater_path'].'/settings.php';
[225] Fix | Delete
[226] Fix | Delete
// Check if the updater is instantiated
[227] Fix | Delete
if (empty($GLOBALS['ithemes-updater-settings'])) {
[228] Fix | Delete
return;
[229] Fix | Delete
}
[230] Fix | Delete
[231] Fix | Delete
// Update the download link
[232] Fix | Delete
$GLOBALS['ithemes-updater-settings']->flush('forced');
[233] Fix | Delete
}
[234] Fix | Delete
[235] Fix | Delete
public function do_upgrade($params = null)
[236] Fix | Delete
{
[237] Fix | Delete
if ($params == null || empty($params)) {
[238] Fix | Delete
return array(
[239] Fix | Delete
'error' => 'No upgrades passed.',
[240] Fix | Delete
);
[241] Fix | Delete
}
[242] Fix | Delete
[243] Fix | Delete
if (!$this->is_server_writable()) {
[244] Fix | Delete
return array(
[245] Fix | Delete
'error' => 'Failed, please <a target="_blank" href="http://managewp.com/user-guide/faq/my-pluginsthemes-fail-to-update-or-i-receive-a-yellow-ftp-warning">add FTP details</a>',
[246] Fix | Delete
);
[247] Fix | Delete
}
[248] Fix | Delete
[249] Fix | Delete
$params = isset($params['upgrades_all']) ? $params['upgrades_all'] : $params;
[250] Fix | Delete
[251] Fix | Delete
$core_upgrade = isset($params['wp_upgrade']) ? $params['wp_upgrade'] : array();
[252] Fix | Delete
$upgrade_plugins = isset($params['upgrade_plugins']) ? $params['upgrade_plugins'] : array();
[253] Fix | Delete
$upgrade_themes = isset($params['upgrade_themes']) ? $params['upgrade_themes'] : array();
[254] Fix | Delete
$upgrade_translations = isset($params['upgrade_translations']) ? $params['upgrade_translations'] : false;
[255] Fix | Delete
[256] Fix | Delete
$upgrades = array();
[257] Fix | Delete
$premium_upgrades = array();
[258] Fix | Delete
if (!empty($core_upgrade)) {
[259] Fix | Delete
$upgrades['core'] = $this->upgrade_core($core_upgrade);
[260] Fix | Delete
}
[261] Fix | Delete
[262] Fix | Delete
if (!empty($upgrade_plugins)) {
[263] Fix | Delete
$plugin_files = array();
[264] Fix | Delete
$this->ithemes_updater_compatiblity();
[265] Fix | Delete
foreach ($upgrade_plugins as $plugin) {
[266] Fix | Delete
if (isset($plugin['envatoPlugin']) && $plugin['envatoPlugin'] === true) {
[267] Fix | Delete
$upgrades['plugins'] = $this->upgrade_envato_component($plugin);
[268] Fix | Delete
continue;
[269] Fix | Delete
}
[270] Fix | Delete
[271] Fix | Delete
if (isset($plugin['file'])) {
[272] Fix | Delete
$plugin_files[$plugin['file']] = $plugin['old_version'];
[273] Fix | Delete
} else {
[274] Fix | Delete
$premium_upgrades[md5($plugin['name'])] = $plugin;
[275] Fix | Delete
}
[276] Fix | Delete
}
[277] Fix | Delete
if (!empty($plugin_files)) {
[278] Fix | Delete
$upgrades['plugins'] = $this->upgrade_plugins($plugin_files);
[279] Fix | Delete
}
[280] Fix | Delete
$this->ithemes_updater_compatiblity();
[281] Fix | Delete
}
[282] Fix | Delete
[283] Fix | Delete
if (!empty($upgrade_themes)) {
[284] Fix | Delete
$theme_temps = array();
[285] Fix | Delete
foreach ($upgrade_themes as $theme) {
[286] Fix | Delete
if (isset($theme['envatoTheme']) && $theme['envatoTheme'] === true) {
[287] Fix | Delete
$upgrades['themes'] = $this->upgrade_envato_component($theme);
[288] Fix | Delete
continue;
[289] Fix | Delete
}
[290] Fix | Delete
[291] Fix | Delete
if (isset($theme['theme_tmp'])) {
[292] Fix | Delete
$theme_temps[] = $theme['theme_tmp'];
[293] Fix | Delete
} else {
[294] Fix | Delete
$premium_upgrades[md5($theme['name'])] = $theme;
[295] Fix | Delete
}
[296] Fix | Delete
}
[297] Fix | Delete
[298] Fix | Delete
if (!empty($theme_temps)) {
[299] Fix | Delete
$upgrades['themes'] = $this->upgrade_themes($theme_temps);
[300] Fix | Delete
}
[301] Fix | Delete
}
[302] Fix | Delete
[303] Fix | Delete
if (!empty($upgrade_translations)) {
[304] Fix | Delete
$upgrades['translations'] = $this->upgrade_translations();
[305] Fix | Delete
}
[306] Fix | Delete
[307] Fix | Delete
@ob_clean();
[308] Fix | Delete
$this->mmb_maintenance_mode(false);
[309] Fix | Delete
[310] Fix | Delete
return $upgrades;
[311] Fix | Delete
}
[312] Fix | Delete
[313] Fix | Delete
/**
[314] Fix | Delete
* @param array $component
[315] Fix | Delete
*
[316] Fix | Delete
* @return array
[317] Fix | Delete
*/
[318] Fix | Delete
private function upgrade_envato_component(array $component)
[319] Fix | Delete
{
[320] Fix | Delete
$result = $this->install_remote_file($component);
[321] Fix | Delete
$return = array();
[322] Fix | Delete
[323] Fix | Delete
if (empty($result)) {
[324] Fix | Delete
return array(
[325] Fix | Delete
'error' => 'Upgrade failed.',
[326] Fix | Delete
);
[327] Fix | Delete
}
[328] Fix | Delete
[329] Fix | Delete
foreach ($result as $component_slug => $component_info) {
[330] Fix | Delete
if (!$component_info || is_wp_error($component_info)) {
[331] Fix | Delete
$return[$component_slug] = $this->mmb_get_error($component_info);
[332] Fix | Delete
continue;
[333] Fix | Delete
}
[334] Fix | Delete
[335] Fix | Delete
$return[$component_info['destination_name']] = 1;
[336] Fix | Delete
}
[337] Fix | Delete
[338] Fix | Delete
return array(
[339] Fix | Delete
'upgraded' => $return,
[340] Fix | Delete
);
[341] Fix | Delete
}
[342] Fix | Delete
[343] Fix | Delete
/**
[344] Fix | Delete
* Upgrades WordPress locally
[345] Fix | Delete
*/
[346] Fix | Delete
public function upgrade_core($current)
[347] Fix | Delete
{
[348] Fix | Delete
ob_start();
[349] Fix | Delete
[350] Fix | Delete
if (file_exists(ABSPATH.'/wp-admin/includes/update.php')) {
[351] Fix | Delete
include_once ABSPATH.'/wp-admin/includes/update.php';
[352] Fix | Delete
}
[353] Fix | Delete
[354] Fix | Delete
$current_update = false;
[355] Fix | Delete
ob_end_flush();
[356] Fix | Delete
ob_end_clean();
[357] Fix | Delete
$core = $this->mmb_get_transient('update_core');
[358] Fix | Delete
[359] Fix | Delete
if (isset($core->updates) && !empty($core->updates)) {
[360] Fix | Delete
$updates = $core->updates[0];
[361] Fix | Delete
$updated = $core->updates[0];
[362] Fix | Delete
if (!isset($updated->response) || $updated->response == 'latest') {
[363] Fix | Delete
return array(
[364] Fix | Delete
'upgraded' => ' updated',
[365] Fix | Delete
);
[366] Fix | Delete
}
[367] Fix | Delete
[368] Fix | Delete
if ($updated->response == "development" && $current['response'] == "upgrade") {
[369] Fix | Delete
return array(
[370] Fix | Delete
'error' => '<font color="#900">Unexpected error. Please upgrade manually.</font>',
[371] Fix | Delete
);
[372] Fix | Delete
} else {
[373] Fix | Delete
if ($updated->response == $current['response'] || ($updated->response == "upgrade" && $current['response'] == "development")) {
[374] Fix | Delete
if ($updated->locale != $current['locale']) {
[375] Fix | Delete
foreach ($updates as $update) {
[376] Fix | Delete
if ($update->locale == $current['locale']) {
[377] Fix | Delete
$current_update = $update;
[378] Fix | Delete
break;
[379] Fix | Delete
}
[380] Fix | Delete
}
[381] Fix | Delete
if ($current_update == false) {
[382] Fix | Delete
return array(
[383] Fix | Delete
'error' => ' Localization mismatch. Try again.',
[384] Fix | Delete
);
[385] Fix | Delete
}
[386] Fix | Delete
} else {
[387] Fix | Delete
$current_update = $updated;
[388] Fix | Delete
}
[389] Fix | Delete
} else {
[390] Fix | Delete
return array(
[391] Fix | Delete
'error' => ' Transient mismatch. Try again.',
[392] Fix | Delete
);
[393] Fix | Delete
}
[394] Fix | Delete
}
[395] Fix | Delete
} else {
[396] Fix | Delete
return array(
[397] Fix | Delete
'error' => ' Refresh transient failed. Try again.',
[398] Fix | Delete
);
[399] Fix | Delete
}
[400] Fix | Delete
if ($current_update != false) {
[401] Fix | Delete
global $wp_filesystem, $wp_version;
[402] Fix | Delete
[403] Fix | Delete
if (version_compare($wp_version, '3.1.9', '>')) {
[404] Fix | Delete
if (!class_exists('Core_Upgrader')) {
[405] Fix | Delete
include_once ABSPATH.'wp-admin/includes/class-wp-upgrader.php';
[406] Fix | Delete
}
[407] Fix | Delete
[408] Fix | Delete
/** @handled class */
[409] Fix | Delete
$core = new Core_Upgrader(mwp_container()->getUpdaterSkin());
[410] Fix | Delete
$result = $core->upgrade($current_update);
[411] Fix | Delete
$this->mmb_maintenance_mode(false);
[412] Fix | Delete
if (is_wp_error($result)) {
[413] Fix | Delete
return array(
[414] Fix | Delete
'error' => $this->mmb_get_error($result),
[415] Fix | Delete
);
[416] Fix | Delete
} else {
[417] Fix | Delete
return array(
[418] Fix | Delete
'upgraded' => ' updated',
[419] Fix | Delete
);
[420] Fix | Delete
}
[421] Fix | Delete
} else {
[422] Fix | Delete
if (!class_exists('WP_Upgrader')) {
[423] Fix | Delete
include_once ABSPATH.'wp-admin/includes/update.php';
[424] Fix | Delete
if (function_exists('wp_update_core')) {
[425] Fix | Delete
$result = wp_update_core($current_update);
[426] Fix | Delete
if (is_wp_error($result)) {
[427] Fix | Delete
return array(
[428] Fix | Delete
'error' => $this->mmb_get_error($result),
[429] Fix | Delete
);
[430] Fix | Delete
} else {
[431] Fix | Delete
return array(
[432] Fix | Delete
'upgraded' => ' updated',
[433] Fix | Delete
);
[434] Fix | Delete
}
[435] Fix | Delete
}
[436] Fix | Delete
}
[437] Fix | Delete
[438] Fix | Delete
if (class_exists('WP_Upgrader')) {
[439] Fix | Delete
/** @handled class */
[440] Fix | Delete
$upgrader_skin = new WP_Upgrader_Skin();
[441] Fix | Delete
$upgrader_skin->done_header = true;
[442] Fix | Delete
[443] Fix | Delete
/** @handled class */
[444] Fix | Delete
$upgrader = new WP_Upgrader($upgrader_skin);
[445] Fix | Delete
[446] Fix | Delete
// Is an update available?
[447] Fix | Delete
if (!isset($current_update->response) || $current_update->response == 'latest') {
[448] Fix | Delete
return array(
[449] Fix | Delete
'upgraded' => ' updated',
[450] Fix | Delete
);
[451] Fix | Delete
}
[452] Fix | Delete
[453] Fix | Delete
$res = $upgrader->fs_connect(
[454] Fix | Delete
array(
[455] Fix | Delete
ABSPATH,
[456] Fix | Delete
WP_CONTENT_DIR,
[457] Fix | Delete
)
[458] Fix | Delete
);
[459] Fix | Delete
if (is_wp_error($res)) {
[460] Fix | Delete
return array(
[461] Fix | Delete
'error' => $this->mmb_get_error($res),
[462] Fix | Delete
);
[463] Fix | Delete
}
[464] Fix | Delete
[465] Fix | Delete
$wp_dir = trailingslashit($wp_filesystem->abspath());
[466] Fix | Delete
[467] Fix | Delete
$core_package = false;
[468] Fix | Delete
if (isset($current_update->package) && !empty($current_update->package)) {
[469] Fix | Delete
$core_package = $current_update->package;
[470] Fix | Delete
} elseif (isset($current_update->packages->full) && !empty($current_update->packages->full)) {
[471] Fix | Delete
$core_package = $current_update->packages->full;
[472] Fix | Delete
}
[473] Fix | Delete
[474] Fix | Delete
$download = $upgrader->download_package($core_package);
[475] Fix | Delete
if (is_wp_error($download)) {
[476] Fix | Delete
return array(
[477] Fix | Delete
'error' => $this->mmb_get_error($download),
[478] Fix | Delete
);
[479] Fix | Delete
}
[480] Fix | Delete
[481] Fix | Delete
$working_dir = $upgrader->unpack_package($download);
[482] Fix | Delete
if (is_wp_error($working_dir)) {
[483] Fix | Delete
return array(
[484] Fix | Delete
'error' => $this->mmb_get_error($working_dir),
[485] Fix | Delete
);
[486] Fix | Delete
}
[487] Fix | Delete
[488] Fix | Delete
if (!$wp_filesystem->copy($working_dir.'/wordpress/wp-admin/includes/update-core.php', $wp_dir.'wp-admin/includes/update-core.php', true)) {
[489] Fix | Delete
$wp_filesystem->delete($working_dir, true);
[490] Fix | Delete
[491] Fix | Delete
return array(
[492] Fix | Delete
'error' => 'Unable to move update files.',
[493] Fix | Delete
);
[494] Fix | Delete
}
[495] Fix | Delete
[496] Fix | Delete
$wp_filesystem->chmod($wp_dir.'wp-admin/includes/update-core.php', FS_CHMOD_FILE);
[497] Fix | Delete
[498] Fix | Delete
require ABSPATH.'wp-admin/includes/update-core.php';
[499] Fix | Delete
12
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function