Plugin Directory

Changeset 1821951


Ignore:
Timestamp:
02/14/2018 11:47:25 AM (8 years ago)
Author:
freediver
Message:

version 4.4.0

Location:
worker/trunk
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • worker/trunk/functions.php

    r1792691 r1821951  
    12671267{
    12681268    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'))) {
    12701270        $mmode = get_option('mwp_maintenace_mode');
    12711271        if (!empty($mmode)) {
     
    14261426function mwp_get_service_key()
    14271427{
    1428     $serviceKey = get_option('mwp_service_key');
     1428    $serviceKey = mwp_context()->optionGet('mwp_service_key');
    14291429    if (empty($serviceKey)) {
    14301430        $serviceKey = mwp_generate_uuid4();
    1431         update_option('mwp_service_key', $serviceKey, true);
     1431        mwp_context()->optionSet('mwp_service_key', $serviceKey, true);
    14321432    }
    14331433
     
    14371437function mwp_get_communication_key()
    14381438{
    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
     1442function 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);
    14491449
    14501450    return $potentialKey;
     
    14531453function mwp_get_potential_key()
    14541454{
    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');
    14571457    $now              = time();
    14581458
     
    14601460        $potentialKey     = mwp_generate_uuid4();
    14611461        $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);
    14641464    }
    14651465
     
    14771477    $data = null;
    14781478    if (function_exists('openssl_random_pseudo_bytes')) {
    1479         $data = openssl_random_pseudo_bytes(16);
     1479        $data = @openssl_random_pseudo_bytes(16);
    14801480    }
    14811481
     
    15011501    }
    15021502
    1503     update_option('mwp_public_keys', $liveKeys, true);
     1503    mwp_context()->optionSet('mwp_public_keys', $liveKeys, true);
    15041504}
    15051505
    15061506function mwp_get_public_keys_from_live()
    15071507{
    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(
    15091509        'ssl' => array(
    15101510            'verify_peer'       => true,
     
    15421542    }
    15431543
    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(
    15451545        'ssl' => array(
    15461546            'verify_peer'       => true,
     
    15701570
    15711571
    1572     if (fwrite($socket, $requestContent) === false) {
     1572    if (@fwrite($socket, $requestContent) === false) {
    15731573        return null;
    15741574    }
    15751575
    15761576    do {
    1577         $line = fgets($socket);
     1577        $line = @fgets($socket);
    15781578    } while ($line !== false && $line !== "\n" && $line !== "\r\n");
    15791579
     
    15821582    }
    15831583
    1584     $content = stream_get_contents($socket);
    1585 
    1586     fclose($socket);
     1584    $content = @stream_get_contents($socket);
     1585
     1586    @fclose($socket);
    15871587
    15881588    if ($content === false || !is_string($content)) {
  • worker/trunk/init.php

    r1797792 r1821951  
    44Plugin URI: https://managewp.com
    55Description: 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.3
     6Version: 4.4.0
    77Author: ManageWP
    88Author URI: https://managewp.com
    99License: GPL2
    1010Text Domain: worker
     11Network: true
    1112*/
    1213
     
    559560endif;
    560561
    561 if (!function_exists('hide_worker_update')):
    562     function hide_worker_update($value)
     562if (!function_exists('add_worker_update_info')):
     563    function add_worker_update_info()
    563564    {
    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.';
    568566    }
    569567endif;
     
    578576        register_activation_hook(__FILE__, 'mwp_activation_hook');
    579577
    580         $GLOBALS['MMB_WORKER_VERSION']  = '4.3.3';
    581         $GLOBALS['MMB_WORKER_REVISION'] = '2018-01-05 00:00:00';
     578        $GLOBALS['MMB_WORKER_VERSION']  = '4.4.0';
     579        $GLOBALS['MMB_WORKER_REVISION'] = '2018-02-06 00:00:00';
    582580
    583581        // Ensure PHP version compatibility.
     
    716714        add_filter('comment_edit_redirect', 'mwb_edit_redirect_override');
    717715        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');
    721717
    722718        // Datasend cron.
  • worker/trunk/readme.txt

    r1797792 r1821951  
    11=== ManageWP Worker ===
    22Contributors: managewp,freediver
    3 Donate link: https://www.networkforgood.org/donation/MakeDonation.aspx?ORGID2=520781390
    43Tags: 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
    54Requires at least: 3.1
     
    5857== Changelog ==
    5958
     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
    6069= 4.3.3 =
    6170
    62 - Improvement: Always use charset for database backup
    63 - Change: The Worker plugin is fully compatible with WordPress 4.9
     71- Improvement: Always force the correct charset for database backups.
     72- Improvement: The Worker plugin is now fully compatible with WordPress 4.9.
    6473
    6574= 4.3.2 =
    6675
    67 - Fix: The Worker plugin throw exception while recovering from failed update
     76- Fix: The Worker plugin threw an exception while recovering from failed update.
    6877
    6978= 4.3.1 =
  • worker/trunk/src/MMB/Core.php

    r1792348 r1821951  
    114114        $configurationService = new MWP_Configuration_Service();
    115115        $configuration        = $configurationService->getConfiguration();
    116         $notice               = $configuration->getNotice();
     116        $notice               = is_multisite() ? $configuration->getNetworkNotice() : $configuration->getNotice();
    117117
    118118        echo $notice;
     
    227227Author URI: https://managewp.com
    228228License: GPL2
     229Network: true
    229230*/
    230231
  • worker/trunk/src/MWP/Action/ConnectWebsite.php

    r1792348 r1821951  
    3838
    3939        $configuration->setPublicKey($publicKey);
    40         mwp_accept_potential_key();
     40        mwp_accept_potential_key($request->getCommunicationKey());
    4141
    4242        $this->setBrand($params);
  • worker/trunk/src/MWP/Configuration/Conf.php

    r1792348 r1821951  
    143143    public function getNetworkNotice()
    144144    {
    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.');
    146146    }
    147147
     
    274274    }
    275275
    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.';
    278284    }
    279285
  • worker/trunk/src/MWP/EventListener/MasterRequest/VerifyConnectionInfo.php

    r1792348 r1821951  
    6969        }
    7070
    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()))) {
    7274            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.");
    7375        }
  • worker/trunk/src/MWP/EventListener/PublicRequest/AddConnectionKeyInfo.php

    r1792348 r1821951  
    8484    public function printConnectionModalDialog()
    8585    {
     86        if ($this->context->isMultisite() && !$this->context->isNetworkAdmin()) {
     87            return;
     88        }
     89
    8690        if (!$this->userCanViewConnectionKey()) {
    8791            return;
     
    9195        ?>
    9296        <div id="mwp_connection_key_dialog" style="display: none;">
     97            <?php if (!mwp_get_communication_key()) { ?>
    9398            <p>There are two ways to connect your website to the management dashboard:</p>
    9499
     
    108113                <li>Enter this website's URL. When prompted, paste the connection key</li>
    109114            </ol>
     115            <?php } ?>
    110116
    111117            <div style="text-align: center;font-weight: bold;"><p style="margin-bottom: 4px;margin-top: 20px;">Connection Key</p></div>
     
    123129    public function addConnectionKeyLink($meta, $slug)
    124130    {
     131        if ($this->context->isMultisite() && !$this->context->isNetworkAdmin()) {
     132            return $meta;
     133        }
     134
    125135        if ($slug !== $this->slug) {
    126136            return $meta;
     
    138148    private function userCanViewConnectionKey()
    139149    {
    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');
    143151    }
    144152}
  • worker/trunk/src/MWP/WordPress/Context.php

    r1792348 r1821951  
    659659    }
    660660
     661    public function isMainSite()
     662    {
     663        return is_main_site();
     664    }
     665
     666    public function isNetworkAdmin()
     667    {
     668        return is_network_admin();
     669    }
     670
    661671    public function getSiteId()
    662672    {
  • worker/trunk/src/MWP/Worker/Kernel.php

    r1460090 r1821951  
    7171        }
    7272
     73        @ini_set('display_errors', false);
     74
    7375        try {
    7476            // Get action info.
  • worker/trunk/version

    r1797792 r1821951  
    1 4.3.3
    2 2018-01-05 00:00:00
     14.4.0
     22018-02-06 00:00:00
Note: See TracChangeset for help on using the changeset viewer.