|
@@ -136,5 +136,27 @@ class feeds extends Conexion_Mysql {
|
136
|
136
|
return $feeds;
|
137
|
137
|
}
|
138
|
138
|
|
|
139
|
+
|
|
140
|
+ /**
|
|
141
|
+ Calculate the seconds until next update
|
|
142
|
+
|
|
143
|
+ @param $feed can be an ID, or the raw array from the DB
|
|
144
|
+ @raturn int
|
|
145
|
+ */
|
|
146
|
+ function getNextUpdate($feed){
|
|
147
|
+ if(is_numeric($feed)){
|
|
148
|
+ $id = (int)$feed;
|
|
149
|
+ }elseif(is_array($feed)){
|
|
150
|
+ $id = $feed['id_feed'];
|
|
151
|
+ }else{
|
|
152
|
+ return false;
|
|
153
|
+ }
|
|
154
|
+ $timeToUpdate = trim($this->conf->rssImportFrec). ' ago';
|
|
155
|
+ $delta = time() - strtotime($timeToUpdate);
|
|
156
|
+ $this->ejecutarConsulta('SELECT (UNIX_TIMESTAMP(updated_at) - '.$delta.') - UNIX_TIMESTAMP(NOW()) FROM '.$this->conf->tablePrefix.'feeds WHERE id_feed = '.$id);
|
|
157
|
+ $time = mysql_fetch_array($this->mid_consulta);
|
|
158
|
+ return $time[0];
|
|
159
|
+
|
|
160
|
+ }
|
139
|
161
|
}
|
140
|
162
|
?>
|