Changeset 1821951
- Timestamp:
- 02/14/2018 11:47:25 AM (8 years ago)
- Location:
- worker/trunk
- Files:
-
- 11 edited
-
functions.php (modified) (10 diffs)
-
init.php (modified) (4 diffs)
-
readme.txt (modified) (2 diffs)
-
src/MMB/Core.php (modified) (2 diffs)
-
src/MWP/Action/ConnectWebsite.php (modified) (1 diff)
-
src/MWP/Configuration/Conf.php (modified) (2 diffs)
-
src/MWP/EventListener/MasterRequest/VerifyConnectionInfo.php (modified) (1 diff)
-
src/MWP/EventListener/PublicRequest/AddConnectionKeyInfo.php (modified) (5 diffs)
-
src/MWP/WordPress/Context.php (modified) (1 diff)
-
src/MWP/Worker/Kernel.php (modified) (1 diff)
-
version (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
worker/trunk/functions.php
r1792691 r1821951 1267 1267 { 1268 1268 global $pagenow, $current_user, $mmode; 1269 if (!is_admin() && ! in_array($pagenow, array('wp-login.php'))) {1269 if (!is_admin() && !(defined('WP_CLI') && WP_CLI) && !in_array($pagenow, array('wp-login.php'))) { 1270 1270 $mmode = get_option('mwp_maintenace_mode'); 1271 1271 if (!empty($mmode)) { … … 1426 1426 function mwp_get_service_key() 1427 1427 { 1428 $serviceKey = get_option('mwp_service_key');1428 $serviceKey = mwp_context()->optionGet('mwp_service_key'); 1429 1429 if (empty($serviceKey)) { 1430 1430 $serviceKey = mwp_generate_uuid4(); 1431 update_option('mwp_service_key', $serviceKey, true);1431 mwp_context()->optionSet('mwp_service_key', $serviceKey, true); 1432 1432 } 1433 1433 … … 1437 1437 function mwp_get_communication_key() 1438 1438 { 1439 return get_option('mwp_communication_key');1440 } 1441 1442 function mwp_accept_potential_key( )1443 { 1444 $potentialKey = mwp_get_potential_key();1445 1446 update_option('mwp_communication_key', $potentialKey, true);1447 delete_option('mwp_potential_key');1448 delete_option('mwp_potential_key_time');1439 return mwp_context()->optionGet('mwp_communication_key'); 1440 } 1441 1442 function mwp_accept_potential_key($keyToAccept = '') 1443 { 1444 $potentialKey = !empty($keyToAccept) ? $keyToAccept : mwp_get_potential_key(); 1445 1446 mwp_context()->optionSet('mwp_communication_key', $potentialKey, true); 1447 mwp_context()->optionDelete('mwp_potential_key', true); 1448 mwp_context()->optionDelete('mwp_potential_key_time', true); 1449 1449 1450 1450 return $potentialKey; … … 1453 1453 function mwp_get_potential_key() 1454 1454 { 1455 $potentialKey = get_option('mwp_potential_key');1456 $potentialKeyTime = get_option('mwp_potential_key_time');1455 $potentialKey = mwp_context()->optionGet('mwp_potential_key'); 1456 $potentialKeyTime = mwp_context()->optionGet('mwp_potential_key_time'); 1457 1457 $now = time(); 1458 1458 … … 1460 1460 $potentialKey = mwp_generate_uuid4(); 1461 1461 $potentialKeyTime = $now; 1462 update_option('mwp_potential_key', $potentialKey, true);1463 update_option('mwp_potential_key_time', $potentialKeyTime, true);1462 mwp_context()->optionSet('mwp_potential_key', $potentialKey, true); 1463 mwp_context()->optionSet('mwp_potential_key_time', $potentialKeyTime, true); 1464 1464 } 1465 1465 … … 1477 1477 $data = null; 1478 1478 if (function_exists('openssl_random_pseudo_bytes')) { 1479 $data = openssl_random_pseudo_bytes(16);1479 $data = @openssl_random_pseudo_bytes(16); 1480 1480 } 1481 1481 … … 1501 1501 } 1502 1502 1503 update_option('mwp_public_keys', $liveKeys, true);1503 mwp_context()->optionSet('mwp_public_keys', $liveKeys, true); 1504 1504 } 1505 1505 1506 1506 function mwp_get_public_keys_from_live() 1507 1507 { 1508 $result = file_get_contents('https://cdn.managewp.com/public-keys', false,stream_context_create(array(1508 $result = @file_get_contents('https://cdn.managewp.com/public-keys', false, @stream_context_create(array( 1509 1509 'ssl' => array( 1510 1510 'verify_peer' => true, … … 1542 1542 } 1543 1543 1544 $socket = stream_socket_client("$transportToUse://cdn.managewp.com:443", $errno, $errstr, 30, STREAM_CLIENT_CONNECT,stream_context_create(array(1544 $socket = @stream_socket_client("$transportToUse://cdn.managewp.com:443", $errno, $errstr, 30, STREAM_CLIENT_CONNECT, @stream_context_create(array( 1545 1545 'ssl' => array( 1546 1546 'verify_peer' => true, … … 1570 1570 1571 1571 1572 if ( fwrite($socket, $requestContent) === false) {1572 if (@fwrite($socket, $requestContent) === false) { 1573 1573 return null; 1574 1574 } 1575 1575 1576 1576 do { 1577 $line = fgets($socket);1577 $line = @fgets($socket); 1578 1578 } while ($line !== false && $line !== "\n" && $line !== "\r\n"); 1579 1579 … … 1582 1582 } 1583 1583 1584 $content = stream_get_contents($socket);1585 1586 fclose($socket);1584 $content = @stream_get_contents($socket); 1585 1586 @fclose($socket); 1587 1587 1588 1588 if ($content === false || !is_string($content)) { -
worker/trunk/init.php
r1797792 r1821951 4 4 Plugin URI: https://managewp.com 5 5 Description: We help you efficiently manage all your WordPress websites. <strong>Updates, backups, 1-click login, migrations, security</strong> and more, on one dashboard. This service comes in two versions: standalone <a href="https://managewp.com">ManageWP</a> service that focuses on website management, and <a href="https://godaddy.com/pro">GoDaddy Pro</a> that includes additional tools for hosting, client management, lead generation, and more. 6 Version: 4. 3.36 Version: 4.4.0 7 7 Author: ManageWP 8 8 Author URI: https://managewp.com 9 9 License: GPL2 10 10 Text Domain: worker 11 Network: true 11 12 */ 12 13 … … 559 560 endif; 560 561 561 if (!function_exists(' hide_worker_update')):562 function hide_worker_update($value)562 if (!function_exists('add_worker_update_info')): 563 function add_worker_update_info() 563 564 { 564 if (isset($value->response['worker/init.php'])) { 565 unset($value->response['worker/init.php']); 566 } 567 return $value; 565 echo ' The plugin is going to update itself automatically in the next few days.'; 568 566 } 569 567 endif; … … 578 576 register_activation_hook(__FILE__, 'mwp_activation_hook'); 579 577 580 $GLOBALS['MMB_WORKER_VERSION'] = '4. 3.3';581 $GLOBALS['MMB_WORKER_REVISION'] = '2018-0 1-0500:00:00';578 $GLOBALS['MMB_WORKER_VERSION'] = '4.4.0'; 579 $GLOBALS['MMB_WORKER_REVISION'] = '2018-02-06 00:00:00'; 582 580 583 581 // Ensure PHP version compatibility. … … 716 714 add_filter('comment_edit_redirect', 'mwb_edit_redirect_override'); 717 715 add_action('mwp_auto_update', 'MwpRecoveryKit::selfUpdate'); 718 if (!get_option('mwp_show_plugin_update')) { 719 add_filter('site_transient_update_plugins', 'hide_worker_update'); 720 } 716 add_action('in_plugin_update_message-'.plugin_basename(__FILE__), 'add_worker_update_info'); 721 717 722 718 // Datasend cron. -
worker/trunk/readme.txt
r1797792 r1821951 1 1 === ManageWP Worker === 2 2 Contributors: managewp,freediver 3 Donate link: https://www.networkforgood.org/donation/MakeDonation.aspx?ORGID2=5207813904 3 Tags: manage multiple sites, backup, security, migrate, performance, analytics, Manage WordPress, Managed WordPress, WordPress management, WordPress manager, WordPress management, site management, control multiple sites, WordPress management dashboard, administration, automate, automatic, comments, clone, dashboard, duplicate, google analytics, login, manage, managewp, multiple, multisite, remote, seo, spam 5 4 Requires at least: 3.1 … … 58 57 == Changelog == 59 58 59 = 4.4.0 = 60 61 - Fix: Communication failing with a website behind CloudFlare, that has warnings turned on, and currently has warnings. 62 63 = 4.3.4 = 64 65 - Improvement: The Worker plugin can now only be activated network wide on multisite installs. 66 - Fix: Edge cases where the connection key was not visible. 67 - Fix: Edge cases with Multisite communication failure. 68 60 69 = 4.3.3 = 61 70 62 - Improvement: Always use charset for database backup63 - Change: The Worker plugin is fully compatible with WordPress 4.971 - Improvement: Always force the correct charset for database backups. 72 - Improvement: The Worker plugin is now fully compatible with WordPress 4.9. 64 73 65 74 = 4.3.2 = 66 75 67 - Fix: The Worker plugin thr ow exception while recovering from failed update76 - Fix: The Worker plugin threw an exception while recovering from failed update. 68 77 69 78 = 4.3.1 = -
worker/trunk/src/MMB/Core.php
r1792348 r1821951 114 114 $configurationService = new MWP_Configuration_Service(); 115 115 $configuration = $configurationService->getConfiguration(); 116 $notice = $configuration->getNotice();116 $notice = is_multisite() ? $configuration->getNetworkNotice() : $configuration->getNotice(); 117 117 118 118 echo $notice; … … 227 227 Author URI: https://managewp.com 228 228 License: GPL2 229 Network: true 229 230 */ 230 231 -
worker/trunk/src/MWP/Action/ConnectWebsite.php
r1792348 r1821951 38 38 39 39 $configuration->setPublicKey($publicKey); 40 mwp_accept_potential_key( );40 mwp_accept_potential_key($request->getCommunicationKey()); 41 41 42 42 $this->setBrand($params); -
worker/trunk/src/MWP/Configuration/Conf.php
r1792348 r1821951 143 143 public function getNetworkNotice() 144 144 { 145 return $this->getNoticeHtml(' Use your network administrator username to add this multisite network to your <a href="https://managewp.com" target="_blank">ManageWP</a> account.');145 return $this->getNoticeHtml('Add this website to <a href="https://managewp.com" target="_blank">ManageWP</a> or <a href="https://godaddy.com/pro" target="_blank">GoDaddy Pro</a> dashboard to enable backups, uptime monitoring, website cleanup and a lot more! Use a <strong>network administrator</strong> account when adding the website.<br>If prompted, provide the <strong>connection key</strong> (found on the plugin page, in the Worker description) to verify that you are the website administrator.'); 146 146 } 147 147 … … 274 274 } 275 275 276 public function getNotice() { 277 return $this->getNoticeHtml('Add this website to <a href="https://managewp.com" target="_blank">ManageWP</a> or <a href="https://godaddy.com/pro" target="_blank">GoDaddy Pro</a> dashboard to enable backups, uptime monitoring, website cleanup and a lot more!<br>If prompted, provide the <strong>connection key</strong> (found on the plugin page, in the Worker description) to verify that you are the website administrator.'); 276 public function getNotice() 277 { 278 return $this->getNoticeHtml($this->getDefaultNoticeText()); 279 } 280 281 private function getDefaultNoticeText() 282 { 283 return 'Add this website to <a href="https://managewp.com" target="_blank">ManageWP</a> or <a href="https://godaddy.com/pro" target="_blank">GoDaddy Pro</a> dashboard to enable backups, uptime monitoring, website cleanup and a lot more!<br>If prompted, provide the <strong>connection key</strong> (found on the plugin page, in the Worker description) to verify that you are the website administrator.'; 278 284 } 279 285 -
worker/trunk/src/MWP/EventListener/MasterRequest/VerifyConnectionInfo.php
r1792348 r1821951 69 69 } 70 70 71 if (strtolower($request->getCommunicationKey()) !== strtolower(mwp_get_potential_key())) { 71 $requestKey = strtolower($request->getCommunicationKey()); 72 73 if (empty($requestKey) || ($requestKey !== strtolower(mwp_get_potential_key()) && $requestKey !== strtolower(mwp_get_communication_key()))) { 72 74 throw new MWP_Worker_Exception(MWP_Worker_Exception::CONNECTION_INVALID_KEY, "Invalid communication key provided. Please make sure to provide the latest communication key from your Worker plugin."); 73 75 } -
worker/trunk/src/MWP/EventListener/PublicRequest/AddConnectionKeyInfo.php
r1792348 r1821951 84 84 public function printConnectionModalDialog() 85 85 { 86 if ($this->context->isMultisite() && !$this->context->isNetworkAdmin()) { 87 return; 88 } 89 86 90 if (!$this->userCanViewConnectionKey()) { 87 91 return; … … 91 95 ?> 92 96 <div id="mwp_connection_key_dialog" style="display: none;"> 97 <?php if (!mwp_get_communication_key()) { ?> 93 98 <p>There are two ways to connect your website to the management dashboard:</p> 94 99 … … 108 113 <li>Enter this website's URL. When prompted, paste the connection key</li> 109 114 </ol> 115 <?php } ?> 110 116 111 117 <div style="text-align: center;font-weight: bold;"><p style="margin-bottom: 4px;margin-top: 20px;">Connection Key</p></div> … … 123 129 public function addConnectionKeyLink($meta, $slug) 124 130 { 131 if ($this->context->isMultisite() && !$this->context->isNetworkAdmin()) { 132 return $meta; 133 } 134 125 135 if ($slug !== $this->slug) { 126 136 return $meta; … … 138 148 private function userCanViewConnectionKey() 139 149 { 140 return $this->context->isGranted('activate_plugins') && 141 $this->context->isGranted('update_plugins') && 142 $this->context->isGranted('install_plugins'); 150 return $this->context->isGranted('activate_plugins'); 143 151 } 144 152 } -
worker/trunk/src/MWP/WordPress/Context.php
r1792348 r1821951 659 659 } 660 660 661 public function isMainSite() 662 { 663 return is_main_site(); 664 } 665 666 public function isNetworkAdmin() 667 { 668 return is_network_admin(); 669 } 670 661 671 public function getSiteId() 662 672 { -
worker/trunk/src/MWP/Worker/Kernel.php
r1460090 r1821951 71 71 } 72 72 73 @ini_set('display_errors', false); 74 73 75 try { 74 76 // Get action info. -
worker/trunk/version
r1797792 r1821951 1 4. 3.32 2018-0 1-0500:00:001 4.4.0 2 2018-02-06 00:00:00
Note: See TracChangeset
for help on using the changeset viewer.