+ /**
+ * Get all topics that either expired or expire soon
+ *
+ * @return \PDOStatement Result iterator
+ */
+ public function getExpiring()
+ {
+ $stmt = $this->db->prepare(
+ 'SELECT * FROM subscriptions'
+ . ' WHERE sub_status IN ("active", "expired")'
+ . ' AND DATEDIFF(sub_expires, NOW()) <= 2'
+ );
+ $stmt->execute();
+
+ return $stmt;
+ }
+