Plugin Directory

Changeset 3164377


Ignore:
Timestamp:
10/07/2024 02:34:39 PM (18 months ago)
Author:
clonable
Message:

Release 2.2.6

Location:
clonable
Files:
116 added
3 deleted
14 edited

Legend:

Unmodified
Added
Removed
  • clonable/trunk/clonable-wp.php

    r3163099 r3164377  
    55Description: Official plugin for improving your clones made with Clonable.
    66Plugin URI: https://kb.clonable.net/en/introduction/getting-started/wordpress#de-clonable-plug-in-downloaden
    7 Version: 2.2.5
     7Version: 2.2.6
    88Author: Clonable BV
    99Author URI: https://www.clonable.net
     
    104104
    105105define('CLONABLE_NAME', 'Clonable');
    106 define('CLONABLE_VERSION', '2.2.5');
     106define('CLONABLE_VERSION', '2.2.6');
    107107
    108108try {
  • clonable/trunk/controllers/SettingController.php

    r3121209 r3164377  
    5757        return $this->validate_checkbox($input,'clonable_language_tag_service_enabled');
    5858    }
     59
     60    public function clonable_max_upstream_requests_validate($input) {
     61        if (!$input) {
     62            return null;
     63        }
     64
     65        if (intval($input) < 2) {
     66            add_settings_error('clonable_max_upstream_requests', 'err_invalid_value', 'The value has to be at least 2.');
     67        }
     68
     69        if (intval($input) > 200) {
     70            add_settings_error('clonable_max_upstream_requests', 'err_invalid_value', 'The value has to be at most 200.');
     71        }
     72
     73        return $input;
     74    }
     75
     76    public function clonable_max_upstream_queued_validate($input) {
     77        if (!$input) {
     78            return null;
     79        }
     80
     81        if (intval($input) < 0) {
     82            add_settings_error('clonable_max_upstream_queued', 'err_invalid_value', 'The value has to be at least 0.');
     83        }
     84
     85        if (intval($input) > 200) {
     86            add_settings_error('clonable_max_upstream_queued', 'err_invalid_value', 'The value has to be at most 200.');
     87        }
     88
     89        return $input;
     90    }
    5991}
  • clonable/trunk/models/Settings.php

    r3121209 r3164377  
    3232            "name" => "Enable language tag service",
    3333            "setting" => "clonable_language_tag_service_enabled",
    34         ]
     34        ],
     35        "clonable_max_upstream_requests" => [
     36            "render" => "max_upstream_requests_field",
     37            "name" => "Maximum number of simultaneous upstream requests",
     38            "setting" => "clonable_max_upstream_requests",
     39            "description" => "This is the maximum number of requests that can be proxied to Clonable at the same time. This should be at most half of the maximum amount of php processes (pm.max_children).",
     40        ],
     41        "clonable_max_upstream_queued" => [
     42            "render" => "max_upstream_queued_field",
     43            "name" => "Maximum number of upstream requests that may be queued ",
     44            "setting" => "clonable_max_upstream_queued",
     45            "description" => "This is the maximum number of requests that can be queued to be proxied to Clonable at the same time when the setting above is exceeded. This should be at most half of the maximum amount of simultaneous upstream requests.",
     46        ],
    3547    ];
    3648}
  • clonable/trunk/readme-da_DK.txt

    r3163099 r3164377  
    556.6.2
    66Requires PHP: 7.2
    7 Stable tag: 2.2.5
     7Stable tag: 2.2.6
    88License: GPL v2 or later
    99
     
    3232
    3333== Changelog ==
     34v2.2.6
     35Bug fix: timeouts
     36
    3437v2.2.5
    3538Improve circuit breaker logic
  • clonable/trunk/readme-de_DE.txt

    r3163099 r3164377  
    556.6.2
    66Requires PHP: 7.2
    7 Stable tag: 2.2.5
     7Stable tag: 2.2.6
    88License: GPL v2 or later
    99
     
    3232
    3333== Changelog ==
     34v2.2.6
     35Bug fix: timeouts
     36
    3437v2.2.5
    3538Improve circuit breaker logic
  • clonable/trunk/readme-es_ES.txt

    r3163099 r3164377  
    556.6.2
    66Requires PHP: 7.2
    7 Stable tag: 2.2.5
     7Stable tag: 2.2.6
    88License: GPL v2 or later
    99
     
    3232
    3333== Changelog ==
     34v2.2.6
     35Bug fix: timeouts
     36
    3437v2.2.5
    3538Improve circuit breaker logic
  • clonable/trunk/readme-fr_FR.txt

    r3163099 r3164377  
    556.6.2
    66Requires PHP: 7.2
    7 Stable tag: 2.2.5
     7Stable tag: 2.2.6
    88License: GPL v2 or later
    99
     
    3232
    3333== Changelog ==
     34v2.2.6
     35Bug fix: timeouts
     36
    3437v2.2.5
    3538Improve circuit breaker logic
  • clonable/trunk/readme-it_IT.txt

    r3163099 r3164377  
    556.6.2
    66Requires PHP: 7.2
    7 Stable tag: 2.2.5
     7Stable tag: 2.2.6
    88License: GPL v2 or later
    99
     
    3232
    3333== Changelog ==
     34v2.2.6
     35Bug fix: timeouts
     36
    3437v2.2.5
    3538Improve circuit breaker logic
  • clonable/trunk/readme-nb_NO.txt

    r3163099 r3164377  
    556.6.2
    66Requires PHP: 7.2
    7 Stable tag: 2.2.5
     7Stable tag: 2.2.6
    88License: GPL v2 or later
    99
     
    3232
    3333== Changelog ==
     34v2.2.6
     35Bug fix: timeouts
     36
    3437v2.2.5
    3538Improve circuit breaker logic
  • clonable/trunk/readme-nl_NL.txt

    r3163099 r3164377  
    556.6.2
    66Requires PHP: 7.2
    7 Stable tag: 2.2.5
     7Stable tag: 2.2.6
    88License: GPL v2 or later
    99
     
    3232
    3333== Changelog ==
     34v2.2.6
     35Bug fix: timeouts
     36
    3437v2.2.5
    3538Improve circuit breaker logic
  • clonable/trunk/readme-sv_SE.txt

    r3163099 r3164377  
    556.6.2
    66Requires PHP: 7.2
    7 Stable tag: 2.2.5
     7Stable tag: 2.2.6
    88License: GPL v2 or later
    99
     
    3232
    3333== Changelog ==
     34v2.2.6
     35Bug fix: timeouts
     36
    3437v2.2.5
    3538Improve circuit breaker logic
  • clonable/trunk/readme.txt

    r3163099 r3164377  
    55Tested up to: 6.6.2
    66Requires PHP: 7.2
    7 Stable tag: 2.2.5
     7Stable tag: 2.2.6
    88License: GPL v2 or later
    99
     
    3232
    3333== Changelog ==
     34v2.2.6
     35Bug fix: timeouts
     36
    3437v2.2.5
    3538Improve circuit breaker logic
  • clonable/trunk/services/SubfolderService.php

    r3125005 r3164377  
    1212class SubfolderService {
    1313    private $circuit_breaker;
     14
     15    private const SEMAPHORE_UPSTREAM = 62342001;
     16    private const SEMAPHORE_UPSTREAM_QUEUE = 62342002;
    1417
    1518    public function __construct() {
     
    229232        }
    230233
     234        // Semaphore
     235        if (function_exists("sem_get") && function_exists("sem_acquire") && function_exists("sem_release")) {
     236            $std_limit = max(2, intval(get_option("clonable_max_upstream_requests", 4)));
     237            $queue_limit = $std_limit + max(0, intval(get_option("clonable_max_upstream_queued", 2)));
     238
     239            $semaphore = sem_get(self::SEMAPHORE_UPSTREAM, $std_limit);
     240            $semaphore_queue = sem_get(self::SEMAPHORE_UPSTREAM_QUEUE, $queue_limit);
     241            if ($semaphore !== false) {
     242                if (!sem_acquire($semaphore_queue, true)) {
     243                    return new ClonableResponse("Server is busy. Please try again soon.", ['retry-after' => ['5'], 'location' => [$url]], 307, false);
     244                }
     245                sem_acquire($semaphore);
     246            } else {
     247                $semaphore = null;
     248            }
     249        }
     250
     251
    231252        // Send the request to Clonable
    232253        $response = curl_exec($curl);
     
    239260            if (Functions::can_log_sensitive()) {
    240261                $message .= $error;
     262            }
     263
     264            if (isset($semaphore) && isset($semaphore_queue)) {
     265                sem_release($semaphore);
     266                sem_release($semaphore_queue);
    241267            }
    242268            return new ClonableResponse($message, $headers ?? [], 504, str_contains($error, 'timed out'));
     
    251277        }
    252278
     279        if (isset($semaphore) && isset($semaphore_queue)) {
     280            sem_release($semaphore);
     281            sem_release($semaphore_queue);
     282        }
    253283        return new ClonableResponse($body, $headers, $status_code);
    254284    }
  • clonable/trunk/views/SettingsView.php

    r3121209 r3164377  
    5858        echo "(Add the language tags of the original website and the clones to the header of the page.)";
    5959    }
     60
     61    public function max_upstream_requests_field() {
     62        $option = max(2, intval(get_option('clonable_max_upstream_requests', 4)));
     63        echo "<input name='clonable_max_upstream_requests' min='2' max='200' type='number' value='$option'/>";
     64        echo "";
     65    }
     66
     67    public function max_upstream_queued_field() {
     68        $option = max(0, intval(get_option('clonable_max_upstream_queued', 2)));
     69        echo "<input name='clonable_max_upstream_queued' min='0' max='200' type='number' value='$option'/>";
     70        echo "";
     71    }
    6072}
Note: See TracChangeset for help on using the changeset viewer.