The following lists tcpdf as a library, but it says not detected even though it is present in the libraries folder. I tried using the same code as the mailchimp module (which is correctly detected). What am I doing wrong?

function my_module_libraries_info() {
  $libraries['tcpdf'] = array(
    'name' => 'TCPDF',
    'vendor url' => 'http://www.tcpdf.org',
    'download url' => 'http://sourceforge.net/projects/tcpdf/files/',
    'version arguments' => array(
      'file' => 'tcpdf.php',
      'pattern' => '/\Version     : \"((\d+)\.(\d+)\.(\d+))\"/',
    ),
    'files' => array(
      'php' => array(
        'tcpdf.php',
      ),
    ),
  );
}

Comments

tstoeckler’s picture

Category: Bug report » Support request

So first of all, you have to actually return the library information, but since apparently you're library information is being found, I am assuming that you are doing that.

What seems to be happening is that the regular expression doesn't match the line. I looked at the latest version of tcpds and the version is declared in the following line:

// Version     : 6.0.050

I didn't actually spend a lot of time investigating the problem, but it seems like the problem *may* be that the double quotes (") in your regular expression are wrong. I don't see any double quotes in the actual line.

On an unrelated note: I would suggest you use the 'line' parameter as well, to limit the version scanning to ~10 lines. Currently libraries_get_version() will scan the entire file.

lsolesen’s picture

Issue summary: View changes
Status: Active » Fixed

That was it.

Status: Fixed » Closed (fixed)

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