Add linux cron option to settings
[MAILPOET-1538]
This commit is contained in:
@ -419,6 +419,7 @@ class Menu {
|
|||||||
'pages' => Pages::getAll(),
|
'pages' => Pages::getAll(),
|
||||||
'flags' => $flags,
|
'flags' => $flags,
|
||||||
'current_user' => wp_get_current_user(),
|
'current_user' => wp_get_current_user(),
|
||||||
|
'linux_cron_path' => dirname(dirname(__DIR__)),
|
||||||
'hosts' => array(
|
'hosts' => array(
|
||||||
'web' => Hosts::getWebHosts(),
|
'web' => Hosts::getWebHosts(),
|
||||||
'smtp' => Hosts::getSMTPHosts()
|
'smtp' => Hosts::getSMTPHosts()
|
||||||
|
@ -10,6 +10,7 @@ class CronTrigger {
|
|||||||
public static $available_methods = array(
|
public static $available_methods = array(
|
||||||
'mailpoet' => 'MailPoet',
|
'mailpoet' => 'MailPoet',
|
||||||
'wordpress' => 'WordPress',
|
'wordpress' => 'WordPress',
|
||||||
|
'linux_cron' => 'Linux Cron',
|
||||||
'none' => 'Disabled'
|
'none' => 'Disabled'
|
||||||
);
|
);
|
||||||
const DEFAULT_METHOD = 'WordPress';
|
const DEFAULT_METHOD = 'WordPress';
|
||||||
|
@ -166,6 +166,16 @@
|
|||||||
toggleReCaptchaSettings();
|
toggleReCaptchaSettings();
|
||||||
$('#settings_re_captcha_tokens_error').hide();
|
$('#settings_re_captcha_tokens_error').hide();
|
||||||
|
|
||||||
|
function toggleLinuxCronSettings() {
|
||||||
|
if ($('input[name="cron_trigger[method]"]:checked').val() === '<%= cron_trigger.linux_cron %>') {
|
||||||
|
$('#settings_linux_cron').show();
|
||||||
|
} else {
|
||||||
|
$('#settings_linux_cron').hide();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$('input[name="cron_trigger[method]"]').on('click', toggleLinuxCronSettings);
|
||||||
|
toggleLinuxCronSettings();
|
||||||
|
|
||||||
// page preview
|
// page preview
|
||||||
$('.mailpoet_page_preview').on('click', function() {
|
$('.mailpoet_page_preview').on('click', function() {
|
||||||
var selection = $(this).siblings('.mailpoet_page_selection');
|
var selection = $(this).siblings('.mailpoet_page_selection');
|
||||||
|
@ -65,6 +65,35 @@
|
|||||||
%>
|
%>
|
||||||
</label>
|
</label>
|
||||||
</p>
|
</p>
|
||||||
|
<p>
|
||||||
|
<label>
|
||||||
|
<input
|
||||||
|
type="radio"
|
||||||
|
name="cron_trigger[method]"
|
||||||
|
value="<%= cron_trigger.linux_cron %>"
|
||||||
|
<% if (settings.cron_trigger.method == cron_trigger.linux_cron) %>
|
||||||
|
checked="checked"
|
||||||
|
<% endif %>
|
||||||
|
/><%= __("Server side cron (Linux cron)")
|
||||||
|
%>
|
||||||
|
</label>
|
||||||
|
</p>
|
||||||
|
<div id="settings_linux_cron">
|
||||||
|
<p>
|
||||||
|
<%= __("To use this option please add this command to your crontab:") %><br>
|
||||||
|
<input
|
||||||
|
value="php <%= linux_cron_path %>/mailpoet-cron.php"
|
||||||
|
class="large-text"
|
||||||
|
readonly
|
||||||
|
/>
|
||||||
|
<p>
|
||||||
|
<%= __("With the frequency of running it every minute:") %><br>
|
||||||
|
<input
|
||||||
|
value="*/1 * * * *"
|
||||||
|
class="large-text"
|
||||||
|
readonly
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<!-- roles and capabilities -->
|
<!-- roles and capabilities -->
|
||||||
|
Reference in New Issue
Block a user