You are here

function mailmime_download_requirements in Mail MIME 7.2

Same name and namespace in other branches
  1. 8.2 mailmime.module \mailmime_download_requirements()
  2. 6.2 mailmime.module \mailmime_download_requirements()

Attempts to use the Include module to download required files.

1 call to mailmime_download_requirements()
mailmime_check_requirements in ./mailmime.module
Checks whether required files exist.

File

./mailmime.module, line 106
Ensures that required files are available.

Code

function mailmime_download_requirements() {
  $packages = array(
    'Mail_mime' => array(
      'local_path' => 'Mail/',
      'remote_path' => 'https://raw.github.com/pear/Mail_Mime/master/Mail/',
      'files' => array(
        'mime.php',
        'mimePart.php',
      ),
    ),
    'Mail_mimeDecode' => array(
      'local_path' => 'Mail/',
      'remote_path' => 'http://svn.php.net/repository/pear/packages/Mail_mimeDecode/trunk/Mail/',
      'files' => array(
        'mimeDecode.php',
      ),
    ),
    'PEAR' => array(
      'local_path' => '',
      'remote_path' => 'https://raw.github.com/pear/pear-core/master/',
      'files' => array(
        'PEAR.php',
        'PEAR5.php',
      ),
    ),
  );
  foreach ($packages as $name => $package) {
    $dst = $package['local_path'];
    $src = $package['remote_path'];
    foreach ($package['files'] as $file) {
      if (!include_check_path("{$dst}{$file}", "{$src}{$file}", 'url')) {
        return FALSE;
      }
    }
  }
  return TRUE;
}