HEX
Server: Apache
System: Linux msm5694.mjhst.com 3.10.0-1160.119.1.el7.x86_64 #1 SMP Tue Jun 4 14:43:51 UTC 2024 x86_64
User: camjab_ssh (1000)
PHP: 5.3.29
Disabled: NONE
Upload Files
File: /home/httpd/html/baretube.com.new/admin/scraper_stats.php
<?php
include_once 'db.php';

if (!isset($_SESSION['isAdmin'])) {
    die();
}

if (isset($_GET['reset']) || isset($_GET['start'])) {
    ini_set('default_socket_timeout', 24000);
    ignore_user_abort();
    //shell_exec("pkill -f encoder_cron.php");

 

    $return = backgroundProcess("$php_path $basepath/admin/scraper_cron.php", "scraper_log.txt");
    dbQuery("UPDATE `status` SET `scraper_running` = 0, `scraper_done` = 0", false);
    setMessage('Scraper has been ' . ($_GET['reset'] ? 're' : '') . 'started with PID: ' . trim($return) . '.');
	 dbQuery("UPDATE `status` SET `scraper_pid` = '$return'", false);
    header("Location: $_SERVER[HTTP_REFERER]");
    exit;
}

$scraperStatus = dbRow("SELECT * FROM `status`");
$scraperLeft = dbValue("SELECT COUNT(`record_num`) AS `count` FROM `scraper_import` WHERE `approved` = 1", 'count');
$scraperPercent = ($scraperStatus['scraper_total'] > 0) ? round(($scraperStatus['scraper_done'] / $scraperStatus['scraper_total']) * 100) : 0;
?>
<?php if ($scraperStatus['scraper_running'] == 1) { ?>
    <h2>Scraper Stats</h2>
    <div class="content">
        <div class="msg success">Scraper is currently running!</div>
        <div class="progress-bar"><span style="width:<?php echo $scraperPercent; ?>%"><i><? echo $scraperPercent; ?>%</i></span></div>
        <div class="queue-processing" style='height: 25px; border-bottom: none;'>Processing Video: <b><?php echo $scraperStatus['scraper_done'] + 1; ?></b> of <b><?php echo $scraperStatus['scraper_total']; ?></b></div>
		<div class="queue-processing" style='height: 25px; border-bottom: none; font-size: 11px;' >
		<strong>URL:</strong> <input style='border: none; background-color: #f6f6f7; width: 80%; font-size: 11px;' type='text' readonly value='<? echo $scraperStatus['scraper_processing']; ?>'><br>
		
		</div>
		<? if($scraperStatus['scraper_processing_output']) { ?>
		<div class="queue-processing" style='line-height: 25px; height: 25px; font-size: 11px;' >
		<strong>Output File Size:</strong>
		<? 
		if(file_exists($scraperStatus['scraper_processing_output'])) { 
			echo number_format(round(filesize($scraperStatus['scraper_processing_output'])/1024)) ." kbytes";
		} elseif(file_exists($scraperStatus['scraper_processing_output'].'.part')) { 
			echo number_format(round(filesize($scraperStatus['scraper_processing_output'].'.part')/1024)) ." kbytes";		} 
		?>
		<? } ?>
		
		</div>
        <a href="<?php echo $basehttp; ?>/admin/scraper_stats.php?reset=1" class="btn red">Restart Scraper</a>
        <div class="encoder-links" style="margin-top: 12px;">
            <a href="<?php echo $basehttp; ?>/admin/scraper_queue.php" style="display: inline-block;padding: 4px 12px;background-color: #dbdddf;color: #484b57;">Scraper Queue</a>
        </div>
    </div>
<?php } else if ($scraperLeft > 0) { ?>
    <h2>Scraper Stats</h2>
    <div class="content">
        <div class="msg error">Scraper is not running!</div>
        <div class="queue-processing">Videos in Queue: <b><?php echo $scraperLeft; ?></b></div>
        <a href="<?php echo $basehttp; ?>/admin/scraper_stats.php?start=1" class="btn red">Start Encoder</a>
    </div>
<?php } ?>