Updated: Comment #15
Problem/Motivation
I have sat down and had a play with this module, and have managed to fix everything I knew of (possible exception being the new issue #1896162: File Alias URL Doesn't respect Private File Field Settings).
The attached patch should be applied against the current 7.x-1.x-dev dated 2011-Nov-15.
There are a few issues with File (Field) Paths 7.x-1.0-beta3, so I worked against 7.x-1.x-dev dated 2012-Aug-10. It appears to function correctly and has some usability tweaks, so I recommend it. This patch may not work with beta-3 (haven't tested).
I am using Drupal 7.19-dev, not that it should matter much.
Fixes in this patch include;
- #1492978: PHP Fatal error: Cannot use object of type stdClass as array in /../sites/all/modules/filefield_paths.inc on line 33, error no longer occurs.
- #841044: File Aliases remain after deleting/removing files from FileFields, old aliases are deleted when removing a file.
- #1378932: url aliases remain on uninstall, aliases are deleted when uninstalling the module.
- #1365384: Files can no longer be deleted from server when deleting a node., files delete correctly (problem was Drupal would try delete the file from the alias location, not the physical location).
- #1190262: Install broken: still using d6 table schema, installs correctly.
- #1557984: Errors if the file does not have an alias set, this is no longer a problem. Also a new feature that you can leave the alias field empty for no alias (this is per field, not per file/image).
Proposed resolution
See attached patch.
Remaining tasks
So I have tested everything I can think of re files on nodes (adding, changing aliases, removing files, deleting nodes with files etc). I have not tested any views functionality etc, nor anything re private files (again, referring to #1896162: File Alias URL Doesn't respect Private File Field Settings). Please test and let me know how you get on.
This module along with File (Field) Paths module do not have great support at the moment, so it might be a good idea to merge these modules together in the future as a new module, so support will be better.
Comment | File | Size | Author |
---|---|---|---|
#5 | 7.x-2.x-dev-2.patch | 12.35 KB | neRok |
file_aliases-7.x-2.x-dev-1.patch | 8.73 KB | neRok | |
Comments
Comment #1
kclarkson CreditAttribution: kclarkson commentedneRok,
You are really kicking butt on this module so thank you !!! It may make sense to ask if you can be a maintainer :)
I attempted to apply the patch using git apply -v and here are the errors I am receiving:
git apply -v file_aliases-7.x-2.x-dev-1.patch
file_aliases-7.x-2.x-dev-1.patch:59: trailing whitespace.
db_query("DELETE FROM {url_alias} WHERE source LIKE 'filefield_paths/alias/%%'");
file_aliases-7.x-2.x-dev-1.patch:85: trailing whitespace.
* Implements hook_file_delete().
file_aliases-7.x-2.x-dev-1.patch:86: trailing whitespace.
*/
file_aliases-7.x-2.x-dev-1.patch:87: trailing whitespace.
function file_aliases_file_delete($file) {
file_aliases-7.x-2.x-dev-1.patch:88: trailing whitespace.
$filefield_paths_alias = "filefield_paths/alias/{$file->fid}";
Checking patch CHANGELOG.txt...
Checking patch file_aliases.info...
warning: file_aliases.info has type 100644, expected 100755
error: while searching for:
files[] = file_aliases.install
files[] = file_aliases.module
files[] = modules/filefield_paths.inc
error: patch failed: file_aliases.info:7
error: file_aliases.info: patch does not apply
Checking patch file_aliases.install...
Checking patch file_aliases.module...
Checking patch modules/filefield_paths.inc...
Comment #2
yannickooThe patch should based on the version from the repository and not the current development version because Drupal.org adds some additional info to the .info file.
Comment #3
neRok CreditAttribution: neRok commentedI will have another play tomorrow. Its my first real try at a patch.
yannickoo, can you elaborate a bit more? I went to http://drupal.org/project/file_aliases/git-instructions and used git to grab the master, which gave me the latest version 7 dev. I presumed that was what I needed?!
Comment #4
yannickooOh okay, then you are right with your way. First patch cool!
Comment #5
neRok CreditAttribution: neRok commentedThe patch wouldnt apply on my machine either. Had to make a local topic branch upon the cloned repository as explained here: http://drupal.org/node/1054616
Anyway, tweaked patch attached. It applies on my machine, but git does come up with some warnings re file permissions. A quick google search revealed this is just a quirk of using gitbash on windows, and isnt a problem.
Comment #6
Albert Volkman CreditAttribution: Albert Volkman commentedThis resolves the issues with current dev.
Comment #7
DamienMcKenna@neRok: You need to re-create the patch after changing your text editor to save all files in UNIX format rather than DOS/Windows format, please check the Drupal Coding Standards if you aren't familiar with that requirement.
Comment #8
neRok CreditAttribution: neRok commentedIt is. If you look at the patch, it removes the entire contents of modified files such as file_aliases.module because they were windows endings, and replaces them with unix endings.
Should I open every file and do the same (change the endings), even if there are no other problems/changes in those files? It will become a big patch.
Comment #9
DamienMcKenna@neRok: Oh, I just saw that Nano was complaining about line endings changing. If you didn't mind, I recommend separating the two tasks (fix line endings, fix the code) into two patches, so that the actual code changes can be reviewed for what they are, rather than being lost in the mess of line changes.
Comment #10
Albert Volkman CreditAttribution: Albert Volkman commentedCreated sub-task #1909040: Convert to Unix line endings.
Comment #11
Deciphered CreditAttribution: Deciphered commentedWhile I appreciate the thought of a combined patch, it does mean I'm unable to give each individual contributor their due credit for their individual patches. I will instead treat this issue as a meta-issue, which I truly appreciate.
Comment #12
neRok CreditAttribution: neRok commentedA lot of the issues are intertwined. I actually did the whole patch on my own - but I am not interested in credit anyway. It would be good to see a working version of this module on drupal.org though!
Comment #13
kitikonti CreditAttribution: kitikonti commentedi could not get it work. i tryed the first patch, i tryed the patch from #5, i tryed them both the same time and i tryed it in combination with the patch from #10 https://drupal.org/node/1909040. but i get allways error on patch apply.
how could i get a working copy of this module? which module Version i should download for patching? Which Patches i should download and in which order i should apply them?
Or is there a way to just make the dev Version of this module working? this would be the simplest solution.
But anyway thx for all your work on These patches.
Comment #13.0
kitikonti CreditAttribution: kitikonti commentedQuick typo fix.
Comment #14
jay.lee.bio CreditAttribution: jay.lee.bio commentedIn my case, once I enabled this module and then disabled it due to error messages & its current general instability, FileField Paths itself stopped working completely. I tried everything I could think of (including uninstalling & deleting both modules and reinstalling FileField Paths, creating a new image field, emptying cache, emptying browser cache, etc.), but the "Enable File (Field) Paths?" field that I should be able to check no longer appears anywhere whatsoever. Maybe it's conflicting with some other module that I'm not aware of, but for now I strongly suggest people thoroughly test this module in a test site first before using it in a live site. I think this module has potential (I absolutely LOVE FileField Paths), and hope that a stable version will be out sometime in the near future.
Comment #15
areke CreditAttribution: areke commentedComment #16
rjensen CreditAttribution: rjensen commentedComment #17
dpintats CreditAttribution: dpintats commentedI ended up working and patching this module, without seeing the comprehensive path:
https://drupal.org/node/2256603
https://drupal.org/node/2256545
While these issues are likely resolved in the comprehensive patch, they're there anyway. Also, if the maintainer is concerned that the patch should be broken out into each issue, would it be best to do so and add each patch to each issue on their own? I can help with that if anything.
Comment #18
deanflory CreditAttribution: deanflory commentedThe patch in #5 fails with the latest 7.x-1.x-dev 2013-Sept-30 version:
Comment #19
ar-jan CreditAttribution: ar-jan commented@dpintats #17: commits are typically done on a per issue basis, so getting the patches for each individual issue in shape would be good.
Comment #20
Deciphered CreditAttribution: Deciphered commentedModule has had extensive work, marking this as fixed.