<commit_before><?php
/**
 */
class PluginmmMediaTable extends Doctrine_Table
{
  public function getLastCreated($limit = null)
  {
    $q = Doctrine_Query::create()
      ->select('m.*')
      ->from('mmMedia m')
      ->orderBy('m.created_at DESC');

    if (null !== $limit)
    {
      $q->limit($limit);
    }

    return $q->execute();
  }


  /**
   * retrieves a mm_media from its path
   *
   * @param string $filename
   * @return mmMedia
   */
  public function findByFilename($path)
  {
    $path_parts = pathinfo($path);

    if ('.' == $path_parts['dirname'])
    {
      $path_parts['dirname'] = '';
    }

    $q = Doctrine_Query::create()->from('mmMedia m')
      ->innerJoin('m.mmMediaFolder f')
      ->where('m.filename = ?', $path_parts['basename'])
      ->andWhere('f.absolute_path = ?', $path_parts['dirname']);
    $result = $q->execute();

    return isset($result[0]) ? $result[0] : null;
  }
}<commit_msg>added a method to find a file in a specific folder<commit_after><?php
/**
 */
class PluginmmMediaTable extends Doctrine_Table
{
  public function getLastCreated($limit = null)
  {
    $q = Doctrine_Query::create()
      ->select('m.*')
      ->from('mmMedia m')
      ->orderBy('m.created_at DESC');

    if (null !== $limit)
    {
      $q->limit($limit);
    }

    return $q->execute();
  }


  /**
   * retrieves a mm_media from its path
   *
   * @param string $filename
   * @return mmMedia
   */
  public function findByFilename($path)
  {
    $path_parts = pathinfo($path);

    if ('.' == $path_parts['dirname'])
    {
      $path_parts['dirname'] = '';
    }

    $q = Doctrine_Query::create()->from('mmMedia m')
      ->innerJoin('m.mmMediaFolder f')
      ->where('m.filename = ?', $path_parts['basename'])
      ->andWhere('f.absolute_path = ?', $path_parts['dirname']);
    $result = $q->execute();

    return isset($result[0]) ? $result[0] : null;
  }

  public function findByFilenameAndFolder($filename, $folderId)
  {
    $result = Doctrine_Query::create()->from('mmMedia m')
      ->where('m.filename = ?', $filename)
      ->andWhere('m.mm_media_folder_id = ?', $folderId)
      ->execute();

    return isset($result[0]) ? $result[0] : null;
  }
}
{'fraction_non_alphanumeric': 0.19127669241253975, 'fraction_numerical': 0.0027260336210813267, 'mean_word_length': 2.932142857142857, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 27, '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': '2132921', 'n_tokens_mistral': 756, 'n_tokens_neox': 741, 'n_words': 138}