[RFC] attached_file hook

Request hook events and what data needs to be sent for the new hook system.
Post Reply
AgustinL
Registered User
Posts: 6
Joined: Wed Oct 20, 2010 3:27 pm

[RFC] attached_file hook

Post by AgustinL »

Name: hook_attached_file
Rationale: If we need to parse some extra-information of a file uploaded using the attachment system, for example: count of files included in a .zip file, author information of a .docx file, ID3 tags of and mp3 file, we need to do a parse of the file.
Placement:

includes/message_parser.php

Before:

Code: Select all

$this->attachment_data = array_merge(array(0 => $new_entry), $this->attachment_data);
(around line 1414)

and again before the same code around line 1523
-------------------------------

includes/functions_content.php (for display parsed information in post body)

Code: Select all

$block_array += array(
						'S_FILE'		=> true,
					);
					break;

Input arguments: $filedata array
Output format: An array[key,value] of the parsed information
Last edited by AgustinL on Tue Jan 24, 2012 8:24 pm, edited 2 times in total.
phpBB.com User: mandrake88

splitice
Registered User
Posts: 5
Joined: Fri Feb 06, 2009 5:39 am

Re: attached_file hook

Post by splitice »

I second the need for this hook.

AgustinL
Registered User
Posts: 6
Joined: Wed Oct 20, 2010 3:27 pm

Re: [RFC] attached_file hook

Post by AgustinL »

I wish to add another placement for this hook.

When performing the removal of an attachment, we need to remove (if exist) the stored parsed data of the file.

The hook point should be in the file includes/functions_admin.php, at function delete_attachments(). And will need the attach_id as input.
phpBB.com User: mandrake88

Post Reply