OP 要求从数据库中获取此信息,其他海报提供了有关如何使用 PHP 从 moodle 获取信息的提示 - 但如果您无法访问 moodle 代码,这就是这样做的方法..
您需要先找到示例中用户 id (3) 的实例 ID。
然后您需要在文件表中搜索实例 ID /user/icon/f/f[1-3].[jpg|png] 的哈希值
此查询将按大小顺序给出所有文件,其中最大的文件在前。
第一列 file_path 将是相对于您服务器上的 moodle 文件的文件路径。查看 config.php 以获取 $CFG->dataroot 的位置。
select @instanceID := id instance_id
from mdl_context where contextlevel = 30 and instanceid = 3; # instanceid = 3 is user id 3
select @instanceID; # check it is present.
;
SELECT concat(left(f.contenthash,2),"/",substring(f.contenthash,3,2),"/",f.contenthash) file_path, f.pathnamehash, timecreated, filename, f.*
FROM mdl_files f
LEFT JOIN mdl_files_reference r ON f.referencefileid = r.id
WHERE f.pathnamehash in(
sha1(concat("/",@instanceID,"/user/icon/0/f1.jpg")),
sha1(concat("/",@instanceID,"/user/icon/0/f2.jpg")),
sha1(concat("/",@instanceID,"/user/icon/0/f3.jpg")),
sha1(concat("/",@instanceID,"/user/icon/0/f1.png")),
sha1(concat("/",@instanceID,"/user/icon/0/f2.png")),
sha1(concat("/",@instanceID,"/user/icon/0/f3.png")))
order by timecreated desc, filename desc