Utility-Image-Rebuild-module

This module is a small utility tool.

It can help you rebuild the image(s) information stored in the image field within certain content types.

The two common cases are:

  1. Image(s) were replaced manually on the server, such as cover.jpg from a small size to a larger size.
  2. Image(s) name(s) or path(s) were updated in the database and were replaced manually on the server. For example, from public://publication/1.jpg to public://article/01.jpg

In particular, the {file_managed.filesize} and the {file_managed.timestamp} columns will be incorrect after making these changes and the image dimension in the field_data_filename table will be incorrect as well.

This module will rebuild said information and then update them in database.

Installation
Installation is quite simple:

Enable the module from admin/modules or use Drush:

drush pm-enable utility_image_rebuild

Dependencies
The Utility Image Rebuild module is dependent on two Drupal 7 core modules:

  • file
  • image

You will be prompted to enable these modules if they are not already enabled.

Project page:
https://drupal.org/sandbox/joseph.zhao/2035347

Git repo:
git clone --branch 7.x-1.x http://git.drupal.org/sandbox/joseph.zhao/2035347.git utility_image_rebuild

Code base:
http://drupalcode.org/sandbox/joseph.zhao/2035347.git

Screenshot:

Reviews of other projects:

Second review list:

CommentFileSizeAuthor
#16 language_edits-2035383-16.patch4.18 KBgabesullice

Comments

pandaski’s picture

Issue summary: View changes

Update the project desc.

pandaski’s picture

Issue summary: View changes

Remove email from the desc.

pandaski’s picture

Issue summary: View changes

Update project desc.

pandaski’s picture

Issue summary: View changes

add code base.

pandaski’s picture

Issue summary: View changes

Update project desc.

PA robot’s picture

Multiple Applications
It appears that there have been multiple project applications opened under your username:

Project 1: https://drupal.org/node/2034575

Project 2: https://drupal.org/node/2035383

As successful completion of the project application process results in the applicant being granted the 'Create Full Projects' permission, there is no need to take multiple applications through the process. Once the first application has been successfully approved, then the applicant can promote other projects without review. Because of this, posting multiple applications is not necessary, and results in additional workload for reviewers ... which in turn results in longer wait times for everyone in the queue. With this in mind, your secondary applications have been marked as 'closed(duplicate)', with only one application left open (chosen at random).

If you prefer that we proceed through this review process with a different application than the one which was left open, then feel free to close the 'open' application as a duplicate, and re-open one of the project applications which had been closed.

I'm a robot and this is an automated message from Project Applications Scraper.

PA robot’s picture

We are currently quite busy with all the project applications and we prefer projects with a review bonus. Please help reviewing and put yourself on the high priority list, then we will take a look at your project right away :-)

Also, you should get your friends, colleagues or other community members involved to review this application. Let them go through the review checklist and post a comment that sets this issue to "needs work" (they found some problems with the project) or "reviewed & tested by the community" (they found no major flaws).

I'm a robot and this is an automated message from Project Applications Scraper.

PA robot’s picture

Issue summary: View changes

Update the project desc.

pandaski’s picture

Issue summary: View changes

Update the project desc.

pandaski’s picture

Issue summary: View changes

Update project desc.

pandaski’s picture

Issue summary: View changes

Update the review of other project.

pandaski’s picture

Issue tags: +PAreview: review bonus

Waiting for your review, many thanks.

feolius’s picture

Hi!

From my not expert point of view code seems to be correct. The only strange thing, that I noticed, was in README file. You wrote that there are 3 common cases of using the module, but in you project page you point only two of them. And it seems that the case 2 and case 3 (2?) should be combined into one, i.e. user should replace files manually and also replace uris in database, right?
And another one suggestion (but maybe it is not necessary). Maybe you could also put error message in watchdog?

feolius’s picture

Issue summary: View changes

Update reviews of other projects.

pandaski’s picture

@feolius many thanks for the review.

I've updated the README.txt, please feel free to let me know if sounds better now since English is my second language :)

And db_log is definitely a very nice suggestion, I will add this feature in the branch ASAP.

feolius’s picture

Much better now:)
English my second language too.

Thanks!

feolius’s picture

Issue summary: View changes

Update the project desc

pandaski’s picture

Issue summary: View changes

Add screenshot images

pandaski’s picture

@feolius Many thanks mate, if found no major flaw, would you mind to give it a sign off?

feolius’s picture

"give it a sign off" what does it mean?
Language problems. sorry:)

pandaski’s picture

@feolius you can update the status to "reviewed & tested by the community" if found no major flaw. Many thanks.

As mentioned here:

you should get your friends, colleagues or other community members involved to review this application. Let them go through the review checklist and post a comment that sets this issue to "needs work" (they found some problems with the project) or "reviewed & tested by the community" (they found no major flaws).

feolius’s picture

Status: Needs review » Reviewed & tested by the community

Sure, no problems

pandaski’s picture

Thank you for the review mate! I sincerely appreciate it!

klausi’s picture

Status: Reviewed & tested by the community » Needs work
Issue tags: -PAreview: review bonus

manual review:

  1. utility_image_rebuild.module: do not module_load_include() files in the global scope, include them in function bodies when you actually need them.
  2. _utility_image_rebuild_process(): do not run check_plain() for DB query functions. check_plain() is only useful if you print stuff to the HTML response. Please read https://drupal.org/node/28984 again.
  3. "$context['message'] = 'We are processing the file with fid - ' . $id;": all user facing text must run through t() for translation.
  4. "watchdog('Utility Image Rebuild', ':message', array(':message' => $message), $severity);": the ":" placeholder does not exist for watchdog().

But otherwise this looks almost RTBC, knowing where to use check_plain() and where not is an application blocker. Removing review bonus tag, you can add it again if you have done another 3 reviews of other projects.

pandaski’s picture

Status: Needs work » Needs review
Issue tags: +PAreview: review bonus

@klausi many thanks for the review and kindly advices.

The issues have been fixed now, and it is ready for the review.

pandaski’s picture

Issue summary: View changes

Add screenshot images link

pandaski’s picture

Issue summary: View changes

Second review list

pandaski’s picture

Issue tags: -PAreview: review bonus

Remove review bonus tag until another 3 reviews

pandaski’s picture

Issue summary: View changes

Second review list.

pandaski’s picture

Issue tags: +PAreview: review bonus

Thank you for the review folks, learnt a a lot. I sincerely appreciate it!

gabesullice’s picture

StatusFileSize
new4.18 KB

This is an interesting module. I don't see any errors in formatting or on pareview.sh, I'm not expert, but i don't see any blockers in the code either. I went ahead and made some language changes as a native English speaker (Good job though! There wasn't anything egregious :) ) and broke the dependencies into their own section in the README. These are all in the patch, it was easier than writing them all out here. I made no code changes.

None of these things are a blocker though so I'm not moving this back to needs work.

I'll let someone more experienced check the code changes in #12.

gabesullice’s picture

Issue summary: View changes

Update the review second round.

pandaski’s picture

@gabesullice very appreciated your kindly language patch file, and I have applied the patch in the latest release.

Drupal is with such a nice community, and I am encouraged to contribute more just like you. :)

klausi’s picture

Assigned: Unassigned » stborchert
Status: Needs review » Reviewed & tested by the community
Issue tags: -PAreview: review bonus

Looks RTBC to me now! Removing review bonus tag, you can add it again if you have done another 3 reviews of other projects.

Assigning to stBorchert as he might have time to take a final look at this.

stborchert’s picture

Assigned: stborchert » Unassigned
Status: Reviewed & tested by the community » Fixed

Thanks for your contribution, Joseph!

I updated your account so you can promote this to a full project and also create new projects as either a sandbox or a "full" project.

Here are some recommended readings to help with excellent maintainership:

You can find lots more contributors chatting on IRC in #drupal-contribute. So, come hang out and stay involved!

Thanks, also, for your patience with the review process. Anyone is welcome to participate in the review process. Please consider reviewing other projects that are pending review. I encourage you to learn more about that process and join the group of reviewers.

Thanks to the dedicated reviewer(s) as well.

pandaski’s picture

Many thanks @klausi and @stBorchert

I will keep in minds all the thing I learnt here especially sharing the knowledge and be responsible.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

Anonymous’s picture

Issue summary: View changes

Update project desc.