Hi,

The main idea is to see all the files, not just the related ones on the custom field, however the amount of files can be by thousands, so the idea is filter the auto-complete field with the extensions configured previously on file field section "Permitted upload file extensions", thus you'll have a list of "jpg, png" if you want.

Jason.

Comments

quicksketch’s picture

Thanks, this seems like a good idea. I was worried about more LIKE statements increasing SQL query time, but it doesn't look like it has any significant effect on the query time adding additional LIKEs. Code needs a bit more cleaning up though to match coding standard, but I can probably clean this up next time I'm working on FileField Sources.

tatewaky’s picture

Missing validation to enable use of files on Drupal that not belongs to the node of the specific content type.

tatewaky’s picture

Missing validation to enable use of files on Drupal that not belongs to the node of the specific content type.

quicksketch’s picture

Status: Needs review » Needs work

Missing validation to enable use of files on Drupal that not belongs to the node of the specific content type.

The new change is not related and something that absolutely cannot be included (in this patch or otherwise). It would effectively turn off deletion of all files in all of Drupal.

tatewaky’s picture

Hi quicksketch,

would you please explain to me your point, i would like to know what i'm doing wrong.

Thanks in advance

quicksketch’s picture

+/*
+ * This hook does nothing more than return an counter with 1 as value, this is because
+ * we allow the user to upload files with no node associations working with file import module and filefield
+ */
+function filefield_sources_file_references(){
+    return array('filefield_sources' => 1);
+}

hook_file_references() is used to check if a file may be deleted. This additional hook makes it so that FileField Sources claims that it is using every file in Drupal no matter what, effectively making it so FileField will never let any file be deleted. Modules should only claim usage on a file if they were the module responsible for uploading it. For FileField Sources, it's merely a tool to provide alternative mechanisms for FileField (which implements hook_file_references() already).

quicksketch’s picture

Component: Code » General
Status: Needs work » Closed (won't fix)

If you're still interested in rerolling the original patch I'll take a look, but the idea of making all files in the entire files table available is not feasible for security reasons.

tatewaky’s picture

i am, what should i do from now?