@@ 81-95 (lines=15) @@ | ||
78 | $this->initCommands(); |
|
79 | ||
80 | // Process all updates received |
|
81 | while (true) { |
|
82 | $updates = $this->getUpdates($offset, $limit, $timeout); |
|
83 | ||
84 | foreach ($updates as $key => $update) { |
|
85 | try { |
|
86 | $this->processUpdate($update); |
|
87 | } catch (BotException $e) { |
|
88 | echo $e->getMessage(); |
|
89 | } |
|
90 | } |
|
91 | ||
92 | $offset = $offset + count($updates); |
|
93 | // Update the offset in redis |
|
94 | $this->redis->set($offset_key, $offset); |
|
95 | } |
|
96 | } |
|
97 | ||
98 | /** |
|
@@ 157-172 (lines=16) @@ | ||
154 | // Prepare the query for updating the offset in the database |
|
155 | $sth = $this->pdo->prepare('UPDATE ' . $table_name . ' SET ' . $column_name . ' = :new_offset'); |
|
156 | ||
157 | while (true) { |
|
158 | $updates = $this->getUpdates($offset, $limit, $timeout); |
|
159 | ||
160 | foreach ($updates as $key => $update) { |
|
161 | try { |
|
162 | $this->processUpdate($update); |
|
163 | } catch (BotException $e) { |
|
164 | echo $e->getMessage(); |
|
165 | } |
|
166 | } |
|
167 | ||
168 | $offset = $offset + count($updates); |
|
169 | // Update the offset on the database |
|
170 | $sth->bindParam(':new_offset', $offset); |
|
171 | $sth->execute(); |
|
172 | } |
|
173 | } |
|
174 | ||
175 | /** @} */ |