Created
September 19, 2023 08:30
-
-
Save tguruslan/7e0266105920f979dc01a62255671ed4 to your computer and use it in GitHub Desktop.
Пошук великиз файлів в мудлі
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Параметри для підключення до MySQL серверу | |
$servername = "127.0.0.1"; | |
$username = ""; | |
$password = ""; | |
$db = ""; | |
// Підключення до MySQL серверу | |
$conn = mysqli_connect($servername, $username, $password); | |
mysqli_select_db($conn, $db); | |
$fp1 = fopen('big_files_'.$db.'.csv', 'w'); | |
$result = mysqli_query($conn, "SELECT DISTINCT filename, filepath, FORMAT( (filesize /1024 /1024), 1 ) AS filesize_MB, contenthash, author, (SELECT concat(lastname,' ',firstname) FROM mdl_user WHERE id=mdl_files.userid) as pib, component FROM mdl_files ORDER BY filesize DESC LIMIT 0 , 50"); | |
// Перебір кожної бази даних | |
while ($row = mysqli_fetch_assoc($result)) { | |
fputcsv($fp1, $row); | |
} | |
fclose($fp1); | |
// Закриття підключення до MySQL серверу | |
mysqli_close($conn); | |
echo "Результати в big_files_".$db.".csv"; | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment