aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Alexandre Alapetite <alexandre@alapetite.fr> 2016-08-07 00:54:49 +0200
committerGravatar Alexandre Alapetite <alexandre@alapetite.fr> 2016-08-07 00:54:49 +0200
commitbee833bf524e58ea9cf5309fb89f6f8b30005720 (patch)
tree5d5db30ad0285e477e683e86d6a01ebf1ecc984a
parent4402d92f013ada8fa814a02d8ee1a6a61a7e5001 (diff)
Problematic MySQL reserved keyword
`read` and `reads` are reserved keywords
-rw-r--r--app/Models/StatsDAO.php6
-rw-r--r--app/views/stats/index.phtml12
-rw-r--r--app/views/stats/repartition.phtml8
3 files changed, 13 insertions, 13 deletions
diff --git a/app/Models/StatsDAO.php b/app/Models/StatsDAO.php
index e18ba4748..3f5bf8515 100644
--- a/app/Models/StatsDAO.php
+++ b/app/Models/StatsDAO.php
@@ -38,9 +38,9 @@ class FreshRSS_StatsDAO extends Minz_ModelPdo {
}
$sql = <<<SQL
SELECT COUNT(1) AS total,
-COUNT(1) - SUM(e.is_read) AS unread,
-SUM(e.is_read) AS read,
-SUM(e.is_favorite) AS favorite
+COUNT(1) - SUM(e.is_read) AS count_unreads,
+SUM(e.is_read) AS count_reads,
+SUM(e.is_favorite) AS count_favorites
FROM {$this->prefix}entry AS e
, {$this->prefix}feed AS f
WHERE e.id_feed = f.id
diff --git a/app/views/stats/index.phtml b/app/views/stats/index.phtml
index 0a2fbdb10..a36f812a8 100644
--- a/app/views/stats/index.phtml
+++ b/app/views/stats/index.phtml
@@ -23,18 +23,18 @@
</tr>
<tr>
<th><?php echo _t('admin.stats.status_read'); ?></th>
- <td class="numeric"><?php echo format_number($this->repartition['main_stream']['read']); ?></td>
- <td class="numeric"><?php echo format_number($this->repartition['all_feeds']['read']); ?></td>
+ <td class="numeric"><?php echo format_number($this->repartition['main_stream']['count_reads']); ?></td>
+ <td class="numeric"><?php echo format_number($this->repartition['all_feeds']['count_reads']); ?></td>
</tr>
<tr>
<th><?php echo _t('admin.stats.status_unread'); ?></th>
- <td class="numeric"><?php echo format_number($this->repartition['main_stream']['unread']); ?></td>
- <td class="numeric"><?php echo format_number($this->repartition['all_feeds']['unread']); ?></td>
+ <td class="numeric"><?php echo format_number($this->repartition['main_stream']['count_unreads']); ?></td>
+ <td class="numeric"><?php echo format_number($this->repartition['all_feeds']['count_unreads']); ?></td>
</tr>
<tr>
<th><?php echo _t('admin.stats.status_favorites'); ?></th>
- <td class="numeric"><?php echo format_number($this->repartition['main_stream']['favorite']); ?></td>
- <td class="numeric"><?php echo format_number($this->repartition['all_feeds']['favorite']); ?></td>
+ <td class="numeric"><?php echo format_number($this->repartition['main_stream']['count_favorites']); ?></td>
+ <td class="numeric"><?php echo format_number($this->repartition['all_feeds']['count_favorites']); ?></td>
</tr>
</tbody>
</table>
diff --git a/app/views/stats/repartition.phtml b/app/views/stats/repartition.phtml
index ffb2c361e..5ebcdce5a 100644
--- a/app/views/stats/repartition.phtml
+++ b/app/views/stats/repartition.phtml
@@ -12,7 +12,7 @@
if (!empty($feeds)) {
echo '<optgroup label="', $category->name(), '">';
foreach ($feeds as $feed) {
- if ($this->feed && $feed->id() == $this->feed->id()){
+ if ($this->feed && $feed->id() == $this->feed->id()) {
echo '<option value="', $feed->id(), '" selected="selected" data-url="', _url('stats', 'repartition', 'id', $feed->id()), '">', $feed->name(), '</option>';
} else {
echo '<option value="', $feed->id(), '" data-url="', _url('stats', 'repartition', 'id', $feed->id()), '">', $feed->name(), '</option>';
@@ -39,9 +39,9 @@
</tr>
<tr>
<td class="numeric"><?php echo $this->repartition['total']; ?></td>
- <td class="numeric"><?php echo $this->repartition['read']; ?></td>
- <td class="numeric"><?php echo $this->repartition['unread']; ?></td>
- <td class="numeric"><?php echo $this->repartition['favorite']; ?></td>
+ <td class="numeric"><?php echo $this->repartition['count_reads']; ?></td>
+ <td class="numeric"><?php echo $this->repartition['count_unreads']; ?></td>
+ <td class="numeric"><?php echo $this->repartition['count_favorites']; ?></td>
</tr>
</table>
</div>