/** * Returns the active SLog instance. * @return SLog */ public static function getInstance() { if (null === self::$_instance) { self::$_instance = new self(); } return self::$_instance; }
public static function updateGeoData() { global $dbconn; //$MM_version = "09-2012"; $MM_version = "07-2014"; $sql = "SELECT id, ip from s_log where ip<>'' order by id"; $result = pg_query($dbconn, $sql); $data = pg_fetch_all($result); //echo "<hr/>".$sql; //$result = pg_query_params($dbconn, $sql, array($id)) or die('Query failed: incorrect parameters'); $result = pg_query($dbconn, $sql); $data = pg_fetch_all($result); //print_r($data); echo "<br/>TOT: " . count($data); foreach ($data as $key => $value) { $geo_ip_obj = SLog::geoLocIp($value['ip'], $MM_version); //print_r($geo_ip_obj); //$geo_ip_obj_json=json_encode($geo_ip_obj); //$geo_ip_obj_serialized=serialize($geo_ip_obj); //print_r(expression) //$geo_ip_obj_serialized = str_replace("'", "\'", $geo_ip_obj_serialized); //$unS = unserialize($geo_ip_obj_serialized); //echo "<hr/>"; //print_r($unS); //echo $geo_ip_obj_json; //$updateSql = "UPDATE s_log SET mm_09_2012 = '".$geo_ip_obj_serialized."' WHERE id = ".$value['id'].";"; //$updateSql = "UPDATE s_log SET mm_07_2014 = '".$geo_ip_obj_serialized."' WHERE id = ".$value['id'].";"; $updateSql = "UPDATE s_log SET country_code = '" . $geo_ip_obj->country_code . "' WHERE id = " . $value['id'] . ";"; //$updateSql = "UPDATE s_log SET mm_07_2014 = '".$geo_ip_obj_json."' WHERE id = ".$value['id']; $result = pg_query($dbconn, $updateSql); //echo "<hr/>".$value['ip']."<br/>".$MM_version."<br/>".$updateSql; echo "\n" . $updateSql; } pg_free_result($result); pg_close($dbconn); }
<?php include '../config.php'; include '../model/SLog.php'; //SLog::renderSearchLog($_REQUEST); if (isset($_REQUEST['action']) && $_REQUEST['action'] == "filter" && $_REQUEST['date1'] != "" && $_REQUEST['date2'] != "") { $data = SLog::renderSearchLogD3($_REQUEST, true); } else { $data = SLog::renderSearchLogD3($_REQUEST, false); } //print_r($data); $slogToD3 = json_encode($data['slogDataD3']); //$slogData = json_encode($data['slogData']); //SLog::updateGeoData(); $exploreStats = json_encode(Slog::collectExploreStats()); ?> <!DOCTYPE html> <meta charset="utf-8"> <head> <link rel="stylesheet" href="//code.jquery.com/ui/1.11.0/themes/smoothness/jquery-ui.css"> <script src="//code.jquery.com/jquery-1.10.2.js"></script> <script src="//code.jquery.com/ui/1.11.0/jquery-ui.js"></script> <script> var date1= "<?php echo $data['date1']; ?> "; var date2= "<?php
private function startLog($logFileName) { $this->logFile = $this->logDir . $logFileName . ".log"; $log = new SLog(); $this->logs = $log; $log->setLogFile($this->logFile); }
private function executeLog($sql, $result) { $resultNum = count($result); $message = <<<MSG <<<<<<<<<<start call SSqlManager::execute result num is {$resultNum} SQL {$sql} >>>>>>>>>>end MSG; SLog::info($message); }
$params = new stdclass(); } if ($ret == -1) { //error } else { if ($ret) { //parent $info[$conf->app]['pid'] = $ret; } else { //child $cpid = posix_getpid(); $fname = _tmpDir() . "/crontab.pid." . $cpid; $fp = fopen($fname, "w"); if (flock($fp, LOCK_EX | LOCK_NB)) { fwrite($fp, $cpid); SLog::write("Exec {$command}"); include $command; } fclose($fp); unlink($fname); exit; } } } } pcntl_wait($c_status, WNOHANG); } } function _tmpDir() { if (!function_exists('sys_get_temp_dir')) {
/** * Get the real remote client's IP * * @return string */ public static function getClientIP() { return SLog::getInstance()->clientIP; }
<?php // This script runs only via command line include dirname(__FILE__) . "/../includes/config.inc.php"; require_once dirname(dirname(__FILE__)) . "/includes/classes/sLog.php"; define("MP4Box_BINARY", get_binaries('MP4Box')); define("FLVTool2_BINARY", get_binaries('flvtool2')); define('FFMPEG_BINARY', get_binaries('ffmpeg')); /* getting the aguments $argv[1] => first argument, in our case its the path of the file */ $log = new SLog(); //error_reporting(E_ALL); $fileName = isset($argv[1]) ? $argv[1] : false; $dosleep = isset($argv[2]) ? $argv[2] : ''; //$fileName = "/home/sajjad/Desktop/abc.mp4"; $log->newSection("Starting Conversion Log"); $log->writeLine("File to be converted", $fileName, false); $status = "Successful"; /* Getting the videos which are currently in our queue waiting for conversion */ if (isset($_GET['test'])) { $queue_details = get_queued_video(false, $fileName); } else { $queue_details = get_queued_video(TRUE, $fileName); } $fileDir = $queue_details["date_added"]; $dateAdded = explode(" ", $fileDir);