Description
Monfis is a very simple but effective module for monitor status change in files. Show missing and sync files and help administrators find deleted files more easily. This was built for customer and quickly migrated to more than one system. Picture should be clear on what it does.

Project Page
https://www.drupal.org/sandbox/hag/2856080

Git clone command
git clone --branch 7.x-1.x https://git.drupal.org/sandbox/hag/2856080.git monfis

Installation

  1. Copy the monfis.module to your modules directory
  2. Enable module, database schemas will be setup automatically.
  3. Grant users the permission "Administer monfis" so they can use monfis.
  4. Run Cron.

Usage
Let Cron run and navigate to the /admin/monfis.

Requirements
File (https://www.drupal.org/docs/7/core/modules/file/)
ctools (https://www.drupal.org/project/ctools)

Manual reviews of other projects

  1. https://www.drupal.org/node/2851031#comment-11958361
  2. https://www.drupal.org/node/2840573#comment-11958339
  3. https://www.drupal.org/node/2840715#comment-11958344
  4. https://www.drupal.org/node/2833485#comment-11981643
  5. https://www.drupal.org/node/2808203#comment-11981648
  6. https://www.drupal.org/node/2857863#comment-11981652

Comments

Drupal8 created an issue. See original summary.

djalxs’s picture

I've reviewed and all code looks good however, I would change:

function monfis_menu() {
  $items = array();
  $items['admin/monfis'] = array(
    'title' => 'Monfis',
    'description' => 'Monfis',
    'access callback' => 'monfis_access_callback',
    'page callback' => 'monfis_call_back',
    'type' => MENU_LOCAL_TASK | MENU_NORMAL_ITEM,
    'weight' => 11,
  );
  return $items;
}

to

function monfis_menu() {
  $items = array();
  $items['admin/monfis'] = array(
    'title' => 'Monfis',
    'description' => 'Monfis',
    'access callback' => 'monfis_access_callback',
    'page callback' => 'monfis_call_back',
    'type' => MENU_NORMAL_ITEM,
    'weight' => 11,
  );
  return $items;
}

The reason being you have set a top level admin menu link and the local action tab doesn't fit with this.

Alternatively, you could create a second menu item and use MENU_DEFAULT_LOCAL_ACTION.

Drupal8’s picture

Thank you @djalxs I use both to better allow our users to navigate through custom menus. This seems confusing without our custom implementation so I have removed the MENU_LOCAL_TASK as you advised.

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.

jeetendrakumar’s picture

Assigned: Drupal8 » Unassigned
qzmenko’s picture

Status: Needs review » Needs work

Automated Review

No automated test cases were found, did you consider writing Simpletests or PHPUnit tests? This is not a requirement but encouraged for professional software development.

Manual Review

Individual user account
Yes: Follows the guidelines for individual user accounts.
No duplication
Yes: Does not cause module duplication and/or fragmentation.
Master Branch
Yes: Follows the guidelines for master branch.
Licensing
Yes: Follows the licensing requirements.
3rd party assets/code
Yes: Follows the guidelines for 3rd party assets/code.
README.txt/README.md
Yes: Follows / No: Does not follow] the guidelines for in-project documentation and/or the README Template.
Code long/complex enough for review
Yes: Follows the guidelines for project length and complexity.
Secure code
Yes: Meets the security requirements.
Coding style & Drupal API usage
  1. (*) Undefined function file_type_load
  2. (*) Undefined constant FILE_TYPE_NONE
  3. (*) Fatal error after running cron: SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'type' cannot be null. See monfis.module:384
  4. (*) Use hook_uninstall for removing variables and tables.
  5. Use function t() for 'monfis : Sync'
  6. Define constants for the numbers in the function monfis_preprocess_table
  7. In monfis_theme no need to declare an empty array.
  8. Use human-readable variable instead arg1
  9. Remove blank lines at the beginning of functions

This review uses the Project Application Review Template.

Drupal8’s picture

Thank you for your time. I have review what you find:
1)file_type_load is a function from the file_entity module.(Required by Monfis)
2) Change the Constant to solve the issue 1,2,3
3) This error comes from the missing file_entity module. Also the Constant now will solve the issue as a second layer of protection.
4) This not required as for Drupal 7!
5) This is not necessary but i have include the t function.
6) this is not necessary but i would try to come up with a better way detected that the Monfis form has been triggered.
7) ok
8) I change the name
9) Not necessary.

Thank you again!

Drupal8’s picture

Status: Needs work » Needs review
Drupal8’s picture

Issue summary: View changes
Drupal8’s picture

Issue summary: View changes
Drupal8’s picture

Issue summary: View changes
khurrami’s picture

Hi,

I tried to install the module and found following errors

PHP Fatal error: Uncaught Error: Unsupported operand types in /includes/theme.inc:637\nStack trace:\n#0 /includes/theme.inc(689): _theme_process_registry(Array, 'monfis', 'module', 'monfis', 'sites/all/modul...')\n#1 /includes/theme.inc(325): _theme_build_registry(Object(stdClass), Array, 'phptemplate')\n#2 /includes/theme.inc(277): _theme_load_registry(Object(stdClass), Array, 'phptemplate')\n#3 /includes/theme.inc(411): theme_get_registry()\n#4 /includes/theme.inc(395): ThemeRegistry->initializeRegistry()\n#5 /includes/theme.inc(335): ThemeRegistry->__construct('theme_registry:...', 'cache')\n#6 /includes/theme.inc(277): _theme_load_regist in /includes/theme.inc on line 637, referer: /admin/modules

Drupal8’s picture

@khurrami. I have made a commit with a fix. You can tested with a git pull. To use it after the install run the cron ( to collect files and start showing their status)

Drupal8’s picture

I understand the little time everyone have, but I hope someone can review this module.

manolios’s picture

Automating tools found this https://pareview.sh/node/1230

FILE: /root/repos/pareviewsh/pareview_temp/monfis.module
----------------------------------------------------------------------
FOUND 2 ERRORS AFFECTING 1 LINE
----------------------------------------------------------------------
318 | ERROR | [x] Expected 1 space before "="; 0 found
318 | ERROR | [x] Expected 1 space after "="; 0 found
----------------------------------------------------------------------
PHPCBF CAN FIX THE 2 MARKED SNIFF VIOLATIONS AUTOMATICALLY
------------------------------------------------------------

Manual review:
I don't found anything wrong. With new drupal install 7.X worked fine.

mehul.shah’s picture

Status: Needs review » Needs work

Hi Drupal8,

Please change the url of config in your monfis.info file to

configure = admin/monfis

the current url -> admin/config/content/monfis does not exist in the monfis_menu.

Along with this comment, the status of the module remains "Needs work"

Drupal8’s picture

Status: Needs work » Needs review

Hello mehul.shah, nice catch!

I have push a fix. Thank you again.

3ssom’s picture

Status: Needs review » Needs work

Hello Drupal8,

Automated Review

Looks good ,, no errors found :)

Manual Review

Individual user account
[Yes: Follows] the guidelines for individual user accounts.
No duplication
[Yes: Does not cause] module duplication and/or fragmentation.
Master Branch
[Yes: Follows] the guidelines for master branch.
Licensing
[Yes: Follows] the licensing requirements.
3rd party assets/code
[Yes: Follows] the guidelines for 3rd party assets/code.
README.txt/README.md
[No: Does not follow] the guidelines for in-project documentation and/or the README Template.
Code long/complex enough for review
[No: Does not follow] the guidelines for project length and complexity.
Secure code
[Yes: Meets the security requirements. / No: List of security issues identified.]
Coding style & Drupal API usage
[List of identified issues in no particular order. Use (*) and (+) to indicate an issue importance. Replace the text below by the issues themselves:
    (+) Please see the README guidelines .. it looks good but you can do better there.
  1. (*) In you hook_menu() .. I can see you are using a callback as your custom permission in hook_permission() monfis_access_callback then user_access to call it.. I know it will work just fine but its unnecessary code since you can just use array('administer monfis') using 'page arguments' it will look like this:
    'page arguments' => array('administer monfis'),
    

    instead of this:

    'access callback' => 'monfis_access_callback',
    

    then remove the access callback ..

  2. (*) This is similar to the above note .. why not using the hook_menu() to call the drupal_get_form use this in the hook_menu()?:
        'page callback' => 'drupal_get_form',
        'page arguments' => array('monfis_content'),
    

    instead of this:

    'page callback' => 'monfis_call_back',
    

    Then using the same thing in extra code?:

    function monfis_call_back() {
      $monfis_form = drupal_get_form('monfis_content');
    
  3. (*) In your .module file line:167 ,, I see you are using user_access('administer files') .. which is undefined? can you explain this?
  4. (+) In you .module line:365 .. please use t() in watchdog.
  5. (+) Not sure about this but in your hook_cron() it runs monfis_run() .. which is a db_insert() .. into your schema .. what if that for somehow fails? are you sure this will not ruin the site running your module? I don't see conditions which control that whether in cron schedule or in the query!
  6. (+) Move your hook_help() to the top of your code in .module
  7. (+) I'd put my css file in separate folder(e.g: css/monfis.css).

The starred items (*) are fairly big issues and warrant going back to Needs Work. Items marked with a plus sign (+) are important and should be addressed before a stable project release. The rest of the comments in the code walkthrough are recommendations.

If added, please don't remove the security tag, we keep that for statistics and to show examples of security problems.

This review uses the Project Application Review Template.

Drupal8’s picture

Hi 3ssom,
thank you for the time you gave to review this module. I have made a new commit to fixes the issues and recommendations you gave. I have some objections to the first two points. My thought was and still is to keep this two in a separate function to better control the way this can handle not only now but in the next commits that will be coming as soon, I have time to commit them. I like and i found correct to break the css to appropriate folder.

Also the user_access it was unnecessary as this was running in the original module for a customer and not for this public module. The point about the watchdog was giving and error in phpcs (The second argument to watchdog() should not be enclosed with t()). A workaround was implemented that solve this issue.

The disaster in the db_insert probably will not be affect anything as this work a stand alone and will not break anything in the site part. But I like what you write and I would try to make some check.

Thank you and I would like your opinions :)

3ssom’s picture

Status: Needs work » Reviewed & tested by the community

Hello Drupal8,

I've pulled your fixes and I think this a RTBC :)

but I still have some points I'd like to mention here but they are NOT blockers:

  1. $GLOBALS['base_url'] is a PHP but you can use it the drupal way something like $base_url globally if it were me I'd use base_path()
  2. in your .module line:26 default: .. do you really need this empty default case?
  3. there is .vcode folder which I believe is hidden and unnecessary in your reop. is this a visual basic json file in there?
  4. You should remove LICENSE.txt, it will be added by drupal.org packaging automatically.

I'm putting this as RTBC.

Thank you

Drupal8’s picture

Hi 3ssom,

The .vscode should have been ignored by .gitignore. I have pushed the gitignore file. Also I removed the LICENSE.txt.
My first approach was with base_path() but this will return the url without the http[s]://[..] so this is why I stack with $GLOBALS['base_url'].

The empty default case is there so in the next release must be populated. If this was just one case I could just make an if statement but in the next few commit this will start making more sense as more help comments will be added.

Thank you again for the time :)

avpaderno’s picture

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

Thank you for your contribution!
I am going to update your account so you can opt into security advisory coverage now.
These are some recommended readings to help with excellent maintainership:

You can find more contributors chatting on the IRC #drupal-contribute channel. So, come hang out and stay involved.
Thank you, 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.

I thank all the dedicated reviewers as well.

avpaderno’s picture

Status: Fixed » Closed (fixed)

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