Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .phpcs.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
<arg name="colors"/>
<arg name="extensions" value="php"/>
<arg name="parallel" value="8"/><!-- Enables parallel processing when available for faster results. -->

<!-- Rules: Check PHP version compatibility -->
<!-- https://github.com/PHPCompatibility/PHPCompatibility#sniffing-your-code-for-compatibility-with-specific-php-versions -->
<config name="testVersion" value="7.4-"/>
Expand Down
2 changes: 1 addition & 1 deletion .wiki/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ The documentation is organized into the following categories:

## How to Use This Documentation

You can browse the documentation directly on GitHub by visiting the [Wiki](https://github.com/superdav42/wp-multisite-waas/wiki).
You can browse the documentation at [ultimatemultisite.com/docs](https://ultimatemultisite.com/docs/).

### Automatic Sync

Expand Down
272 changes: 139 additions & 133 deletions assets/js/setup-wizard.js
Original file line number Diff line number Diff line change
@@ -1,212 +1,218 @@
/* global wu_setup, wu_setup_settings, ajaxurl, wu_block_ui_polyfill, _wu_block_ui_polyfill */
(function($) {

window._wu_block_ui_polyfill = wu_block_ui_polyfill;
window._wu_block_ui_polyfill = wu_block_ui_polyfill;

wu_block_ui_polyfill = function() { };
wu_block_ui_polyfill = function() { };

$(document).ready(function() {
$(document).ready(function() {

// Click button
// Generates queue
// Start to process queue items one by one
// Changes the status
// Move to the next item
// When all is done, redirect to the next page via a form submission
$('#poststuff').on('submit', 'form', function(e) {
// Click button
// Generates queue
// Start to process queue items one by one
// Changes the status
// Move to the next item
// When all is done, redirect to the next page via a form submission
$('#poststuff').on('submit', 'form', function(e) {

e.preventDefault();
e.preventDefault();

const $form = $(this);
const $form = $(this);

const install_id = $form.find('table[data-id]').data('id');
const install_id = $form.find('table[data-id]').data('id');

$form.find('[name=next]').attr('disabled', 'disabled');
$form.find('[name=next]').attr('disabled', 'disabled');

let queue = $form.find('tr[data-content]');
let queue = $form.find('tr[data-content]');

/*
/*
* Only keep items selected on the queue.
*/
queue = queue.filter(function() {
queue = queue.filter(function() {

const checkbox = $(this).find('input[type=checkbox]');
const checkbox = $(this).find('input[type=checkbox]');

if (checkbox.length) {
if (checkbox.length) {

return checkbox.is(':checked');
return checkbox.is(':checked');

} // end if;
} // end if;

return true;
return true;

});
});

let successes = 0;
let successes = 0;

let index = 0;
let index = 0;

process_queue_item(queue.eq(index));
process_queue_item(queue.eq(index));

/**
* Process the queue items one by one recursively.
*
* @param {string} item The item to process.
*/
function process_queue_item(item) {
/**
* Process the queue items one by one recursively.
*
* @param {string} item The item to process.
*/
function process_queue_item(item) {

window.onbeforeunload = function() {

return '';

window.onbeforeunload = function() {
};

return '';
if (item.length === 0) {

};
if (queue.length === successes || install_id === 'migration') {

if (item.length === 0) {
window.onbeforeunload = null;

if (queue.length === successes || install_id === 'migration') {
_wu_block_ui_polyfill($('#poststuff .inside'));

window.onbeforeunload = null;
setTimeout(() => {

_wu_block_ui_polyfill($('#poststuff .inside'));
$form.get(0).submit();

setTimeout(() => {
}, 100);

$form.get(0).submit();
} // end if;

}, 100);
$form.find('[name=next]').removeAttr('disabled');

} // end if;
return false;

$form.find('[name=next]').removeAttr('disabled');
} // end if;

return false;
const $item = $(item);

} // end if;
const content = $item.data('content');

const $item = $(item);
$item.get(0).scrollIntoView({ behavior: 'smooth', block: 'center', inline: 'nearest' });

const content = $item.data('content');
$item.find('td.status')
.attr('class', '')
.addClass('status')
.find('> span').html(wu_setup[ content ].installing).end()
.find('.spinner').addClass('is-active').end()
.find('a.help').slideUp();

$item.get(0).scrollIntoView({ behavior: 'smooth', block: 'center', inline: 'nearest' });
// Ajax request
$.ajax({
url: ajaxurl,
method: 'post',
data: {
action: wu_setup_settings.ajax_action || 'wu_setup_install',
installer: content,
'dry-run': wu_setup_settings.dry_run,
},
success(data) {

$item.find('td.status')
.attr('class', '')
.addClass('status')
.find('> span').html(wu_setup[content].installing).end()
.find('.spinner').addClass('is-active').end()
.find('a.help').slideUp();
if (data.success === true) {

// Ajax request
$.ajax({
url: ajaxurl,
method: 'post',
data: {
action: 'wu_setup_install',
installer: content,
'dry-run': wu_setup_settings.dry_run,
},
success(data) {
$item.find('td.status')
.attr('class', '')
.addClass('status wu-text-green-600')
.find('> span').html(wu_setup[ content ].success).end()
.find('.spinner').removeClass('is-active');

if (data.success === true) {
$item.removeAttr('data-content');

$item.find('td.status')
.attr('class', '')
.addClass('status wu-text-green-600')
.find('> span').html(wu_setup[content].success).end()
.find('.spinner').removeClass('is-active');
successes++;

$item.removeAttr('data-content');
} else {

successes++;
$item.find('td.status')
.attr('class', '')
.addClass('status wu-text-red-400')
.find('> span').html(data.data[ 0 ].message).end()
.find('.spinner').removeClass('is-active').end()
.find('a.help').slideDown();

} else {
} // end if;

$item.find('td.status')
.attr('class', '')
.addClass('status wu-text-red-400')
.find('> span').html(data.data[0].message).end()
.find('.spinner').removeClass('is-active').end()
.find('a.help').slideDown();
index++;

} // end if;
process_queue_item(queue.eq(index));

index++;
},
error(jqXHR) {

process_queue_item(queue.eq(index));
let errorMessage = wu_setup_settings.generic_error_message || 'An error occurred.';

},
error() {
if (jqXHR.responseJSON && jqXHR.responseJSON.data && jqXHR.responseJSON.data[ 0 ]) {
errorMessage = jqXHR.responseJSON.data[ 0 ].message || errorMessage;
}

$item.find('td.status')
.attr('class', '')
.addClass('status wu-text-red-400')
.find('span').html('').end()
.find('.spinner').removeClass('is-active').end()
.find('a.help').slideDown();
$item.find('td.status')
.attr('class', '')
.addClass('status wu-text-red-400')
.find('> span').html(errorMessage).end()
.find('.spinner').removeClass('is-active').end()
.find('a.help').slideDown();

index++;
index++;

process_queue_item(queue.eq(index));
process_queue_item(queue.eq(index));

},
});
},
});

} // end process_queue_item;
} // end process_queue_item;

});
});

$('#poststuff [name=next]').removeAttr('disabled');
$('#poststuff [name=next]').removeAttr('disabled');

});
});

}(jQuery));

if (typeof wu_initialize_tooltip !== 'function') {

const wu_initialize_tooltip = function() {
const wu_initialize_tooltip = function() {

jQuery('[role="tooltip"]').tipTip({
attribute: 'aria-label',
});
jQuery('[role="tooltip"]').tipTip({
attribute: 'aria-label',
});

}; // end wu_initialize_tooltip;
}; // end wu_initialize_tooltip;

// eslint-disable-next-line no-unused-vars
const wu_block_ui = function(el) {
// eslint-disable-next-line no-unused-vars
const wu_block_ui = function(el) {

jQuery(el).wu_block({
message: '<span>Please wait...</span>',
overlayCSS: {
backgroundColor: '#FFF',
opacity: 0.6,
},
css: {
padding: 0,
margin: 0,
width: '50%',
fontSize: '14px !important',
top: '40%',
left: '35%',
textAlign: 'center',
color: '#000',
border: 'none',
backgroundColor: 'none',
cursor: 'wait',
},
});
jQuery(el).wu_block({
message: '<span>Please wait...</span>',
overlayCSS: {
backgroundColor: '#FFF',
opacity: 0.6,
},
css: {
padding: 0,
margin: 0,
width: '50%',
fontSize: '14px !important',
top: '40%',
left: '35%',
textAlign: 'center',
color: '#000',
border: 'none',
backgroundColor: 'none',
cursor: 'wait',
},
});

return jQuery(el);
return jQuery(el);

};
};

(function($) {
(function($) {

$(document).ready(function() {
$(document).ready(function() {

wu_initialize_tooltip();
wu_initialize_tooltip();

});
});

}(jQuery));
}(jQuery));

} // end if;
2 changes: 1 addition & 1 deletion assets/js/setup-wizard.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion inc/admin-pages/class-base-admin-page.php
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ public function get_id() {
}

/**
* Returns the appropriate capability for a this page, depending on the context.
* Returns the appropriate capability for this page, depending on the context.
*
* @since 2.0.0
* @return string
Expand Down
Loading
Loading