mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-27 04:28:44 +02:00
N°9319 increase php min. version to 8.2 (#887)
* Update minimum PHP version to 8.2 * Fix previous wrong resolution of merge conflict
This commit is contained in:
@@ -9,11 +9,11 @@
|
||||
profiler_markup_version: 3,
|
||||
}) }}
|
||||
</div>
|
||||
|
||||
|
||||
<style{% if csp_style_nonce %} nonce="{{ csp_style_nonce }}"{% endif %}>
|
||||
{{ include('@WebProfiler/Profiler/toolbar.css.twig') }}
|
||||
</style>
|
||||
|
||||
|
||||
{# CAUTION: the contents of this file are processed by Twig before loading
|
||||
them as JavaScript source code. Always use '/*' comments instead
|
||||
of '//' comments to avoid impossible-to-debug side-effects #}
|
||||
@@ -21,7 +21,7 @@
|
||||
if (typeof Sfjs === 'undefined' || typeof Sfjs.loadToolbar === 'undefined') {
|
||||
Sfjs = (function() {
|
||||
"use strict";
|
||||
|
||||
|
||||
if ('classList' in document.documentElement) {
|
||||
var hasClass = function (el, cssClass) { return el.classList.contains(cssClass); };
|
||||
var removeClass = function(el, cssClass) { el.classList.remove(cssClass); };
|
||||
@@ -33,13 +33,13 @@
|
||||
var addClass = function(el, cssClass) { if (!hasClass(el, cssClass)) { el.className += " " + cssClass; } };
|
||||
var toggleClass = function(el, cssClass) { hasClass(el, cssClass) ? removeClass(el, cssClass) : addClass(el, cssClass); };
|
||||
}
|
||||
|
||||
|
||||
var noop = function() {};
|
||||
|
||||
|
||||
var profilerStorageKey = 'symfony/profiler/';
|
||||
|
||||
|
||||
var addEventListener;
|
||||
|
||||
|
||||
var el = document.createElement('div');
|
||||
if (!('addEventListener' in el)) {
|
||||
addEventListener = function (element, eventName, callback) {
|
||||
@@ -50,7 +50,7 @@
|
||||
element.addEventListener(eventName, callback, false);
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
var request = function(url, onSuccess, onError, payload, options, tries) {
|
||||
var xhr = window.XMLHttpRequest ? new XMLHttpRequest() : new ActiveXObject('Microsoft.XMLHTTP');
|
||||
options = options || {};
|
||||
@@ -58,14 +58,14 @@
|
||||
tries = tries || 1;
|
||||
/* this delays for 125, 375, 625, 875, and 1000, ... */
|
||||
var delay = tries < 5 ? (tries - 0.5) * 250 : 1000;
|
||||
|
||||
|
||||
xhr.open(options.method || 'GET', url, true);
|
||||
xhr.setRequestHeader('X-Requested-With', 'XMLHttpRequest');
|
||||
xhr.onreadystatechange = function(state) {
|
||||
if (4 !== xhr.readyState) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
if (xhr.status == 404 && options.retry && !options.stop) {
|
||||
setTimeout(function() {
|
||||
if (options.stop) {
|
||||
@@ -73,48 +73,48 @@
|
||||
}
|
||||
request(url, onSuccess, onError, payload, options, tries + 1);
|
||||
}, delay);
|
||||
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
if (200 === xhr.status) {
|
||||
(onSuccess || noop)(xhr);
|
||||
} else {
|
||||
(onError || noop)(xhr);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
if (options.onSend) {
|
||||
options.onSend(tries);
|
||||
}
|
||||
|
||||
|
||||
xhr.send(payload || '');
|
||||
};
|
||||
|
||||
|
||||
var getPreference = function(name) {
|
||||
if (!window.localStorage) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
return localStorage.getItem(profilerStorageKey + name);
|
||||
};
|
||||
|
||||
|
||||
var setPreference = function(name, value) {
|
||||
if (!window.localStorage) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
localStorage.setItem(profilerStorageKey + name, value);
|
||||
};
|
||||
|
||||
|
||||
var requestStack = [];
|
||||
|
||||
|
||||
var extractHeaders = function(xhr, stackElement) {
|
||||
/* Here we avoid to call xhr.getResponseHeader in order to */
|
||||
/* prevent polluting the console with CORS security errors */
|
||||
var allHeaders = xhr.getAllResponseHeaders();
|
||||
var ret;
|
||||
|
||||
|
||||
if (ret = allHeaders.match(/^x-debug-token:\s+(.*)$/im)) {
|
||||
stackElement.profile = ret[1];
|
||||
}
|
||||
@@ -126,7 +126,7 @@
|
||||
stackElement.toolbarReplace = '1' === ret[1];
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
var successStreak = 4;
|
||||
var pendingRequests = 0;
|
||||
var renderAjaxRequests = function() {
|
||||
@@ -135,12 +135,12 @@
|
||||
return;
|
||||
}
|
||||
requestCounter.textContent = requestStack.length;
|
||||
|
||||
|
||||
var infoSpan = document.querySelector(".sf-toolbar-ajax-info");
|
||||
if (infoSpan) {
|
||||
infoSpan.textContent = requestStack.length + ' AJAX request' + (requestStack.length !== 1 ? 's' : '');
|
||||
}
|
||||
|
||||
|
||||
var ajaxToolbarPanel = document.querySelector('.sf-toolbar-block-ajax');
|
||||
if (requestStack.length) {
|
||||
ajaxToolbarPanel.style.display = 'block';
|
||||
@@ -157,45 +157,45 @@
|
||||
removeClass(ajaxToolbarPanel, 'sf-toolbar-status-red');
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
var startAjaxRequest = function(index) {
|
||||
var tbody = document.querySelector('.sf-toolbar-ajax-request-list');
|
||||
if (!tbody) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
var nbOfAjaxRequest = tbody.rows.length;
|
||||
if (nbOfAjaxRequest >= 100) {
|
||||
tbody.deleteRow(0);
|
||||
}
|
||||
|
||||
|
||||
var request = requestStack[index];
|
||||
pendingRequests++;
|
||||
var row = document.createElement('tr');
|
||||
request.DOMNode = row;
|
||||
|
||||
|
||||
var requestNumberCell = document.createElement('td');
|
||||
requestNumberCell.textContent = index + 1;
|
||||
row.appendChild(requestNumberCell);
|
||||
|
||||
|
||||
var profilerCell = document.createElement('td');
|
||||
profilerCell.textContent = 'n/a';
|
||||
row.appendChild(profilerCell);
|
||||
|
||||
|
||||
var methodCell = document.createElement('td');
|
||||
methodCell.textContent = request.method;
|
||||
row.appendChild(methodCell);
|
||||
|
||||
|
||||
var typeCell = document.createElement('td');
|
||||
typeCell.textContent = request.type;
|
||||
row.appendChild(typeCell);
|
||||
|
||||
|
||||
var statusCodeCell = document.createElement('td');
|
||||
var statusCode = document.createElement('span');
|
||||
statusCode.textContent = 'n/a';
|
||||
statusCodeCell.appendChild(statusCode);
|
||||
row.appendChild(statusCodeCell);
|
||||
|
||||
|
||||
var pathCell = document.createElement('td');
|
||||
pathCell.className = 'sf-ajax-request-url';
|
||||
if ('GET' === request.method) {
|
||||
@@ -208,33 +208,33 @@
|
||||
}
|
||||
pathCell.setAttribute('title', request.url);
|
||||
row.appendChild(pathCell);
|
||||
|
||||
|
||||
var durationCell = document.createElement('td');
|
||||
durationCell.className = 'sf-ajax-request-duration';
|
||||
durationCell.textContent = 'n/a';
|
||||
row.appendChild(durationCell);
|
||||
|
||||
|
||||
request.liveDurationHandle = setInterval(function() {
|
||||
durationCell.textContent = (new Date() - request.start) + ' ms';
|
||||
}, 100);
|
||||
|
||||
|
||||
row.className = 'sf-ajax-request sf-ajax-request-loading';
|
||||
tbody.insertBefore(row, null);
|
||||
|
||||
|
||||
var toolbarInfo = document.querySelector('.sf-toolbar-block-ajax .sf-toolbar-info');
|
||||
toolbarInfo.scrollTop = toolbarInfo.scrollHeight;
|
||||
|
||||
|
||||
renderAjaxRequests();
|
||||
};
|
||||
|
||||
|
||||
var finishAjaxRequest = function(index) {
|
||||
var request = requestStack[index];
|
||||
clearInterval(request.liveDurationHandle);
|
||||
|
||||
|
||||
if (!request.DOMNode) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (request.toolbarReplace && !request.toolbarReplaceFinished && request.profile) {
|
||||
/* Flag as complete because finishAjaxRequest can be called multiple times. */
|
||||
request.toolbarReplaceFinished = true;
|
||||
@@ -246,8 +246,11 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pendingRequests--;
|
||||
|
||||
if (pendingRequests > 0) {
|
||||
pendingRequests--;
|
||||
}
|
||||
|
||||
var row = request.DOMNode;
|
||||
/* Unpack the children from the row */
|
||||
var profilerCell = row.children[1];
|
||||
@@ -255,7 +258,7 @@
|
||||
var statusCodeCell = row.children[4];
|
||||
var statusCodeElem = statusCodeCell.children[0];
|
||||
var durationCell = row.children[6];
|
||||
|
||||
|
||||
if (request.error) {
|
||||
row.className = 'sf-ajax-request sf-ajax-request-error';
|
||||
methodCell.className = 'sf-ajax-request-error';
|
||||
@@ -264,7 +267,7 @@
|
||||
row.className = 'sf-ajax-request sf-ajax-request-ok';
|
||||
successStreak++;
|
||||
}
|
||||
|
||||
|
||||
if (request.statusCode) {
|
||||
if (request.statusCode < 300) {
|
||||
statusCodeElem.setAttribute('class', 'sf-toolbar-status');
|
||||
@@ -277,11 +280,11 @@
|
||||
} else {
|
||||
statusCodeElem.setAttribute('class', 'sf-toolbar-status sf-toolbar-status-red');
|
||||
}
|
||||
|
||||
|
||||
if (request.duration) {
|
||||
durationCell.textContent = request.duration + ' ms';
|
||||
}
|
||||
|
||||
|
||||
if (request.profilerUrl) {
|
||||
profilerCell.textContent = '';
|
||||
var profilerLink = document.createElement('a');
|
||||
@@ -289,10 +292,10 @@
|
||||
profilerLink.textContent = request.profile;
|
||||
profilerCell.appendChild(profilerLink);
|
||||
}
|
||||
|
||||
|
||||
renderAjaxRequests();
|
||||
};
|
||||
|
||||
|
||||
{% if excluded_ajax_paths is defined %}
|
||||
if (window.fetch && window.fetch.polyfill === undefined) {
|
||||
var oldFetch = window.fetch;
|
||||
@@ -318,7 +321,7 @@
|
||||
if (params && params.method !== undefined) {
|
||||
method = params.method;
|
||||
}
|
||||
|
||||
|
||||
var stackElement = {
|
||||
error: false,
|
||||
url: url,
|
||||
@@ -326,7 +329,7 @@
|
||||
type: 'fetch',
|
||||
start: new Date()
|
||||
};
|
||||
|
||||
|
||||
var idx = requestStack.push(stackElement) - 1;
|
||||
promise.then(function (r) {
|
||||
stackElement.duration = new Date() - stackElement.start;
|
||||
@@ -343,16 +346,16 @@
|
||||
});
|
||||
startAjaxRequest(idx);
|
||||
}
|
||||
|
||||
|
||||
return promise;
|
||||
};
|
||||
}
|
||||
if (window.XMLHttpRequest && XMLHttpRequest.prototype.addEventListener) {
|
||||
var proxied = XMLHttpRequest.prototype.open;
|
||||
|
||||
|
||||
XMLHttpRequest.prototype.open = function(method, url, async, user, pass) {
|
||||
var self = this;
|
||||
|
||||
|
||||
/* prevent logging AJAX calls to static and inline files, like templates */
|
||||
var path = url;
|
||||
if (url.slice(0, 1) === '/') {
|
||||
@@ -363,7 +366,7 @@
|
||||
else if (0 === url.indexOf('{{ (request.schemeAndHttpHost ~ request.basePath)|e('js') }}')) {
|
||||
path = url.slice({{ (request.schemeAndHttpHost ~ request.basePath)|length }});
|
||||
}
|
||||
|
||||
|
||||
if (!path.match(new RegExp({{ excluded_ajax_paths|json_encode|raw }}))) {
|
||||
var stackElement = {
|
||||
error: false,
|
||||
@@ -372,54 +375,54 @@
|
||||
type: 'xhr',
|
||||
start: new Date()
|
||||
};
|
||||
|
||||
|
||||
var idx = requestStack.push(stackElement) - 1;
|
||||
|
||||
|
||||
this.addEventListener('readystatechange', function() {
|
||||
if (self.readyState == 4) {
|
||||
stackElement.duration = new Date() - stackElement.start;
|
||||
stackElement.error = self.status < 200 || self.status >= 400;
|
||||
stackElement.statusCode = self.status;
|
||||
extractHeaders(self, stackElement);
|
||||
|
||||
|
||||
finishAjaxRequest(idx);
|
||||
}
|
||||
}, false);
|
||||
|
||||
|
||||
startAjaxRequest(idx);
|
||||
}
|
||||
|
||||
|
||||
proxied.apply(this, Array.prototype.slice.call(arguments));
|
||||
};
|
||||
}
|
||||
{% endif %}
|
||||
|
||||
|
||||
return {
|
||||
hasClass: hasClass,
|
||||
|
||||
|
||||
removeClass: removeClass,
|
||||
|
||||
|
||||
addClass: addClass,
|
||||
|
||||
|
||||
toggleClass: toggleClass,
|
||||
|
||||
|
||||
getPreference: getPreference,
|
||||
|
||||
|
||||
setPreference: setPreference,
|
||||
|
||||
|
||||
addEventListener: addEventListener,
|
||||
|
||||
|
||||
request: request,
|
||||
|
||||
|
||||
renderAjaxRequests: renderAjaxRequests,
|
||||
|
||||
|
||||
getSfwdt: function(token) {
|
||||
return document.getElementById('sfwdt' + token);
|
||||
},
|
||||
|
||||
|
||||
load: function(selector, url, onSuccess, onError, options) {
|
||||
var el = document.getElementById(selector);
|
||||
|
||||
|
||||
if (el && el.getAttribute('data-sfurl') !== url) {
|
||||
request(
|
||||
url,
|
||||
@@ -443,14 +446,14 @@
|
||||
options
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
return this;
|
||||
},
|
||||
|
||||
|
||||
showToolbar: function(token) {
|
||||
var sfwdt = this.getSfwdt(token);
|
||||
removeClass(sfwdt, 'sf-display-none');
|
||||
|
||||
removeClass(sfwdt.parentNode, 'sf-display-none');
|
||||
|
||||
if (getPreference('toolbar/displayState') == 'none') {
|
||||
document.getElementById('sfToolbarMainContent-' + token).style.display = 'none';
|
||||
document.getElementById('sfToolbarClearer-' + token).style.display = 'none';
|
||||
@@ -461,36 +464,36 @@
|
||||
document.getElementById('sfMiniToolbar-' + token).style.display = 'none';
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
hideToolbar: function(token) {
|
||||
var sfwdt = this.getSfwdt(token);
|
||||
addClass(sfwdt, 'sf-display-none');
|
||||
addClass(sfwdt.parentNode, 'sf-display-none');
|
||||
},
|
||||
|
||||
|
||||
initToolbar: function(token) {
|
||||
this.showToolbar(token);
|
||||
|
||||
|
||||
var hideButton = document.getElementById('sfToolbarHideButton-' + token);
|
||||
var hideButtonSvg = hideButton.querySelector('svg');
|
||||
hideButtonSvg.setAttribute('aria-hidden', 'true');
|
||||
hideButtonSvg.setAttribute('focusable', 'false');
|
||||
addEventListener(hideButton, 'click', function (event) {
|
||||
event.preventDefault();
|
||||
|
||||
|
||||
var p = this.parentNode;
|
||||
p.style.display = 'none';
|
||||
(p.previousElementSibling || p.previousSibling).style.display = 'none';
|
||||
document.getElementById('sfMiniToolbar-' + token).style.display = 'block';
|
||||
setPreference('toolbar/displayState', 'none');
|
||||
});
|
||||
|
||||
|
||||
var showButton = document.getElementById('sfToolbarMiniToggler-' + token);
|
||||
var showButtonSvg = showButton.querySelector('svg');
|
||||
showButtonSvg.setAttribute('aria-hidden', 'true');
|
||||
showButtonSvg.setAttribute('focusable', 'false');
|
||||
addEventListener(showButton, 'click', function (event) {
|
||||
event.preventDefault();
|
||||
|
||||
|
||||
var elem = this.parentNode;
|
||||
if (elem.style.display == 'none') {
|
||||
document.getElementById('sfToolbarMainContent-' + token).style.display = 'none';
|
||||
@@ -501,54 +504,54 @@
|
||||
document.getElementById('sfToolbarClearer-' + token).style.display = 'block';
|
||||
elem.style.display = 'none'
|
||||
}
|
||||
|
||||
|
||||
setPreference('toolbar/displayState', 'block');
|
||||
});
|
||||
},
|
||||
|
||||
|
||||
loadToolbar: function(token, newToken) {
|
||||
var that = this;
|
||||
var triesCounter = document.getElementById('sfLoadCounter-' + token);
|
||||
|
||||
|
||||
var options = {
|
||||
retry: true,
|
||||
onSend: function (count) {
|
||||
if (count === 3) {
|
||||
that.initToolbar(token);
|
||||
}
|
||||
|
||||
|
||||
if (triesCounter) {
|
||||
triesCounter.textContent = count;
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
var cancelButton = document.getElementById('sfLoadCancel-' + token);
|
||||
if (cancelButton) {
|
||||
addEventListener(cancelButton, 'click', function (event) {
|
||||
event.preventDefault();
|
||||
|
||||
|
||||
options.stop = true;
|
||||
that.hideToolbar(token);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
newToken = (newToken || token);
|
||||
|
||||
|
||||
this.load(
|
||||
'sfwdt' + token,
|
||||
'{{ url("_wdt", { "token": "xxxxxx" })|escape('js') }}'.replace(/xxxxxx/, newToken),
|
||||
function(xhr, el) {
|
||||
var toolbarContent = document.getElementById('sfToolbarMainContent-' + newToken);
|
||||
|
||||
|
||||
/* Do nothing in the edge case where the toolbar has already been replaced with a new one */
|
||||
if (!toolbarContent) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
/* Replace the ID, it has to match the new token */
|
||||
toolbarContent.parentElement.id = 'sfwdt' + newToken;
|
||||
|
||||
|
||||
/* Evaluate in global scope scripts embedded inside the toolbar */
|
||||
var i, scripts = [].slice.call(el.querySelectorAll('script'));
|
||||
for (i = 0; i < scripts.length; ++i) {
|
||||
@@ -556,15 +559,15 @@
|
||||
eval.call({}, scripts[i].firstChild.nodeValue);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
el.style.display = -1 !== xhr.responseText.indexOf('sf-toolbarreset') ? 'block' : 'none';
|
||||
|
||||
|
||||
if (el.style.display == 'none') {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
that.initToolbar(newToken);
|
||||
|
||||
|
||||
/* Handle toolbar-info position */
|
||||
var toolbarBlocks = [].slice.call(el.querySelectorAll('.sf-toolbar-block'));
|
||||
for (i = 0; i < toolbarBlocks.length; ++i) {
|
||||
@@ -574,11 +577,11 @@
|
||||
var elementWidth = toolbarInfo.offsetWidth;
|
||||
var leftValue = (elementWidth + this.offsetLeft) - pageWidth;
|
||||
var rightValue = (elementWidth + (pageWidth - this.offsetLeft)) - pageWidth;
|
||||
|
||||
|
||||
/* Reset right and left value, useful on window resize */
|
||||
toolbarInfo.style.right = '';
|
||||
toolbarInfo.style.left = '';
|
||||
|
||||
|
||||
if (elementWidth > pageWidth) {
|
||||
toolbarInfo.style.left = 0;
|
||||
}
|
||||
@@ -591,7 +594,7 @@
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
renderAjaxRequests();
|
||||
addEventListener(document.querySelector('.sf-toolbar-ajax-clear'), 'click', function() {
|
||||
requestStack = [];
|
||||
@@ -605,10 +608,10 @@
|
||||
});
|
||||
addEventListener(document.querySelector('.sf-toolbar-block-ajax > .sf-toolbar-icon'), 'click', function (event) {
|
||||
event.preventDefault();
|
||||
|
||||
|
||||
toggleClass(this.parentNode, 'hover');
|
||||
});
|
||||
|
||||
|
||||
var dumpInfo = document.querySelector('.sf-toolbar-block-dump .sf-toolbar-info');
|
||||
if (null !== dumpInfo) {
|
||||
addEventListener(dumpInfo, 'sfbeforedumpcollapse', function () {
|
||||
@@ -628,32 +631,32 @@
|
||||
An error occurred while loading the web debug toolbar. <a href="{{ url("_profiler_home")|escape('js') }}' + newToken + '">Open the web profiler.</a>\
|
||||
</div>\
|
||||
';
|
||||
sfwdt.setAttribute('class', 'sf-toolbar sf-error-toolbar');
|
||||
sfwdt.parentElement.setAttribute('class', 'sf-toolbar sf-error-toolbar');
|
||||
}
|
||||
},
|
||||
options
|
||||
);
|
||||
|
||||
|
||||
return this;
|
||||
},
|
||||
|
||||
|
||||
toggle: function(selector, elOn, elOff) {
|
||||
var tmp = elOn.style.display,
|
||||
el = document.getElementById(selector);
|
||||
|
||||
|
||||
elOn.style.display = elOff.style.display;
|
||||
elOff.style.display = tmp;
|
||||
|
||||
|
||||
if (el) {
|
||||
el.style.display = 'none' === tmp ? 'none' : 'block';
|
||||
}
|
||||
|
||||
|
||||
return this;
|
||||
},
|
||||
};
|
||||
})();
|
||||
}
|
||||
|
||||
|
||||
Sfjs.loadToolbar('{{ token }}');
|
||||
/*]]>*/</script>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user