A module containing helper functions for Drupal developers and
inquisitive admins. This module can generate history table data based on devel module.

Possible use case:
Dummy history for recommender module(s)

It also offers
- an admin page to delete / generate history

Be sure to only grant
'access development information' permission to developers.

To-do
=================
Generate dummy statistics data for core statistics module
Generate dummy data for log4PHP module
Generate dummy data in various backend (E.g. MongoDB)

Link to project page:
http://drupal.org/sandbox/keithyau/1895220

Link to git:
git clone http://git.drupal.org/sandbox/keithyau/1895220.git devel_generate_history
cd devel_generate_history

Issue about including this code in the devel module:
#1900252: Devel generate history

Drupal 7 only

List of projects I reviewed

http://drupal.org/node/1867346#comment-6989000
http://drupal.org/node/1859944#comment-6988978
http://drupal.org/node/1841492#comment-6969456
http://drupal.org/node/1893226#comment-7002984
http://drupal.org/node/1901698#comment-7001460
http://drupal.org/node/1902954#comment-7002962

Comments

klausi’s picture

Status: Needs review » Postponed (maintainer needs more info)

This sounds like a feature that should live in the existing devel project. Module duplication and fragmentation is a huge problem on drupal.org and we prefer collaboration over competition. Please open an issue in the devel issue queue to discuss what you need. You should also get in contact with the maintainer(s) to offer your help to move the project forward. If you cannot reach the maintainer(s) please follow the abandoned project process.

If that fails for whatever reason please get back to us and set this back to "needs review".

Bizible’s picture

Status: Postponed (maintainer needs more info) » Needs work

There's an automated review for project applications that helps clear out syntax and other common issues that can be detected by code, and saves humans from being syntax readers. Project Application Review It's good to use it to check your code before changing this issue from needs work to needs review, so you don't go back and forth with people that point out syntax changes that get overlooked.

You're using git's default 'master' branch, you need to create another branch named something like '7.x-1.x'. The above link has more details. The version control tab on projects/modules has git commands to help, http://drupal.org/project/1895220/git-instructions
See the section titled: "Switching to a different branch" and the branching and tagging

In the .info file "version", "project", "datestamp" will get added by drupal.org when it packages up the .zip and .tar.gz files.
The "core" on line 11 is a duplicate, and "tags[]" is for Drupal 8, not Drupal 7. See the .info page: http://drupal.org/node/542202 . Also "configure" should be the link to your configure page, unless your using a hook to use their page, which I haven't got that far into your code yet. Also there's an extra empty line at the top bottom.

The .module file:

Line 12, function devel_generate_menu_alter(&$items) {
1) As far as I can tell, you're not altering an existing menu created by another module, the full path doesn't already exist and your not changing the data on that path, so you need to use hook_menu, not hook_menu_alter. Hook_menu returns the $items, and doesn't have it as a parameter.
2) The 'hook' in Drupal hooks should be replaced by your module name('devel_generate_history'), as is the function is for the devel_generate module which might conflict later with that function from that module. hook_XYZ_alter should still be your module's name, although you want to alter another module's data.

Line 25, function devel_generate_history_form() { This matches hook_form and should (not 100%) be renamed, just to prevent being miscalled by Drupal.
http://api.drupal.org/api/drupal/modules!node!node.api.php/function/hook...

Bizible’s picture

Status: Needs work » Postponed (maintainer needs more info)

Fixing cross post of status change.

cloudbull’s picture

I did not see devel can generate history so just add something. Or you are meaning I have to submit a feature request to devel instead ?

Keith

cloudbull’s picture

created a feature request, let's keep posting

http://drupal.org/node/1900252

Thanks
Keith

Bizible’s picture

Issue summary: View changes

updated project page

Bizible’s picture

FYI when adding a link to another issue it's best to use the syntax #1900252: Devel generate history because the appearance reflects the issue's status. For future reference, it's in the syntax below the edit box. I also added this to the Issue Summary(the first post) to let others know of that issue.

#1900252: Devel generate history

cloudbull’s picture

noted with thanks

klausi’s picture

Status: Postponed (maintainer needs more info) » Needs review

Back to needs review, since the addition to the upstream devel module was rejected.

klausi’s picture

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

Thank you for your reviews. When finishing your review comment also set the issue status either to "needs work" (you found some problems with the project) or "reviewed & tested by the community" (you found no major flaws).

It appears you are working in the "master" branch in git. You should really be working in a version specific branch. The most direct documentation on this is Moving from a master branch to a version branch. For additional resources please see the documentation about release naming conventions and creating a branch in git.
Review of the master branch:

  • Remove "version" from the ./devel_generate_history.info file, it will be added by drupal.org packaging automatically.
  • Remove "project" from the ./devel_generate_history.info file, it will be added by drupal.org packaging automatically.
  • Remove "datestamp" from the ./devel_generate_history.info file, it will be added by drupal.org packaging automatically.
  • ./devel_generate_history.module: all functions should be prefixed with your module/theme name to avoid name clashes. See http://drupal.org/node/318#naming
    function devel_generate_menu_alter(&$items) {
    function devel_create_history($num, $del_hist, $time_range) {
    function make_seed() {
    function devel_get_nid() {
    
  • Coder Sniffer has found some issues with your code (please check the Drupal coding standards).
    
    FILE: /home/klausi/pareview_temp/README.txt
    --------------------------------------------------------------------------------
    FOUND 0 ERROR(S) AND 1 WARNING(S) AFFECTING 1 LINE(S)
    --------------------------------------------------------------------------------
     5 | WARNING | Line exceeds 80 characters; contains 87 characters
    --------------------------------------------------------------------------------
    
    FILE: /home/klausi/pareview_temp/devel_generate_history.info
    --------------------------------------------------------------------------------
    FOUND 1 ERROR(S) AFFECTING 1 LINE(S)
    --------------------------------------------------------------------------------
     14 | ERROR | Files must end in a single new line character
    --------------------------------------------------------------------------------
    
    

This automated report was generated with PAReview.sh, your friendly project application review script. You can also use the online version to check your project. You have to get a review bonus to get a review from me.

manual review:

  1. devel_generate_history_form_submit(): looks like there is a debug statement in there?
  2. devel_create_history(): no need to execute the insert query on every loop iteration. Use one execute statement after the loop, see multi insert on http://drupal.org/node/310079
  3. This project is too short to approve you as git vetted user. We are currently discussing how much code we need, but everything with less than 120 lines of code or less than 5 functions cannot be seriously reviewed. However, we can promote this single project manually to a full project for you.

Removing review bonus tag, you can add it again if you have done another 3 reviews of other projects.

cloudbull’s picture

Status: Needs work » Needs review

Updated with those suggestions.

Will do other reviews ASAP.

thanks
Keith

cloudbull’s picture

Issue summary: View changes

Added link pointing to issue in devel issue queue.

sprocketman’s picture

Status: Needs review » Needs work

Manual review:
1. In general, a little more documentation could be used. Specifically, you should include full doc headers for your functions as outlined in Doxygen and comment formatting conventions.
2. In devel_generate_history_create(), in the for loop...
for($j = 1; $j <= $num_list; $j++) {}
...there's a possibility of $nid not getting initialize which would throw an error in...
if($nid != NULL) {}
...so you probably want to add...
$nid = NULL;
...before your for loop.

Sorry if my code example is a little messy. Other than that, looks pretty clean and simple. Good luck!

cloudbull’s picture

Status: Needs work » Needs review

thanks, atozstudio

Updated 1 & 2

jimmyko’s picture

Status: Needs review » Reviewed & tested by the community

All problem mentioned above seems fixed.

I have tested this module and it works nice.

klausi’s picture

Status: Reviewed & tested by the community » Fixed

Review of the 7.x-1.x branch:

  • Coder Sniffer has found some issues with your code (please check the Drupal coding standards).
    FILE: /home/klausi/pareview_temp/devel_generate_history.module
    --------------------------------------------------------------------------------
    FOUND 3 ERROR(S) AFFECTING 2 LINE(S)
    --------------------------------------------------------------------------------
      73 | ERROR | There must be an empty line before the parameter block
     123 | ERROR | Inline comments must start with a capital letter
     123 | ERROR | Inline comments must end in full-stops, exclamation marks, or
         |       | question marks
    --------------------------------------------------------------------------------
    

This automated report was generated with PAReview.sh, your friendly project application review script. You can also use the online version to check your project. You have to get a review bonus to get a review from me.

manual review:

  1. devel_generate_history_menu_alter(): should be devel_generate_history_menu() instead, since you do not alter any menu items.
  2. devel_generate_history_form(): all form elements should be #required?

but that are not blockers, so ...

Thanks for your contribution, keithyau!

I updated your account to let you 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 get 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.

cloudbull’s picture

Thanks all's help ~!!

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

Anonymous’s picture

Issue summary: View changes

adding new reviewed other projects