function Archive_Tar::loadExtension

7.x system.tar.inc Archive_Tar::loadExtension($ext)

OS independent PHP extension load. Remember to take care on the correct extension name for case sensitive OSes. The function is the copy of PEAR::loadExtension().

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 drupal-7.x/modules/system/system.tar.inc

File

drupal-7.x/modules/system/system.tar.inc, line 179

Class

Archive_Tar
Creates a (compressed) Tar archive *

Code

function loadExtension($ext) 
 {
  if (!extension_loaded($ext)) {
    // if either returns true dl() will produce a FATAL error, stop that
    if ((ini_get('enable_dl') != 1) || (ini_get('safe_mode') == 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);
  }

  return true;
}