|
@@ 243-263 (lines=21) @@
|
| 240 |
|
* @return Response |
| 241 |
|
* @Route("/dbQueries1/{days}", name="support_db_queries_1") |
| 242 |
|
*/ |
| 243 |
|
public function executeSQL_caches_old_reg_date(int $days = 31) // List caches from users whose registration date is not older than x days. |
| 244 |
|
: Response |
| 245 |
|
{ |
| 246 |
|
$formSearch = $this->createForm(SupportSearchCaches::class); |
| 247 |
|
|
| 248 |
|
$qb = $this->connection->createQueryBuilder(); |
| 249 |
|
$qb->select('caches.name', 'user.username', 'user.date_created', 'user.last_login') |
| 250 |
|
->from('caches') |
| 251 |
|
->innerJoin('caches', 'user', 'user', 'caches.user_id = user.user_id') |
| 252 |
|
->where('user.date_created > now() - interval :searchTerm DAY') |
| 253 |
|
->andWhere('caches.user_id = user.user_id') |
| 254 |
|
->setParameters(['searchTerm' => $days]) |
| 255 |
|
->orderBy('date_created', 'DESC'); |
| 256 |
|
|
| 257 |
|
return $this->render( |
| 258 |
|
'backend/support/databaseQueries.html.twig', [ |
| 259 |
|
'supportCachesForm' => $formSearch->createView(), |
| 260 |
|
'suppSQLquery1' => $qb->execute()->fetchAll() |
| 261 |
|
] |
| 262 |
|
); |
| 263 |
|
} |
| 264 |
|
|
| 265 |
|
/** |
| 266 |
|
* @param int $days |
|
@@ 295-317 (lines=23) @@
|
| 292 |
|
* @return Response |
| 293 |
|
* @Route("/dbQueries4", name="support_db_queries_4") |
| 294 |
|
*/ |
| 295 |
|
public function executeSQL_caches_old_login_date( |
| 296 |
|
) // List (non-archived, non-locked) caches from users whose last login date is older than one year. |
| 297 |
|
: Response |
| 298 |
|
{ |
| 299 |
|
$formSearch = $this->createForm(SupportSearchCaches::class); |
| 300 |
|
|
| 301 |
|
$qb = $this->connection->createQueryBuilder(); |
| 302 |
|
$qb->select('caches.name', 'caches.cache_id', 'caches.status', 'user.username', 'user.last_login') |
| 303 |
|
->from('caches') |
| 304 |
|
->innerJoin('caches', 'user', 'user', 'caches.user_id = user.user_id') |
| 305 |
|
->where('user.last_login < now() - interval :searchTerm YEAR') |
| 306 |
|
->andWhere('caches.status <= 2') |
| 307 |
|
->andWhere(('caches.user_id = user.user_id')) |
| 308 |
|
->setParameters(['searchTerm' => 1]) |
| 309 |
|
->orderBy('user.last_login', 'ASC'); |
| 310 |
|
|
| 311 |
|
return $this->render( |
| 312 |
|
'backend/support/databaseQueries.html.twig', [ |
| 313 |
|
'supportCachesForm' => $formSearch->createView(), |
| 314 |
|
'suppSQLquery4' => $qb->execute()->fetchAll() |
| 315 |
|
] |
| 316 |
|
); |
| 317 |
|
} |
| 318 |
|
|
| 319 |
|
/** |
| 320 |
|
* @param string $what |