The PHP notice indicated on the Recent log messages whenever admin/content/file is accessed is as below,
Notice: Undefined property: stdClass::$total_count in file_entity_admin_files() (line 400 of /var/aegir/platforms/myplatform/sites/all/modules/contrib/file_entity/file_entity.admin.inc).
Releavant code snippet,
$options[$file->fid] = array(
'title' => array(
'data' => array(
'#type' => 'link',
'#title' => $file->filename,
'#href' => 'file/' . $file->fid,
),
),
'type' => $file_type ? check_plain($file_type->label) : FILE_TYPE_NONE,
'size' => format_size($file->filesize),
'author' => theme('username', array('account' => $account)),
'timestamp' => format_date($file->timestamp, 'short'),
'usage' => format_plural((int) $result[$file->fid]->total_count, '1 place', '@count places'),
);
[105] => stdClass Object
(
[fid] => 105
[uid] => 18
[total_count] => 1
)[106] => stdClass Object
(
[fid] => 106
[uid] => 18
[total_count] => 1
)[134] => stdClass Object
(
[fid] => 134
[uid] => 18
)[135] => stdClass Object
(
[fid] => 135
[uid] => 18
)
total_count attribute in $result[$file->fid]->total_count is assumed to have set always but it is not the case. Adding an isset() check fixed the issue for me.
Comments
Comment #2
joseph.olstadPlease write a patch as follows:
add this line one line above
$options.....blah
so:
Then replace this line:
with this:
Comment #3
joseph.olstadplease write a patch as directed
Comment #4
lasseitorp CreditAttribution: lasseitorp commentedI believe it shoud be:
$count_usage = isset($result[$file->fid]->total_count) ? $result[$file->fid]->total_count : 0;
Otherwise it works like a charm!
KD
Comment #6
joseph.olstad