Hello!

In the source code of your module, you are including a 3rd party library (PHPLOC) that is licensed with a different licene (BSD-3). This breaks the Terms of Service of the usage of the Drupal Git repository: https://www.drupal.org/git-repository-usage-policy

There are options to resolve this. You can integrate your module with the Libraries module (https://drupal.org/project/libraries ) or you could remove the library and add a hook_requirement ( https://api.drupal.org/api/drupal/modules%21system%21system.api.php/func... ) to verify if the user has manually downloaded it.

Regards,
David.

Comments

gabrielhruiz’s picture

Hello, We have a problem with the best practise for this case. First I'm going to explain how we use the library:

We only use a class of PHPLOC (Analyser in Analyser.php), no the rest of the project. This class has been modified to add new attributes, functions and global variables not has been modified. In summary we use only a file of the total library.

We have received many possible solutions, like to make a fork to PHPLOC, I think that is very tedious for a little part of code that we use.

Is possible to add this class of PHPLOC code as part of smartest module with BSD lisence?
What do you think about the best solution in this case?

thanks @David_Hernández

You can see the class there: https://github.com/sebastianbergmann/phploc/blob/master/src/Analyser.php

David Hernández’s picture

This is not about best practices. It's about violating the terms of service of Drupal.org, so it's not possible to keep the file of the phploc library on the source code.

As you said, I think the best solution is to fork the PHPLOC library and only leave the required class with the modifications you need, so it can be included using Libraries or other solution.

gabrielhruiz’s picture

Sorry, I said that we modified PHPLOC library, but now I search the PHPLOC repository and has changes. these changes make that we not have to modified the library. We can use it as it is now. Therefore we use Libraries API to integrate PHPLOC in our module, as you propose.

thank you very much.

gabrielhruiz’s picture

StatusFileSize
new30.43 KB

The code was modified like appears in "patch Issue #2504591.diff" for this issue.

We have deleted the code of the class Analyser.php of phploc from our module, following your instructions. Now expected to be extracted into 'sites/all/libraries/phploc'.

fran seva’s picture

Status: Active » Needs review

@gabrielhruiz
The patch is not following the Drupal name signature. Should be a file with the following structure
_#issue-#comment.patch.

In other hand, every time a patch is posted the issue state should be update to Needs Review. In [1] you can check all the drupal issue status and what means.

[1] https://www.drupal.org/issue-queue/status

I change the issue status to Needs Review.

gabrielhruiz’s picture

Sorry, this is the .patch file for this issue.

fran seva’s picture

@babrielhruiz, thanks for the update but I think I didn't explain as well as I supposed :p.
The patch should be something like this: add_hooklibrary_2504591-7.patch where :

- add_hooklibrary is a short issue description
- 2504591: The issue number aka #issue
- 7: The comment number where I'm posting the patch aka #comment

I recommend you use Dreditor [1]

[1] https://dreditor.org/

gabrielhruiz’s picture

StatusFileSize
new30.43 KB

Thanks you for the explanation. I add a correct patch.

fran seva’s picture

fran seva’s picture

What I see in the patch.

 */
		+function smartest_requirements($phase) {
		+  $requirements = array();
		+  // Ensure translations do not break at install time
		+  $t = get_t();

In line comments should ends with '.'

+function smartest_autoload_info() {  <--- here
		+  $path = libraries_get_path('phploc');
		+  return array(
function smartest_phploc_libraries_info() { <--- here
		+
		+  // Expected to be extracted into 'sites/all/libraries/simple'.
		+  $libraries['phploc'] = array(
		+    'name' => 'phploc',

There are functions without comments.

gabrielhruiz’s picture

StatusFileSize
new9.56 KB

Add hooks comments and ends comments fixed.

fran seva’s picture

@gabrielhruiz great patch but I think the patch is not correct, I mean the patch only have the comments and should have all the code from patch #8. Also, an interdiff file could be great to check what is new.
Create an interdiff is easy, you only have to create a branch with the patch #8 and other with the patch #11 and execute git diff between the branches.

Also I saw you change the patch name from add_hooklibrary to implement_comment_lines. That's not a problem but I'm not sure if you did it because you believe that each patch have to change it's name depending what you do on it. The patch name, AFAIK, should have a short description of the issue and not the last change it is done.

If you has any doubt you can try to ask in #drupal-es or #drupal-contribute IRC channels

gabrielhruiz’s picture

StatusFileSize
new30.49 KB

Upload patch wich contains the changes only of this issue.

David Hernández’s picture

Status: Needs review » Needs work

Thanks for pushing this issue forward!

Here is a small review:

  1. +++ b/smartest/smartest.info
    @@ -5,13 +5,17 @@ description = A testing module.
    +files[] = ../../../all/libraries/phploc/Analyser.php
    

    The full path is not required, only phploc/Analyser.php

    Libraries can be installed in multiple folders: sites/all, sites/default, sites/[site-name], profiles/[profile-name]... Find more documentation about this here: https://www.drupal.org/node/1342238

  2. +++ b/smartest/smartest.module
    @@ -36,6 +36,74 @@ function smartest_theme() {
    + * Implements hook_phploc_libraries_Info().
    

    Unnecessary capital letter: Implements hook_phploc_libraries_Info().

    Should be: Implements phploc_libraries_info().

  3. +++ b/smartest/smartest.module
    @@ -36,6 +36,74 @@ function smartest_theme() {
    +function smartest_phploc_libraries_info() {
    

    Shouldn't this hook be hook_libraries_info() / smartest_libraries_info()?

  4. +++ b/smartest/smartest.module
    @@ -36,6 +36,74 @@ function smartest_theme() {
    +      'pattern' => '/Class available since Release (\d+1.0.0)/', ¶
    

    Extra space at the end of line.

gabrielhruiz’s picture

StatusFileSize
new2.63 KB

this .patch contains changes in other hooks that isn't appear in #14 comment, because were necessary to resolve the problem of .info.

gabrielhruiz’s picture

StatusFileSize
new30.96 KB

The correct patch with all changes.

David Hernández’s picture

Status: Needs work » Reviewed & tested by the community

There are a few things that can be fixed, but I think this is already good to go.

  1. +++ b/smartest/smartest.board.inc
    @@ -339,10 +339,11 @@ function smartest_close_widget_form_submit($form, &$form_state){
    +  set_time_limit ( 60*5 );
    

    I don't like this solution, but for now, I think we can go on with it.

  2. +++ b/smartest/smartest.info
    @@ -5,13 +5,17 @@ description = A testing module.
     files[] = smartest.css
    +files[] = smartest.board.css
    

    CSS files don't need to be at the info file. The files listed here are always included: https://www.drupal.org/node/542202#files

  3. +++ b/smartest/smartest.module
    @@ -36,6 +36,74 @@ function smartest_theme() {
    +
    +/*
    +* Autoload information about SmarTest libraries.
    +*/
    +function smartest_autoload_info() {
    +  $path = libraries_get_path('phploc');
    +  return array(
    +    'Analizer' => array(
    +      'file' => 'Analyser.php',
    +      'file path' => $path,
    +    ),
    +  );
    +}
    

    I think this function can be removed.

  4. +++ b/smartest/smartest.module
    @@ -36,6 +36,74 @@ function smartest_theme() {
    + * Implements phploc_libraries_info().
    

    Should be:

    /**
     * Implements hook_libraries_info().
     */
    
gabrielhruiz’s picture

StatusFileSize
new30.7 KB

Last changes.

David Hernández’s picture

Good so far. I think this is ready to be commited.

fran seva’s picture

The code is good for me too.

David Hernández’s picture

Ok, I tried to apply the patch and didn't apply. The paths were generated incorrectly (maybe because you are not using a direct git clone of the sandbox repository).

This patch is exactly the same as before, but with the paths fixed.

anabsanchez’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

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