Closed (won't fix)
Project:
Drupal.org security advisory coverage applications
Component:
module
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Reporter:
Created:
6 Oct 2011 at 16:24 UTC
Updated:
31 Aug 2018 at 17:23 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
dave reidNeeds a link to your sandbox in order to review.
Also just want to check if you've had a chance to review some existing modules to see if you could either extend them?
http://drupal.org/project/upload_replace
http://drupal.org/project/media_update
Comment #2
brunogoossens commentedSandbox link: http://drupal.org/sandbox/brunogoossens/1301372
Review first module: This module does not give a solution for replacing files and keeping the same file id. It just handles file names.
Review second module: I didn't fully tested this module but i thing this is for media fields. I made the module for the file field.
Comment #3
sreynen commentedHi brunogoossens,
You should add those description of the module differences to the project page, to help users understand more specifically when they'd want to use your module vs. similar options.
Some code issues:
'#description' => t(''),If there's no description, this whole line should be removed.t('Allowed extention: ' . $extention);Correct spelling: extension. More improtantly, you shouldn't include variables directly in t(), since that makes translation difficult/impossible. See documentation for how to use placeholders in t().unlink(drupal_realpath($old_file_uri));This should use drupal_unlink, which apparently works better on Windows.Please set this back to "needs work" when those issues are fixed.
Comment #4
brunogoossens commentedHey Sreynen,
Thanks for the good review.
Here are the changes that I have made:
It was not clear to you why file_replace_form_file_replace_form_alter() exists. Well, the file upload widget has an ajax callback. The form rebuilds at this moment and I get a wrong arg(2). With this alter, I set my form_state and doesn't lose my initial value. I added this in the comments of the function.
Comment #5
klausiReview of the 7.x-1.x branch:
This automated report was generated with PAReview.sh, your friendly project application review script. Please report any bugs to klausi.
Comment #6
brunogoossens commentedHey Klausi,
Thank you for reviewing my code.
Here are the changes I have made:
1. Added README.txt
2. Coder issues fixed
3. @file block added
4. Comment space added
Comment #7
klausiReview of the 7.x-1.x branch:
This automated report was generated with PAReview.sh, your friendly project application review script. Please report any bugs to klausi.
Comment #8
brunogoossens commentedHey Klausi,
Thank you for reviewing my code again.
Here are the changes I have made:
* Added coding standards and tested with PAReview.sh.
What should I do to get a full project?
Comment #9
doitDave commentedAutomated review (Please keep in mind that this is primarily a high level check that does not replace but, after all, eases the review process. There is no guarantee that no other issues could show up in a more in-depth manual follow-up review.)
Review of the 7.x-1.x branch:
This automated report was generated with PAReview.sh, your friendly project application review script. Go and review some other project applications, so we can get back to yours sooner.
Manual additions:
HTH,dave
Comment #10
brunogoossens commentedHere are the changes I have made:
* Added coding standards
Comment #11
phoenix commentedHi Bruno
I did a a review and saw these problems:
- Replace the require_once to load your inc file with drupal_module_include
- Why do you pass the $fid in function file_replace_page($fid)? As you're not doing anything with $fid.
- Your master branch still contains files other than a README.txt, and there's no README.txt in the master branch: follow step 5 on this page
- Each file must contain only one blank line, you have two blank lines at the end of each file.
- This is bad practice:
t('Allowed extention') . ': ' . $extention;Please use placeholders! This should be changed to:
By doing this, $extension will be sanitized. As this is user input, and could possibly be dangerous and lead to XSS problems.
- The select query should become a dynamic query. I see that you're looking into it. So, I don't see this so much as a problem.
- In file_replace_attached_content($fid) the return statements are way too long. The number of characters on a line must be limited to 80 for readability purposes.
Comment #12
btopro commentedhttp://drupal.org/project/coder_tough_love can help as well. Didn't realize this was such a strict process for something like line length, esp since tough love says 80 line length is for comments
Comment #13
sreynen commentedNot every issue mentioned here is a blocking issue. The non-blocking issues, such as line length, are mentioned to help new contributors understand community norms, which aren't always requirements to follow, just helpful. We're not always as clear as we could be on that distinction.
Comment #14
komlenic commentedThis patch fixes all in #11, except for the select query being transformed to a dynamic query, which I believe should not be a blocking issue. I don't believe I have permission to push changes here, so I'm attaching the patch instead. It should be a trivial matter to remove all the files from the master branch, with the exception of a README.txt as @phoenix linked to. I'm new to contributing so if I did something stupid, I'm sure someone will let me know.
@brunogoossens As we discussed I also have some other changes/features that might be valuable to merge into the module, but I'd like to see this move out of the sandbox first with the basic functionality. I'm already relying on this module as a critical part of our workflow - thanks again.
Comment #15
brunogoossens commentedI've added the code from komlenic. Thanks for the support!
Comment #16
brunogoossens commentedPassed the review on http://ventral.org/pareview.
I would like a full project page for this module.
Comment #17
geertvd commentedNice, seems to be working for me.
The only problem is that when changing an image, the new image is taking the old image's dimension.
I can see that these dimensions are save in an image field.
Comment #18
ryandekker commentedYep, automated code review looks good. I installed and tested this and it works well for me.
I reproduced the issue mentioned in #17, though images are just one type of file, and this seems pretty minor. I would like to see it tackled, but I don't see it as a reason to hold back the module as a whole. (Having said that, I think it would be pretty easy to implement by splitting out line 173 and adding a bit of code to find the file and update those values:
I'm marking this as RTBC, I think the basic functionality of this module is good to go.
Comment #19
klausiSorry for the delay, but you have not listed any reviews of other project applications in your issue summary as strongly recommended in the application documentation.
manual review:
Sorry to bump this back to "needs work", but you need to know where to use check_plain() and where not.
Comment #20
brunogoossens commentedThx for the review klausi.
I implemented all your improvements for the module.
The tip about using the arguments in hook_menu() solved my form_alter problem for the ajax callbacks. This made my code a lot simpler and therefore better.
I also solved the image size problems. The size is now updated on the image field.
Also made some small changes of the admin page view.
Other module reviews:
Node Reference Selector Widget : http://drupal.org/node/1437126#comment-6034962
Facebook Comments Administration: http://drupal.org/node/1535574#comment-6035054
Comment #21
gmclelland commentedJust curious, will this module integrate/play nicely with the media and file_entity modules?
Comment #22
patrickd commentedYour project page is not very detailed (usage, installation, screenshot?), please have a look at the tips for a great project page, you may also use HTML-tags for better structure.
Your project page and readme may follow the same structure and content
Btw, you don't have to document the parameters and returned values of common hooks (but better more documentation than too few)
Your default view is not imported on installation
Your not checking whether the fid exists that is requested by admin/file_replace/%
I would suggest to use "admin/file_replace/%file" as path instead. The entity will be loaded as parameter directly and you don't have to care whether the file object really exists as the menu system will check it for you and return 404 if the entity does not exist
Don't use such generic variable names as $i
temporary values that should be remembered after submission of the form can simply be putted into the form without using a hidden form element (eg with $from['#old_fid'] = $fid)
Comment #23
brunogoossens commentedFixed above notices.
Comment #24
a_thakur commentedHi,
Some manual review of the code.
The file file_replace.views.inc should be renamed to file_replace.views_default.inc as you are implementing the hook_views_default_views() hook here. Please refer to to the API document of hook_views_default_views().. The second paragraph specifies this "This hook should be placed in MODULENAME.views_default.inc and it will be auto-loaded. MODULENAME.views_default.inc must be in the directory specified by the 'path' key returned by MODULENAME_views_api(), or the same directory as the .module file, if 'path' is unspecified."
Please make @file comment more descriptive, both in .module and .inc file. The @file tokendenotes that what follows on the next line is a description of what this file does. This one-line description is used so that api.module (see http://drupal.org/project/api), Drupal’s automated documentation extractor and formatter, can find out what this file does.
In the file_replace.module, line #14 to line #23
It is best to avoid underscores(_) in the URL, so please change to
Remove all the TODO comments.
Line #126 to #131
You could change this to
db_select()->condition() defaults to IN if $value is an array, and = otherwise. [The indentation is coming wrong here, don't know some how the indentation changes on it's own. In your code please keep the indentation to 2 spaces on the line after db_select]
Will do a more review of the functionality and revert back to you.
Comment #25
a_thakur commentedChanging the status.
Comment #26
a_thakur commentedHi,
In the file_replace.views.inc. Line #295
Best to avoid underscore. User "-" instead.
And Line #297.
Change "Files" to something else as there is already a "Files" title which links to admin/content/file.
Would be good, in case you can change the menu path for views display to
This would remove the ambiguity which is present right now. Could you make the following changes and push a fresh code, so that the community can review it again.
Comment #27
brunogoossens commentedImplemented the changes recommended by a_thakur.
The db_select bug is now fixed and is implemented in staid of db_query.
I did not use the above example because I needed to get the node title with a join query.
For everybody who doesn't want to loose some precious hours of their lives. Here was may solution to my db_select bug.
old code:
new code:
Please review my code again and again and again until it will be approved.
Grts
Comment #28
aaronschachter commentedIssues with Module functionality. I installed this and it isn't working properly.
I'm at /admin/content/file/file-admin
- Nodes are showing up in this list of files. See attached.
- If try to replace an Image file (i'm using the built-in Article node type), I get a SQL error, from what seems to be adding these nid:// records into file_managed. That's not right.
Minor issues:
- There is still a master branch.
- Readme says there is a 'Files' tab that appears. This tab is actually called 'File Replace'
Comment #29
gmclelland commentedDoesn't the File Entity module now include a File Replace functionality in the dev version? see #1123570: Replace file while retaining field metadata
How is this module different?
Comment #30
brunogoossens commentedWell it didn't when this full project application topic started. A long time agooo ....
Comment #31
brunogoossens commentedComment #31.0
brunogoossens commentedsandbox link added
Comment #32
avpaderno