|
@@ 165-178 (lines=14) @@
|
| 162 |
|
* @return Response |
| 163 |
|
* @Route("/dbQueries1/{days}", name="support_db_queries_1") |
| 164 |
|
*/ |
| 165 |
|
public function executeSQL_caches_old_reg_date(int $days = 31) // List caches from users whose registration date is not older than x days. |
| 166 |
|
: Response |
| 167 |
|
{ |
| 168 |
|
$qb = $this->connection->createQueryBuilder(); |
| 169 |
|
$qb->select('caches.name', 'user.username', 'user.date_created', 'user.last_login') |
| 170 |
|
->from('caches') |
| 171 |
|
->innerJoin('caches', 'user', 'user', 'caches.user_id = user.user_id') |
| 172 |
|
->where('user.date_created > now() - interval :searchTerm DAY') |
| 173 |
|
->andWhere('caches.user_id = user.user_id') |
| 174 |
|
->setParameters(['searchTerm' => $days]) |
| 175 |
|
->orderBy('date_created', 'DESC'); |
| 176 |
|
|
| 177 |
|
return $this->render('backend/support/databaseQueries.html.twig', ['suppSQLquery1' => $qb->execute()->fetchAll()]); |
| 178 |
|
} |
| 179 |
|
|
| 180 |
|
/** |
| 181 |
|
* @param int $days |
|
@@ 203-218 (lines=16) @@
|
| 200 |
|
* @return Response |
| 201 |
|
* @Route("/dbQueries4", name="support_db_queries_4") |
| 202 |
|
*/ |
| 203 |
|
public function executeSQL_caches_old_login_date( |
| 204 |
|
) // List (non-archived, non-locked) caches from users whose last login date is older than one year. |
| 205 |
|
: Response |
| 206 |
|
{ |
| 207 |
|
$qb = $this->connection->createQueryBuilder(); |
| 208 |
|
$qb->select('caches.name', 'caches.cache_id', 'caches.status', 'user.username', 'user.last_login') |
| 209 |
|
->from('caches') |
| 210 |
|
->innerJoin('caches', 'user', 'user', 'caches.user_id = user.user_id') |
| 211 |
|
->where('user.last_login < now() - interval :searchTerm YEAR') |
| 212 |
|
->andWhere('caches.status <= 2') |
| 213 |
|
->andWhere(('caches.user_id = user.user_id')) |
| 214 |
|
->setParameters(['searchTerm' => 1]) |
| 215 |
|
->orderBy('user.last_login', 'ASC'); |
| 216 |
|
|
| 217 |
|
return $this->render('backend/support/databaseQueries.html.twig', ['suppSQLquery4' => $qb->execute()->fetchAll()]); |
| 218 |
|
} |
| 219 |
|
|
| 220 |
|
/** |
| 221 |
|
* @param string $what |