<commit_before><?php
/**
 * @package Minify
 */
 
//
// Handle CSS and Javascript a little differently:
//

// CSS supports overrides so include all available CSS files.
function getCSSFileConfigForDirs($page, $pagetype, $platform, $dirs, $subDirs, $pageOnly=false) {
  $config = array(
    'include' => 'all',
    'files' => array()
  );
  
  foreach ($dirs as $dir) {
    foreach ($subDirs as $subDir) {
      if (!$pageOnly) {
        $config['files'][] = "$dir$subDir/css/common.css";
        $config['files'][] = "$dir$subDir/css/$pagetype.css";
        $config['files'][] = "$dir$subDir/css/$pagetype-$platform.css"; 
      }
      $config['files'][] = "$dir$subDir/css/$page-common.css";
      $config['files'][] = "$dir$subDir/css/$page-$pagetype.css";
      $config['files'][] = "$dir$subDir/css/$page-$pagetype-$platform.css"; 
    }
  }
  return $config;
}

// Javascript overrides appear to work for all the platforms we support
// Code to do overrides commented out below
function getJSFileConfigForDirs($page, $pagetype, $platform, $dirs, $subDirs, $pageOnly=false) {
  $config = array(
    'include' => 'all',
    'files' => array()
  );
  
  foreach ($dirs as $dir) {
    foreach ($subDirs as $subDir) {
      if (!$pageOnly) {
        $config['files'][] = "$dir$subDir/javascript/common.js";
        $config['files'][] = "$dir$subDir/javascript/$pagetype.js";
        $config['files'][] = "$dir$subDir/javascript/$pagetype-$platform.js";
      }
      $config['files'][] = "$dir$subDir/javascript/$page-common.js";
      $config['files'][] = "$dir$subDir/javascript/$page-$pagetype.js";
      $config['files'][] = "$dir$subDir/javascript/$page-$pagetype-$platform.js";
    }
  }
  /*
  foreach ($subDirs as $subDir) {
    $files = array(
      "common.js",
      "$pagetype-$platform.js",
      "$pagetype.js",
    );
    
    foreach ($files as $file) {
      if (!$pageOnly) {
        $dirConfig = array(
          'include' => 'any',
          'files' => array()
        );
        foreach ($dirs as $dir) {
          $dirConfig['files'][] = "$dir$subDir/javascript/$file";
        }
      }
      $config['files'][] = $dirConfig;
      
      $dirConfig = array(
        'include' => 'any',
        'files' => array()
      );
      foreach ($dirs as $dir) {
        $dirConfig['files'][] = "$dir$subDir/javascript/$page-$file";
      }
      $config['files'][] = $dirConfig;
    }
  }
  */
  return $config;
}

function buildFileList($checkFiles) {
  $foundFiles = array();

  foreach ($checkFiles['files'] as $entry) {
    if (is_array($entry)) {
      $foundFiles = array_merge($foundFiles, buildFileList($entry));
    } else if ($entry && Watchdog::safePath($entry)) {
      $foundFiles[] = $entry;
    }
    if ($checkFiles['include'] == 'any' && count($foundFiles)) {
      break;
    }
  }

  return $foundFiles;
}

/**
 * TODO: It had cached the file lists use the DiskCache, but i think whether use the memcache or apc
 * to cache the data.
*/
function getMinifyGroupsConfig() {<commit_msg>removed comment<commit_after><?php
/**
 * @package Minify
 */
 
//
// Handle CSS and Javascript a little differently:
//

// CSS supports overrides so include all available CSS files.
function getCSSFileConfigForDirs($page, $pagetype, $platform, $dirs, $subDirs, $pageOnly=false) {
  $config = array(
    'include' => 'all',
    'files' => array()
  );
  
  foreach ($dirs as $dir) {
    foreach ($subDirs as $subDir) {
      if (!$pageOnly) {
        $config['files'][] = "$dir$subDir/css/common.css";
        $config['files'][] = "$dir$subDir/css/$pagetype.css";
        $config['files'][] = "$dir$subDir/css/$pagetype-$platform.css"; 
      }
      $config['files'][] = "$dir$subDir/css/$page-common.css";
      $config['files'][] = "$dir$subDir/css/$page-$pagetype.css";
      $config['files'][] = "$dir$subDir/css/$page-$pagetype-$platform.css"; 
    }
  }
  return $config;
}

// Javascript overrides appear to work for all the platforms we support
// Code to do overrides commented out below
function getJSFileConfigForDirs($page, $pagetype, $platform, $dirs, $subDirs, $pageOnly=false) {
  $config = array(
    'include' => 'all',
    'files' => array()
  );
  
  foreach ($dirs as $dir) {
    foreach ($subDirs as $subDir) {
      if (!$pageOnly) {
        $config['files'][] = "$dir$subDir/javascript/common.js";
        $config['files'][] = "$dir$subDir/javascript/$pagetype.js";
        $config['files'][] = "$dir$subDir/javascript/$pagetype-$platform.js";
      }
      $config['files'][] = "$dir$subDir/javascript/$page-common.js";
      $config['files'][] = "$dir$subDir/javascript/$page-$pagetype.js";
      $config['files'][] = "$dir$subDir/javascript/$page-$pagetype-$platform.js";
    }
  }
  /*
  foreach ($subDirs as $subDir) {
    $files = array(
      "common.js",
      "$pagetype-$platform.js",
      "$pagetype.js",
    );
    
    foreach ($files as $file) {
      if (!$pageOnly) {
        $dirConfig = array(
          'include' => 'any',
          'files' => array()
        );
        foreach ($dirs as $dir) {
          $dirConfig['files'][] = "$dir$subDir/javascript/$file";
        }
      }
      $config['files'][] = $dirConfig;
      
      $dirConfig = array(
        'include' => 'any',
        'files' => array()
      );
      foreach ($dirs as $dir) {
        $dirConfig['files'][] = "$dir$subDir/javascript/$page-$file";
      }
      $config['files'][] = $dirConfig;
    }
  }
  */
  return $config;
}

function buildFileList($checkFiles) {
  $foundFiles = array();

  foreach ($checkFiles['files'] as $entry) {
    if (is_array($entry)) {
      $foundFiles = array_merge($foundFiles, buildFileList($entry));
    } else if ($entry && Watchdog::safePath($entry)) {
      $foundFiles[] = $entry;
    }
    if ($checkFiles['include'] == 'any' && count($foundFiles)) {
      break;
    }
  }

  return $foundFiles;
}

function getMinifyGroupsConfig() {
{'fraction_non_alphanumeric': 0.1972259810554804, 'fraction_numerical': 0.0, 'mean_word_length': 2.8396103896103897, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 19, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3571548', 'n_tokens_mistral': 1998, 'n_tokens_neox': 1967, 'n_words': 388}