modules/system/system.api.php, 1172行
报告一个文件被一个模块引用多少次.
这个钩子被调用来确定如果文件正在使用中。多个模块可参照相同的文件,并防止一个删除的文件所使用的另一种钩子被调用.
@see upload_file_references()
$file The file object being checked for references.
If the module uses this file return an array with the module name as the key and the value the number of times the file is used.
<?php function hook_file_references($file) { // If upload.module is still using a file, do not let other modules delete it. $count = db_query('SELECT COUNT(*) FROM {upload} WHERE fid = :fid', array(':fid' => $file->fid))->fetchField(); if ($count) { // Return the name of the module and how many references it has to the file. return array('upload' => $count); } } ?>
1 周 6 天之前
3 周 3 天之前
3 周 3 天之前
3 周 3 天之前
5 周 3 天之前
5 周 3 天之前
7 周 3 天之前
7 周 3 天之前
7 周 3 天之前
7 周 3 天之前