Skip to content

Instantly share code, notes, and snippets.

@CDRO
Created February 21, 2018 12:53
Show Gist options
  • Save CDRO/d4b1863486864ff3366b1fbdded1b6d5 to your computer and use it in GitHub Desktop.
Save CDRO/d4b1863486864ff3366b1fbdded1b6d5 to your computer and use it in GitHub Desktop.
TYPO3 check if fe_users have valid images
<?php
/**
* Either execute the script on the shell or directly in the browser.
* Place the script in the webroot and call it.
*/
if(php_sapi_name() !== 'cli') {
echo '<pre>';
}
echo 'Connecting', PHP_EOL;
$m = new mysqli('localhost', 'name', '***', 'db');
$query = 'SELECT image FROM fe_users WHERE image IS NOT NULL';
echo 'Selecting:', PHP_EOL, $query, PHP_EOL;
$r = $m->query($query);
echo $m->error;
while($row = $r->fetch_assoc()) {
echo 'File: ', $row['image'], (file_exists('uploads/pics/' . $row['image']) ? '' : ' does not'), ' exist', PHP_EOL;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment