Commit d72c3c25 authored by Alan Lobo's avatar Alan Lobo Committed by Ken Greenslade
Browse files

Issue #3273758 by alansaviolobo: library version not detected

parent 5ab05143
Loading
Loading
Loading
Loading
+2 −21
Original line number Diff line number Diff line
@@ -250,14 +250,12 @@ class Openlayers {
   */
  public static function getLibraryVersion() {
    $variant = Config::get('openlayers.variant');
//dpm($variant);
    if (strpos($variant, 'local-') !== FALSE) {
      $version = self::getLocalLibraryVersion();
    }
    else {
      $version = Config::get('openlayers.variant', NULL);
    }
//dpm($version);
    return $version;
  }

@@ -268,27 +266,10 @@ class Openlayers {
   *   Return the version of the Openlayers library in the filesystem.
   */
  public static function getLocalLibraryVersion() {
    $version = FALSE;
//dpm([libraries_get_path('openlayers3')]);
    if ($path = libraries_get_path('openlayers3')) {
      $library = libraries_detect('openlayers3');
      if (!$library) {
        $library = array();
      }
      $options = array(
        'file' => 'build/ol.js',
        'pattern' => '@Version: (.*)@',
        'lines' => 3,
      );
      $library['library path'] = $path;
//dpm($options);
//dpm(libraries_get_version($library, $options));
      if ($version = libraries_get_version($library, $options)) {
        $version = substr($version, 1);
      $versions = current(array_diff(scandir($path . '/versions'), ['.', '..']));
    }
    }
//dpm($version);
    return $version;
    return $versions;
  }

  /**
+2 −2

File changed.

Contains only whitespace changes.