mirror of
https://github.com/DanielnetoDotCom/YouPHPTube
synced 2025-10-06 03:50:04 +02:00
Disk Usage info
touch to activate the sound Filter plugins on plugins menu
This commit is contained in:
parent
79a3ef4c69
commit
a945aab467
6 changed files with 191 additions and 84 deletions
|
@ -251,7 +251,9 @@ Options All -Indexes
|
|||
|
||||
RewriteRule ^vast.xml/?([0-9]+)?$ plugin/AD_Server/VAST.php?campaign_has_videos_id=$1 [NC,L]
|
||||
|
||||
<IfModule mod_xsendfile.c>
|
||||
RewriteRule ^videos/([^!#$&'()*+,\/:;=?@[\]]+(\.(mp4|webm|m3u8|mp3|ogg)))$ view/xsendfile.php?file=$1 [QSA]
|
||||
</IfModule>
|
||||
|
||||
# if image do not exists
|
||||
RewriteCond %{REQUEST_URI} \.(jpg|jpeg|gif|png|ico)$ [NC]
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
<?php
|
||||
$AVideoMobileAPP_UA = "AVideoMobileApp";
|
||||
|
||||
function forbiddenWords($text) {
|
||||
global $global;
|
||||
if (empty($global['forbiddenWords'])) {
|
||||
|
@ -3299,6 +3300,11 @@ function ogSite() {
|
|||
|
||||
function getDirSize($dir) {
|
||||
_error_log("getDirSize: start {$dir}");
|
||||
|
||||
if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
|
||||
return foldersize($dir);
|
||||
} else {
|
||||
|
||||
$command = "du -sb {$dir}";
|
||||
exec($command . " < /dev/null 2>&1", $output, $return_val);
|
||||
if ($return_val !== 0) {
|
||||
|
@ -3317,6 +3323,50 @@ function ogSite() {
|
|||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function foldersize($path) {
|
||||
$total_size = 0;
|
||||
$files = scandir($path);
|
||||
$cleanPath = rtrim($path, '/') . '/';
|
||||
|
||||
foreach ($files as $t) {
|
||||
if ($t <> "." && $t <> "..") {
|
||||
$currentFile = $cleanPath . $t;
|
||||
if (is_dir($currentFile)) {
|
||||
$size = foldersize($currentFile);
|
||||
$total_size += $size;
|
||||
} else {
|
||||
$size = filesize($currentFile);
|
||||
$total_size += $size;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $total_size;
|
||||
}
|
||||
|
||||
function getDiskUsage() {
|
||||
global $global;
|
||||
$dir = "{$global['systemRootPath']}videos/";
|
||||
$obj = new stdClass();
|
||||
$obj->disk_free_space = disk_free_space($dir);
|
||||
$obj->disk_total_space = disk_total_space($dir);
|
||||
$obj->videos_dir = getDirSize($dir);
|
||||
$obj->disk_used = $obj->disk_total_space - $obj->disk_free_space;
|
||||
$obj->disk_used_by_other = $obj->disk_used - $obj->videos_dir;
|
||||
$obj->disk_free_space_human = humanFileSize($obj->disk_free_space);
|
||||
$obj->disk_total_space_human = humanFileSize($obj->disk_total_space);
|
||||
$obj->videos_dir_human = humanFileSize($obj->videos_dir);
|
||||
$obj->disk_used_human = humanFileSize($obj->disk_used);
|
||||
$obj->disk_used_by_other_human = humanFileSize($obj->disk_used_by_other);
|
||||
// percentage of disk used
|
||||
$obj->disk_used_percentage = sprintf('%.2f', ($obj->disk_used / $obj->disk_total_space) * 100);
|
||||
$obj->videos_dir_used_percentage = sprintf('%.2f', ($obj->videos_dir / $obj->disk_total_space) * 100);
|
||||
$obj->disk_free_space_percentage = sprintf('%.2f', ($obj->disk_free_space / $obj->disk_total_space) * 100);
|
||||
|
||||
return $obj;
|
||||
}
|
||||
|
||||
function unsetSearch() {
|
||||
unset($_GET['searchPhrase']);
|
||||
|
@ -4335,3 +4385,40 @@ function ogSite() {
|
|||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function diskUsageBars() {
|
||||
ob_start();
|
||||
$getDiskUsage = getDiskUsage();
|
||||
?>
|
||||
<div class="clearfix" style="margin: 10px 12px;">
|
||||
<div class="progress" style="margin: 2px;">
|
||||
<div class="progress-bar progress-bar-success" role="progressbar" style="width:<?php echo $getDiskUsage->videos_dir_used_percentage; ?>%">
|
||||
<?php echo $getDiskUsage->videos_dir_used_percentage; ?>%
|
||||
</div>
|
||||
<div class="progress-bar progress-bar-warning" role="progressbar" style="width:<?php echo $getDiskUsage->disk_used_percentage - $getDiskUsage->videos_dir_used_percentage; ?>%">
|
||||
<?php echo $getDiskUsage->disk_used_percentage - $getDiskUsage->videos_dir_used_percentage; ?>%
|
||||
</div>
|
||||
<div class="progress-bar progress-bar-default" role="progressbar" style="width:<?php echo $getDiskUsage->disk_free_space_percentage; ?>%">
|
||||
<?php echo $getDiskUsage->disk_free_space_percentage; ?>%
|
||||
</div>
|
||||
</div>
|
||||
<div class="label label-success">
|
||||
<?php echo __("Videos Directory"); ?>: <?php echo $getDiskUsage->videos_dir_human; ?> (<?php echo $getDiskUsage->videos_dir_used_percentage; ?>%)
|
||||
</div>
|
||||
<div class="label label-warning">
|
||||
<?php echo __("Other Files"); ?>: <?php echo $getDiskUsage->disk_used_human; ?> (<?php echo $getDiskUsage->disk_used_percentage - $getDiskUsage->videos_dir_used_percentage; ?>%)
|
||||
</div>
|
||||
<div class="label label-primary">
|
||||
<?php echo __("Free Space"); ?>: <?php echo $getDiskUsage->disk_free_space_human; ?> (<?php echo $getDiskUsage->disk_free_space_percentage; ?>%)
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
if ($getDiskUsage->disk_free_space_percentage < 15) {
|
||||
echo "<script>$(document).ready(function () {avideoAlertHTMLText('Danger','Your Disk is almost Full, you have only <strong>{$getDiskUsage->disk_free_space_percentage}%</strong> free <br> ({$getDiskUsage->disk_free_space_human})', 'error');});</script>";
|
||||
}
|
||||
|
||||
$contents = ob_get_contents();
|
||||
ob_end_clean();
|
||||
return $contents;
|
||||
}
|
||||
|
|
@ -1,3 +1,4 @@
|
|||
|
||||
<div class="list-group-item clear clearfix">
|
||||
<ul class="nav nav-tabs">
|
||||
<li class="active"><a data-toggle="tab" href="#dashboard"><i class="fas fa-tachometer-alt"></i> <?php echo __("Dashboard"); ?></a></li>
|
||||
|
@ -10,6 +11,7 @@
|
|||
<div class="tab-content">
|
||||
<div id="dashboard" class="tab-pane fade in active" style="padding: 10px;">
|
||||
<?php
|
||||
echo diskUsageBars();
|
||||
include $global['systemRootPath'] . 'view/report0.php';
|
||||
?>
|
||||
</div>
|
||||
|
|
|
@ -571,8 +571,19 @@ function playerPlay(currentTime) {
|
|||
}
|
||||
});
|
||||
}
|
||||
$("#mainVideo .vjs-volume-panel").attr("data-toggle","tooltip");
|
||||
$("#mainVideo .vjs-volume-panel").attr("title","Click to activate the sound");
|
||||
$('#mainVideo .vjs-volume-panel[data-toggle="tooltip"]').tooltip('show');
|
||||
player.userActive(true);
|
||||
setTimeout(function () {
|
||||
player.userActive(true);
|
||||
}, 1000);
|
||||
setTimeout(function () {
|
||||
player.userActive(true);
|
||||
}, 1500);
|
||||
setTimeout(function () {
|
||||
$("#allowAutoplay").load(webSiteRootURL + "plugin/PlayerSkins/allowAutoplay/");
|
||||
player.userActive(true);
|
||||
}, 500);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -127,6 +127,9 @@
|
|||
?>
|
||||
</small>
|
||||
<?php
|
||||
if (User::isAdmin()) {
|
||||
echo diskUsageBars();
|
||||
}
|
||||
if (!empty($global['videoStorageLimitMinutes'])) {
|
||||
$secondsLimit = $global['videoStorageLimitMinutes'] * 60;
|
||||
if ($secondsLimit > $secondsTotal) {
|
||||
|
|
|
@ -51,6 +51,8 @@ if (file_exists($path)) {
|
|||
header("Content-type: " . mime_content_type($path));
|
||||
header('Content-Length: ' . filesize($path));
|
||||
if (!empty($advancedCustom->doNotUseXsendFile)) {
|
||||
ini_set('memory_limit', filesize($path)*1.5);
|
||||
_error_log("Your XSEND File is not enabled, it may slowdown your site, file = $path", AVideoLog::$WARNING);
|
||||
//echo url_get_contents($path);
|
||||
// stream the file
|
||||
$fp = fopen($path, 'rb');
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue