<commit_before><?php

/**
 * This file is part of the OpenPNE package.
 * (c) OpenPNE Project (http://www.openpne.jp/)
 *
 * For the full copyright and license information, please view the LICENSE
 * file and the NOTICE file that were distributed with this source code.
 */

/**
 * opBaseSendMailLiteTask
 *
 * @package    opLiteMailTaskPlugin
 * @subpackage task
 * @author     <NAME> <<EMAIL>>
 */
abstract class opBaseSendMailLiteTask extends opBaseSendMailTask
{
  protected
    $inactiveMemberIds = null,
    $transport = null,
    $sendCount = 0,
    $adminMailAddress = null,
    $connectionOptions = null,
    $tables = array(),
    $tableNames = array(),
    $logger = null;

  protected function configure()
  {
    parent::configure();
    $this->addOption('log-file', 'l', sfCommandOption::PARAMETER_OPTIONAL, 'The path of log file', null);
  }

  protected function execute($arguments = array(), $options = array())
  {
    parent::execute($arguments, $options);
    $connection = Doctrine_Manager::connection();
    $this->connectionOptions = $connection->getOptions();

    sfContext::createInstance($this->createConfiguration('pc_frontend', 'prod'), 'pc_frontend');
    sfOpenPNEApplicationConfiguration::registerZend();

    $this->adminMailAddress = opConfig::get('admin_mail_address');

    $helpers = array_unique(array_merge(array('Helper', 'Url', 'Asset', 'Tag', 'Escaping'), sfConfig::get('sf_standard_helpers')));
    sfContext::getInstance()->getConfiguration()->loadHelpers($helpers);

    if (null !== $options['log-file'])
    {
      $this->logger = new sfFileLogger($this->dispatcher, array('file' => $options['log-file']));
    }
  }

  protected function getDbh()
  {
    $options = $this->connectionOptions;
    return new PDO($options['dsn'], $options['username'],
      (!$options['password'] ? '':$options['password']), $options['other']);
  }

  protected function executeQuery($query, $params = array())
  {
    if (!empty($params))
    {
      $stmt = $this->getDbh()->prepare($query);
      $stmt->execute($params);

      return $stmt;
    }

    return $this->getDbh()->query($query);
  }

  protected function fetchRow($query, $params = array())
  {<commit_msg>fixed opBaseSendMailLiteTask doesn't fetch Japanese content of table<commit_after><?php

/**
 * This file is part of the OpenPNE package.
 * (c) OpenPNE Project (http://www.openpne.jp/)
 *
 * For the full copyright and license information, please view the LICENSE
 * file and the NOTICE file that were distributed with this source code.
 */

/**
 * opBaseSendMailLiteTask
 *
 * @package    opLiteMailTaskPlugin
 * @subpackage task
 * @author     <NAME> <<EMAIL>>
 */
abstract class opBaseSendMailLiteTask extends opBaseSendMailTask
{
  protected
    $inactiveMemberIds = null,
    $transport = null,
    $sendCount = 0,
    $adminMailAddress = null,
    $connectionOptions = null,
    $tables = array(),
    $tableNames = array(),
    $logger = null;

  protected function configure()
  {
    parent::configure();
    $this->addOption('log-file', 'l', sfCommandOption::PARAMETER_OPTIONAL, 'The path of log file', null);
  }

  protected function execute($arguments = array(), $options = array())
  {
    parent::execute($arguments, $options);
    $connection = Doctrine_Manager::connection();
    $this->connectionOptions = $connection->getOptions();

    sfContext::createInstance($this->createConfiguration('pc_frontend', 'prod'), 'pc_frontend');
    sfOpenPNEApplicationConfiguration::registerZend();

    $this->adminMailAddress = opConfig::get('admin_mail_address');

    $helpers = array_unique(array_merge(array('Helper', 'Url', 'Asset', 'Tag', 'Escaping'), sfConfig::get('sf_standard_helpers')));
    sfContext::getInstance()->getConfiguration()->loadHelpers($helpers);

    if (null !== $options['log-file'])
    {
      $this->logger = new sfFileLogger($this->dispatcher, array('file' => $options['log-file']));
    }
  }

  protected function getDbh()
  {
    $options = $this->connectionOptions;
    $dbh =  new PDO($options['dsn'], $options['username'],
      (!$options['password'] ? '':$options['password']), $options['other']);

    if (0 === strpos($options['dsn'], 'mysql:'))
    {
      $dbh->query('SET NAMES utf8');
    }

    return $dbh;
  }

  protected function executeQuery($query, $params = array())
  {
    if (!empty($params))
    {
      $stmt = $this->getDbh()->prepare($query);
      $stmt->execute($params);

      return $stmt;
    }

    return $this->getDbh()->query($query);
  }

  protected function fetchRow($query, $params = array())
  {
{'fraction_non_alphanumeric': 0.16568434839554683, 'fraction_numerical': 0.0008731717965509714, 'mean_word_length': 4.142536475869809, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 42, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '6707456', 'n_tokens_mistral': 1373, 'n_tokens_neox': 1365, 'n_words': 304}