This module enables PHP developer access to the Lagotto service web API, enabling Drupal modules to query and update a Lagotto server easily.

The Lagotto server collects information about published articles on the web, monitoring mention of those articles in places such as Wikipedia, Twitter, Scopus and PubMed. The intention of this is to monitor the spread and usefulness of journal articles so that scientists get feedback on their work.

There is no other support for the Lagotto API that I am aware of.

I have rebased the repo in implementing the request to update my email. Old repos will likely need re-cloning.

Project Page:
https://www.drupal.org/sandbox/rivimey/2392395

PAReview automated test:
http://pareview.sh/pareview/httpgitdrupalorgsandboxrivimey2392395git

Git Link:
git clone http://git.drupal.org/sandbox/rivimey/2392395.git lagotto_services

Manual reviews of other projects:
https://www.drupal.org/node/2401587
https://www.drupal.org/node/2394267
https://www.drupal.org/node/2392525
https://www.drupal.org/node/2392119

https://www.drupal.org/node/2274327
https://www.drupal.org/node/2417425
https://www.drupal.org/node/2339289

External resources:
If you wish to run the code it requires a working Lagotto server. You have a couple of choices:

- There is a demo server at http://lagotto.svr.elifesciences.org which can be used. You will have to sign up for an account in order to get an API key for the service. This server will be available until mid-February 2015.

- The public server at http://alm.plos.org can also be read (not written). You will have to sign up for an account in order to get an API key.

- Lagotto can be built and installed locally - see http://articlemetrics.github.io for details.

Comments

rivimey’s picture

Issue summary: View changes
rivimey’s picture

Issue summary: View changes
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.

rivimey’s picture

Issue tags: +PAReview: review bonus
rivimey’s picture

Title: Lagotto services » [D7] Lagotto services
rivimey’s picture

Assigned: rivimey » Unassigned
rivimey’s picture

Status: Active » Needs review
rivimey’s picture

Issue summary: View changes
naveenvalecha’s picture

Status: Needs review » Needs work

Manual Review :
1)Update the Readme.txt how to setup the Lagotto service
2)lagotto_services.info : "Lagotto services" is the better name than Lagotto service API access
3)
Got the error on the status page admin/reports/status while testing the module : Fatal error: Call to undefined function lagotto_services_submit_service_creds()
not able to review the module completely.

P.S.:
I have seen that the commits are not linked with your account.you should configure git so that you will get the credits of the commits.
https://www.drupal.org/node/2392395/commits

manimjs_drupal’s picture

Hi rivimey,

Thanks for contributing this module.
I went through the module and I saw that you have put lot of works in it that is you followed good coding standards with proper comments.

Please work on the comments added by @naveenvalecha.

* Also if possible add any screenshot on project page. Its easy to understand
* Yeah the same said by @naveenvalecha, add more description on readme.txt that where and how to view the output
* I got one Fatel error when entering into the admin configuration page. "Call to undefined function lagotto_services_submit_service_creds()".

Please fix these all, then will do proper manual review.

rivimey’s picture

Issue summary: View changes
rivimey’s picture

Status: Needs work » Needs review

I have adjusted the repo to address @naveenvalecha's request about git email: the result is that you will have to re-clone the repo, I think, because I used an interactive rebase to do that.

I have added an example block -- inside a submodule -- to demonstrate how to use the API, and I have adjusted the main module further, to improve the API and its test coverage, and to extend the setup and configuration instructions.

The fatal error problem has been fixed too.

I hope this helps, please have another look.

naveenvalecha’s picture

Automated Review

Review of the 7.x-1.x branch (commit 5d6b6d9):

  • Coder Sniffer has found some issues with your code (please check the Drupal coding standards).

    <p></p>
    <p>FILE: /var/www/drupal-7-pareview/pareview_temp/lagotto_services.test<br>
    --------------------------------------------------------------------------------<br>
    FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE<br>
    --------------------------------------------------------------------------------<br>
     377 | WARNING | There must be no blank line following an inline comment<br>
    --------------------------------------------------------------------------------</p>
    

    Time: 342ms; Memory: 10.75Mb<br>
    
  • DrupalPractice has found some issues with your code, but could be false positives.

    <p></p>
    <p>FILE: /var/www/drupal-7-pareview/pareview_temp/lagotto_services.test<br>
    --------------------------------------------------------------------------------<br>
    FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE<br>
    --------------------------------------------------------------------------------<br>
     377 | WARNING | There must be no blank line following an inline comment<br>
    --------------------------------------------------------------------------------</p>
    

    Time: 184ms; Memory: 8.75Mb<br>
    

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.

Source: http://pareview.sh/ - PAReview.sh online service

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 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.

I don't have the account on the logotto so its a visual review.

Coding style & Drupal API usage
  1. (+) lagotto_services_admin_get_readme : As the readme.md is not user provided text, its added by the module authoer. So we don't need the filter_xss_admin, check_plain on its text.
  2. define('LAGOTTO_SERVICES_API_FETCH', 5);
    define('LAGOTTO_SERVICES_API_POST', 4);

    Please add a comment what's are the usage of these constants and their default magic values.

  3. lagotto_services_service_url : Please add a comment above $service_uri = preg_replace('/\%version\%/', $version, LAGOTTO_SERVICES_SERVICE_URI); for the developer experiance.
  4. lagotto_services_sanitise_doi_cache : Please add a comment above
    $patterns = array(
          '/^https?:\/\/dx\.doi\.org\/(10\.\d+\/.+)$/',
          '/^doi:(10\.\d+\/.+)$/',
        );
    
        $clean_doi = preg_replace($patterns, '$1', $doi);

    for the developer experiance.

  5. lagotto_services_records : Use drupal_json_decode over json_decode
  6. lagotto_services_example.info : The package should be Testing instead of "Services"

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.

rivimey’s picture

Hi @naveenvalecha, thank you very much for the review.

I have added comments as requested and the pareview issue as requested. I have also simplified the readme processing as requested (would it be sensible to also feed-back to the d.o page I pulled that code from, https://www.drupal.org/node/161085 ?)

The only point you raised I am not sure about is that of setting the .info package to Testing. I am thinking of modules like 'ctools', 'views_slideshow_xtra' and 'js' which all provide example modules within the main module's package space. My main concern is simply that if the two are in different package groups, the examples might not be discovered by potential users via the GUI page (though of course drush users would see it at enable time, at least). Would it be better perhaps to set the package to 'Lagotto services' for both?

rivimey’s picture

I have found and fixed some additional issues in error checking and rendering the block, and managed to simplify the code too.

naveenvalecha’s picture

@rivimey,

Would it be better perhaps to set the package to 'Lagotto services' for both?

The above is a suggestion only.Yup you can.

rivimey’s picture

Hi @naveenvalecha

Thanks, I will do that then this evening. After that, am I done? Can this be set to RTBC?

Ruth

naveenvalecha’s picture

@rivimey,
As the above was only visual review.So I kept it in "Needs Review". Just wait for someone to do complete review it. :)

rivimey’s picture

I have done the update to the packages as promised, and done a bit more testing and documenting as well.

Reviews eagerly awaited!

klausi’s picture

Status: Needs review » Needs work
Issue tags: -PAReview: review bonus +PAReview: security

manual review:

  1. lagotto_services_fetch_doi_enabled(): @return in the doc block is wrong.
  2. lagotto_services_example_render(): this looks vulnerable to XSS exploits. $title is directly coming from the third party webservice, correct? Then it needs to be sanitized before printing to #markup because we consider it user provided input. l() will sanitize the link title automatically for you, but if you use the title alone without canonical_url then it needs to be sanitized. Same for the provider name. Make sure to read https://www.drupal.org/node/28984 again. And please don't remove the security tag, we keep that for statistics and to show examples of security problems.

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

rivimey’s picture

Sorry about that. Too much knowledge: I knew that those strings are checked by the Lagotto server and elsewhere in the module (but I do get why this was a bug).

I've fixed up the issues you reported. I think the other uses of $record are safe because they go through t() or l().

rivimey’s picture

Issue summary: View changes
naveenvalecha’s picture

if you are done your changes,make sure to change the status to "needs review" so that you will get the review from another reviewer.

rivimey’s picture

Status: Needs work » Needs review
rivimey’s picture

Issue summary: View changes
Issue tags: ++PAReview: review bonus
naveenvalecha’s picture

Assigned: Unassigned » naveenvalecha
Issue tags: -+PAReview: review bonus +PAReview: review bonus

correcting tag.
Assigning myself for next review, it may in tonight.

rivimey’s picture

@naveenvalecha, many thanks.

naveenvalecha’s picture

Status: Needs review » Needs work
Issue tags: +#DCM2015

Sorry for the delay was busy with the drupal camp mumbai stuffs.
Some Minors :

/Applications/MAMP/htdocs/d7vulberable.dev/sites/all/modules/pa/lagotto_services/lagotto_services.module:561:1: error - Parameter comment indentation must be 2 additional spaces at position 1
/Applications/MAMP/htdocs/d7vulberable.dev/sites/all/modules/pa/lagotto_services/lagotto_services.module:564:1: error - Return comment indentation must be 2 additional spaces

Manual Review :
You are not included the ctools_include function in the lagotto_services_example_block_view.Please add a dependency on the ctools module.
The "Lagotto services block" blocks will display the error if the ctools is not found.
You are near RTBC..

naveenvalecha’s picture

Assigned: naveenvalecha » Unassigned
rivimey’s picture

naveenvalecha, thanks for finding that. It's actually the ctools_include that's wrong; at one point I was going to render using a ctools block, but decided that normal drupal block method was better in this case. Sadly in my testing I didn't turn ctools off again:( I've removed that line and will test the result this evening.

rivimey’s picture

Status: Needs work » Needs review

Ok, ctools reference (and the spacing) sorted and the result tested without ctools module present.
Hope all well now.

naveenvalecha’s picture

Assigned: Unassigned » klausi
Status: Needs review » Reviewed & tested by the community

Automated Review :
There are lot of warnings addressed by the pareview that needs to be fixed http://pareview.sh/pareview/httpgitdrupalorgsandboxrivimey2392395git

Manual Review :
Not found any Major api problem, security issue and licensing issue.

But otherwise looks RTBC to me.

Assigning to klausi as he might have time to review.

rivimey’s picture

I have fixed the pareview issues except these:

FILE: ...areview_temp/lagotto_services_example/lagotto_services_example.module
95 | ERROR | [x] Line indented incorrectly; expected 6 spaces, found 4
96 | ERROR | [x] Line indented incorrectly; expected 6 spaces, found 4
111 | ERROR | [x] Line indented incorrectly; expected 6 spaces, found 4

which I don't see anything wrong with the existing situation. Perhaps you can clarify what the matter is?

klausi’s picture

Status: Reviewed & tested by the community » Needs work

Yes, Coder sniffer had a false positive with nested array/function line indentation. Fixed here: http://cgit.drupalcode.org/coder/commit/?id=fff5c12

manual review:

  • lagotto_services_example_render(): what about "$name_link = $provider['name'];" here? Where is the provider name sanitized? Looks like it is also coming from the external service? Same for "$value = $provider['value'];"?

Otherwise looks almost ready.

rivimey’s picture

Status: Needs work » Needs review

Thanks Klausi. I have addressed those. Hope all good now.

klausi’s picture

Assigned: klausi » Unassigned
Status: Needs review » Fixed

Cool!

Thanks for your contribution, rivimey!

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.

Status: Fixed » Closed (fixed)

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