You are here

public static function Archive_Tar::loadExtension in Drupal 7

OS independent PHP extension load. Remember to take care on the correct extension name for case sensitive OSes.

Parameters

string $ext The extension name:

Return value

bool Success or not on the dl() call

1 call to Archive_Tar::loadExtension()
Archive_Tar::__construct in modules/system/system.tar.inc
Archive_Tar Class constructor. This flavour of the constructor only declare a new Archive_Tar object, identifying it by the name of the tar file. If the compress argument is set the tar will be read or created as a gzip or bz2 compressed TAR file.

File

modules/system/system.tar.inc, line 296

Class

Archive_Tar

Code

public static function loadExtension($ext) {
  if (extension_loaded($ext)) {
    return true;
  }

  // if either returns true dl() will produce a FATAL error, stop that
  if (function_exists('dl') === false || ini_get('enable_dl') != 1) {
    return false;
  }
  if (OS_WINDOWS) {
    $suffix = '.dll';
  }
  elseif (PHP_OS == 'HP-UX') {
    $suffix = '.sl';
  }
  elseif (PHP_OS == 'AIX') {
    $suffix = '.a';
  }
  elseif (PHP_OS == 'OSX') {
    $suffix = '.bundle';
  }
  else {
    $suffix = '.so';
  }
  return @dl('php_' . $ext . $suffix) || @dl($ext . $suffix);
}