mirror of
https://github.com/DanielnetoDotCom/YouPHPTube
synced 2025-10-05 02:39:46 +02:00
update
This commit is contained in:
parent
8483867cb1
commit
49f5694d2c
2 changed files with 22 additions and 3 deletions
|
@ -2892,6 +2892,17 @@ function try_get_contents_from_local($url) {
|
|||
return false;
|
||||
}
|
||||
|
||||
function url_get_contents_with_cache($url, $lifeTime = 60, $ctx = "", $timeout = 0, $debug = false, $mantainSession = false) {
|
||||
|
||||
$cache = ObjectYPT::getCache($url, $lifeTime); // 24 hours
|
||||
if(!empty($cache)){
|
||||
return $cache;
|
||||
}
|
||||
$return = url_get_contents($url, $ctx, $timeout, $debug, $mantainSession);
|
||||
ObjectYPT::setCache($url, $return);
|
||||
return $return;
|
||||
}
|
||||
|
||||
function url_get_contents($url, $ctx = "", $timeout = 0, $debug = false, $mantainSession = false) {
|
||||
global $global, $mysqlHost, $mysqlUser, $mysqlPass, $mysqlDatabase, $mysqlPort;
|
||||
if (!isValidURLOrPath($url)) {
|
||||
|
|
|
@ -2210,14 +2210,22 @@ class SectionFirstPage
|
|||
|
||||
//$endpointURL = addQueryStringParameter($endpointURL, 'PHPSESSID', session_id());
|
||||
}
|
||||
$response = json_decode(url_get_contents($endpointURL, '', 2, false, true));
|
||||
|
||||
$endPointResponse = url_get_contents_with_cache($endpointURL, 300, '', 5, false, true);
|
||||
|
||||
$response = json_decode($endPointResponse);
|
||||
/*
|
||||
if(User::isLogged()){
|
||||
session_id($response->session_id);
|
||||
}
|
||||
*/
|
||||
if(!empty($response)){
|
||||
$this->endpointResponse = $response->response;
|
||||
$this->totalRows = $this->endpointResponse->totalRows;
|
||||
}else{
|
||||
$this->endpointResponse = new stdClass();
|
||||
$this->totalRows = 0;
|
||||
}
|
||||
$this->childs = $childs;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue