mirror of
https://github.com/DanielnetoDotCom/YouPHPTube
synced 2025-10-03 09:49:28 +02:00
Update
This commit is contained in:
parent
360d70e29e
commit
d89471174f
9 changed files with 68 additions and 47 deletions
|
@ -31,6 +31,7 @@ function getFfmpegProcesses()
|
|||
'pidEncrypted' => encryptString($parts[1]),
|
||||
'cpu' => $parts[2],
|
||||
'mem' => $parts[3],
|
||||
'runtime' => $parts[9], // Extracts the elapsed time (e.g., "00:05:32")
|
||||
'command' => $parts[10],
|
||||
];
|
||||
}
|
||||
|
@ -39,6 +40,7 @@ function getFfmpegProcesses()
|
|||
return $processes;
|
||||
}
|
||||
|
||||
|
||||
// Handle AJAX requests
|
||||
if (isset($_GET['action']) && $_GET['action'] === 'fetch') {
|
||||
header('Content-Type: application/json');
|
||||
|
@ -74,22 +76,16 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['pid'], $_POST['csrf_t
|
|||
exit;
|
||||
}
|
||||
|
||||
// Load the page
|
||||
$_page = new Page('FFmpeg Process Manager');
|
||||
$_page->setExtraScripts(array('node_modules/chart.js/dist/chart.umd.js', 'view/css/DataTables/datatables.min.js'));
|
||||
|
||||
$_page->setExtraStyles(
|
||||
array(
|
||||
'view/css/DataTables/datatables.min.css'
|
||||
)
|
||||
);
|
||||
|
||||
?>
|
||||
<script src="<?php echo getURL('node_modules/chart.js/dist/chart.umd.js'); ?>" type="text/javascript"></script>
|
||||
<script src="<?php echo getURL('view/css/DataTables/datatables.min.js'); ?>" type="text/javascript"></script>
|
||||
<link href="<?php echo getURL('view/css/DataTables/datatables.min.css'); ?>" rel="stylesheet" type="text/css" />
|
||||
|
||||
<div class="container-fluid">
|
||||
<div class="panel panel-default">
|
||||
|
||||
<div class="panel-heading">
|
||||
<h1 class="text-center">FFmpeg Process Manager</h1>
|
||||
<h1 class="text-center">FFmpeg Monitor</h1>
|
||||
</div>
|
||||
|
||||
<div class="panel-body">
|
||||
|
@ -118,6 +114,7 @@ $_page->setExtraStyles(
|
|||
<th>PID</th>
|
||||
<th>CPU%</th>
|
||||
<th>MEM%</th>
|
||||
<th>Runtime</th> <!-- New Column -->
|
||||
<th>Command</th>
|
||||
<th>Action</th>
|
||||
</tr>
|
||||
|
@ -146,6 +143,7 @@ $_page->setExtraStyles(
|
|||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
{
|
||||
"orderable": false
|
||||
}
|
||||
|
@ -203,7 +201,7 @@ $_page->setExtraStyles(
|
|||
// Fetch processes and update the table and charts
|
||||
function fetchCPUProcesses() {
|
||||
$.ajax({
|
||||
url: webSiteRootURL + 'view/ffmpegMonitor.php?action=fetch',
|
||||
url: webSiteRootURL + 'admin/ffmpegMonitor.php?action=fetch',
|
||||
type: 'GET',
|
||||
dataType: 'json',
|
||||
success: function(data) {
|
||||
|
@ -215,7 +213,7 @@ $_page->setExtraStyles(
|
|||
processRAM.length = 0;
|
||||
|
||||
data.forEach(process => {
|
||||
table.row.add([process.user, process.pid, process.cpu, process.mem, process.command, `<button class="btn btn-danger btn-kill btn-block" data-pid="${process.pidEncrypted}">Kill</button>`]);
|
||||
table.row.add([process.user, process.pid, process.cpu, process.mem,process.runtime, process.command, `<button class="btn btn-danger btn-kill btn-block" data-pid="${process.pidEncrypted}">Kill</button>`]);
|
||||
|
||||
totalCPU += parseFloat(process.cpu);
|
||||
totalRAM += parseFloat(process.mem);
|
||||
|
@ -243,6 +241,9 @@ $_page->setExtraStyles(
|
|||
historicalLine.data.datasets[0].data = historicalCPU;
|
||||
historicalLine.data.datasets[1].data = historicalRAM;
|
||||
historicalLine.update();
|
||||
setTimeout(() => {
|
||||
fetchCPUProcesses();
|
||||
}, 2000);
|
||||
},
|
||||
error: function() {
|
||||
alert('Failed to fetch process data.');
|
||||
|
@ -250,13 +251,7 @@ $_page->setExtraStyles(
|
|||
});
|
||||
}
|
||||
|
||||
// Refresh data every 5 seconds
|
||||
setInterval(fetchCPUProcesses, 5000);
|
||||
|
||||
// Initial fetch
|
||||
fetchCPUProcesses();
|
||||
});
|
||||
</script>
|
||||
|
||||
<?php
|
||||
$_page->print();
|
|
@ -100,6 +100,9 @@ $itens[] = $menu;
|
|||
$menu = new MenuAdmin(__("Health Check"), "fas fa-notes-medical", "health_check");
|
||||
$itens[] = $menu;
|
||||
|
||||
$menu = new MenuAdmin(__("FFmpeg Monitor"), "fas fa-film", "ffmpeg_monitor");
|
||||
$itens[] = $menu;
|
||||
|
||||
$_GET['page'] = xss_esc(@$_GET['page']);
|
||||
|
||||
$includeHead = '';
|
||||
|
@ -184,6 +187,9 @@ switch ($_GET['page']) {
|
|||
case "health_check":
|
||||
$includeBody = $global['systemRootPath'] . 'admin/health_check.php';
|
||||
break;
|
||||
case "ffmpeg_monitor":
|
||||
$includeBody = $global['systemRootPath'] . 'admin/ffmpegMonitor.php';
|
||||
break;
|
||||
default:
|
||||
$includeHead = $global['systemRootPath'] . 'view/charts_head.php';
|
||||
$includeBody = $global['systemRootPath'] . 'view/charts_body.php';
|
||||
|
@ -197,31 +203,38 @@ if (!empty($includeHead) && file_exists($includeHead)) {
|
|||
|
||||
?>
|
||||
<style>
|
||||
@media (max-width: 767px) {
|
||||
.affix {
|
||||
position: static;
|
||||
@media (max-width: 767px) {
|
||||
.affix {
|
||||
position: static;
|
||||
}
|
||||
}
|
||||
|
||||
.leftMenu .panel-body {
|
||||
padding: 0px;
|
||||
}
|
||||
|
||||
.adminLeftMenu.panel-default i,
|
||||
.adminLeftMenu.panel-default {
|
||||
-webkit-transition: opacity 0.5s ease-in-out;
|
||||
-moz-transition: opacity 0.5s ease-in-out;
|
||||
transition: opacity 0.5s ease-in-out;
|
||||
}
|
||||
|
||||
.adminLeftMenu.panel-default i {
|
||||
opacity: 0.2;
|
||||
}
|
||||
|
||||
.adminLeftMenu:hover.panel-default i {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
.adminLeftMenu.panel-default {
|
||||
opacity: 0.6;
|
||||
}
|
||||
|
||||
.adminLeftMenu:hover.panel-default {
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
.leftMenu .panel-body {
|
||||
padding: 0px;
|
||||
}
|
||||
.adminLeftMenu.panel-default i, .adminLeftMenu.panel-default{
|
||||
-webkit-transition: opacity 0.5s ease-in-out;
|
||||
-moz-transition: opacity 0.5s ease-in-out;
|
||||
transition: opacity 0.5s ease-in-out;
|
||||
}
|
||||
.adminLeftMenu.panel-default i{
|
||||
opacity: 0.2;
|
||||
}
|
||||
.adminLeftMenu:hover.panel-default i{
|
||||
opacity: 1;
|
||||
}
|
||||
.adminLeftMenu.panel-default{
|
||||
opacity: 0.6;
|
||||
}
|
||||
.adminLeftMenu:hover.panel-default{
|
||||
opacity: 1;
|
||||
}
|
||||
</style>
|
||||
<div class="container-fluid">
|
||||
<br>
|
||||
|
|
|
@ -3050,6 +3050,7 @@ function clearCache($firstPageOnly = false)
|
|||
|
||||
function clearAllUsersSessionCache()
|
||||
{
|
||||
_error_log("clearAllUsersSessionCache ".json_encode(debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS)));
|
||||
sendSocketMessageToAll(time(), 'socketClearSessionCache');
|
||||
}
|
||||
|
||||
|
|
|
@ -291,6 +291,8 @@ if ($obj->video['status'] == Video::$statusActive) {
|
|||
_error_log('clearFirstPageCache end');
|
||||
//clearAllUsersSessionCache();
|
||||
}
|
||||
// it cannot clear async otherwise it will cause issues on the videos manager list.
|
||||
$obj->clearCache = Video::clearCache($obj->videos_id, false, false, false);
|
||||
$rowsPath[] = array('line' => __LINE__, 'ElapsedTime' => getElapsedTime());
|
||||
$obj->rowsPath = $rowsPath;
|
||||
TimeLogEnd(__FILE__, __LINE__);
|
||||
|
|
|
@ -310,7 +310,7 @@ $ffmpegCommand = addKeywordToFFmpegCommand($ffmpegCommand, $keyword);
|
|||
file_put_contents($logFile, $ffmpegCommand.PHP_EOL.PHP_EOL);
|
||||
|
||||
$ffmpegCommand .= " > {$logFile} 2>&1";
|
||||
_error_log("Executing FFMPEG Command [$keyword]: $ffmpegCommand");
|
||||
_error_log("Executing FFMPEG Command [$keyword]: $ffmpegCommand ".json_encode(debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS)));
|
||||
|
||||
try {
|
||||
$pid = execAsync($ffmpegCommand, $keyword);
|
||||
|
|
|
@ -747,7 +747,7 @@ Disallow: *action=tagsearch*
|
|||
if (!Permissions::canAdminVideos()) {
|
||||
return false;
|
||||
}
|
||||
$video = new Video('', '', $videos_id);
|
||||
$video = new Video('', '', $videos_id, true);
|
||||
$users_id = $video->getUsers_id();
|
||||
$user = new User($users_id);
|
||||
return $user->addExternalOptions('doNotShowAdsOnThisChannel', $doNotShowAdsOnThisChannel);
|
||||
|
|
|
@ -9,7 +9,7 @@ $obj->liveTransmitionHistory_id = 0;
|
|||
|
||||
_error_log("NGINX ON Publish POST: " . json_encode($_POST));
|
||||
_error_log("NGINX ON Publish GET: " . json_encode($_GET));
|
||||
_error_log("NGINX ON Publish php://input" . file_get_contents("php://input"));
|
||||
_error_log("NGINX ON Publish php://input " . file_get_contents("php://input"));
|
||||
|
||||
// get GET parameters
|
||||
$url = $_POST['tcurl'];
|
||||
|
|
|
@ -129,7 +129,7 @@ if (empty($meet_schedule_id)) {
|
|||
openBridgeChannel: 'websocket',
|
||||
liveStreamingEnabled: true,
|
||||
fileRecordingsEnabled: false,
|
||||
inviteUrl: window.location.href
|
||||
//inviteUrl: window.location.href
|
||||
},
|
||||
interfaceConfigOverwrite: {
|
||||
TOOLBAR_BUTTONS: TOOLBAR_BUTTONS,
|
||||
|
|
|
@ -1946,7 +1946,14 @@ async function checkDescriptionArea() {
|
|||
}
|
||||
});
|
||||
}
|
||||
|
||||
var clearCacheExecuted = false;
|
||||
function clearCache(showPleaseWait, FirstPage, sessionOnly) {
|
||||
if(clearCacheExecuted){
|
||||
return false;
|
||||
}
|
||||
clearCacheExecuted = true;
|
||||
console.trace();
|
||||
if (showPleaseWait) {
|
||||
modal.showPleaseWait();
|
||||
}
|
||||
|
@ -1956,6 +1963,9 @@ function clearCache(showPleaseWait, FirstPage, sessionOnly) {
|
|||
if (showPleaseWait) {
|
||||
avideoResponse(response);
|
||||
modal.hidePleaseWait();
|
||||
setTimeout(() => {
|
||||
clearCacheExecuted = false;
|
||||
}, 1000);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue