<commit_before><?php

class sfSympalPluginInfo
{
  protected
    $_readme,
    $_plugin = array();

  public function __construct($name)
  {
    $this->_name = $name;
    $this->_initialize();
  }

  public static function synchronizeDatabase()
  {
    $plugins = sfSympalPluginToolkit::getAvailablePlugins();
    foreach ($plugins as $plugin)
    {
      $plugin = new sfSympalPluginInfo($plugin);
      $plugin->synchronizeWithDatabase();
    }
  }

  public function synchronizeWithDatabase()
  {
    $q = Doctrine_Core::getTable('sfSympalPlugin')
      ->createQuery('p')
      ->where('p.name = ?', $this->getName());

    $plugin = $q->fetchOne();
    if (!$plugin)
    {
      $plugin = new sfSympalPlugin();
    }

    foreach ($plugin as $k => $v)
    {
      if ($k == 'id')
      {
        continue;
      }
      $method = 'get'.ucfirst($k);
      $plugin->$k = $this->$method();
    }

    if ($this->getAuthor())
    {
      $plugin->Author->email = $this->getAuthorEmail();
      $plugin->Author->name = $this->getAuthor();
    }

    $plugin->is_downloaded = $this->isDownloaded();<commit_msg>[1.4][sfSympalPlugin][1.0] Fixing plugin author syncing<commit_after><?php

class sfSympalPluginInfo
{
  protected
    $_readme,
    $_plugin = array();

  public function __construct($name)
  {
    $this->_name = $name;
    $this->_initialize();
  }

  public static function synchronizeDatabase()
  {
    $plugins = sfSympalPluginToolkit::getAvailablePlugins();
    foreach ($plugins as $plugin)
    {
      $plugin = new sfSympalPluginInfo($plugin);
      $plugin->synchronizeWithDatabase();
    }
  }

  public function synchronizeWithDatabase()
  {
    $q = Doctrine_Core::getTable('sfSympalPlugin')
      ->createQuery('p')
      ->leftJoin('p.Author a')
      ->where('p.name = ?', $this->getName());

    $plugin = $q->fetchOne();
    if (!$plugin)
    {
      $plugin = new sfSympalPlugin();
    }

    foreach ($plugin as $k => $v)
    {
      if ($k == 'id')
      {
        continue;
      }
      $method = 'get'.ucfirst($k);
      $plugin->$k = $this->$method();
    }

    if ($this->getAuthor())
    {
      $author = Doctrine_Core::getTable('sfSympalPluginAuthor')->findOneByEmail($this->getAuthorEmail());
      $author = $author ? $author : new sfSympalPluginAuthor();
      $author->email = $this->getAuthorEmail();
      $author->name = $this->getAuthor();
      $plugin->setAuthor($author);
    }

    $plugin->is_downloaded = $this->isDownloaded();
{'fraction_non_alphanumeric': 0.17459677419354838, 'fraction_numerical': 0.0016129032258064516, 'mean_word_length': 2.8287037037037037, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 43, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6890963', 'n_tokens_mistral': 807, 'n_tokens_neox': 795, 'n_words': 139}