Generate Cron File
This commit is contained in:
@@ -101,8 +101,13 @@ class Feed extends PhpObject {
|
||||
}
|
||||
|
||||
public function checkUpdateFeed($sProjectMode) {
|
||||
//Feed updated once every hour in Blog Mode
|
||||
if($sProjectMode == Project::MODE_BLOG && date('Y-m-d-H', $this->iLastUpdate) != date('Y-m-d-H')) $this->updateFeed();
|
||||
//Feed updated once every hour in Blog Mode (no need for timezone when substracting 2 dates)
|
||||
if($sProjectMode == Project::MODE_BLOG) {
|
||||
$oLastUpdate = new DateTime('@'.$this->iLastUpdate);
|
||||
$oNow = new DateTime('now');
|
||||
|
||||
if(intval($oNow->diff($oLastUpdate)->format('%H')) > 0) $this->updateFeed();
|
||||
}
|
||||
}
|
||||
|
||||
private function updateFeed() {
|
||||
|
||||
10
inc/spot.php
10
inc/spot.php
@@ -140,7 +140,9 @@ class Spot extends Main
|
||||
),
|
||||
'consts' => array(
|
||||
'geo_server' => Settings::GEO_SERVER,
|
||||
'modes' => Project::MODES )
|
||||
'modes' => Project::MODES,
|
||||
'default_timezone' => Settings::TIMEZONE
|
||||
)
|
||||
),
|
||||
'index',
|
||||
array(
|
||||
@@ -169,6 +171,12 @@ class Spot extends Main
|
||||
}
|
||||
}
|
||||
|
||||
public function genCronFile() {
|
||||
//$bResult = (file_put_contents('spot_cron.sh', '#!/bin/bash'."\n".'cd '.dirname($_SERVER['SCRIPT_FILENAME'])."\n".'php -f index.php a=update_feed')!==false);
|
||||
$bResult = (file_put_contents('spot_cron.sh', '#!/bin/bash'."\n".'wget -qO- '.$this->asContext['serv_name'].'index.php?a=dummy > /dev/null')!==false);
|
||||
return $bResult?self::SUCCESS:self::ERROR;
|
||||
}
|
||||
|
||||
public function getMarkers()
|
||||
{
|
||||
$asMessages = $this->getSpotMessages();
|
||||
|
||||
Reference in New Issue
Block a user