<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.
 */

// Remove E_STRICT and E_DEPRECATED from error_reporting
error_reporting(error_reporting() & ~(E_STRICT | E_DEPRECATED));

/**
 * opPluginManager allows you to manage OpenPNE plugins.
 *
 * @package    OpenPNE
 * @subpackage plugin
 * @author     <NAME> <<EMAIL>>
 */
class opPluginManager extends sfSymfonyPluginManager
{
  const OPENPNE_PLUGIN_CHANNEL = 'plugins.openpne.jp';
  const OPENPNE_PLUGIN_LIST_BASE_URL = 'http://plugins.openpne.jp/packages/';

  protected $channel = null;

  public function __construct(sfEventDispatcher $dispatcher, sfPearEnvironment $environment = null, $channel = null)
  {
    if (!$environment)
    {
      $tz = @date_default_timezone_get();

      $environment = new sfPearEnvironment($dispatcher, array(
        'plugin_dir'            => sfConfig::get('sf_plugins_dir'),
        'cache_dir'             => sfConfig::get('sf_cache_dir').'/.pear',
        'web_dir'               => sfConfig::get('sf_web_dir'),
        'rest_base_class'       => 'opPearRest',
        'downloader_base_class' => 'opPluginDownloader',
      ));

      date_default_timezone_set($tz);

      $this->channel = $channel;
      if (!$this->channel)
      {
        $this->channel = self::getDefaultPluginChannelServerName();
      }

      try
      {
        $environment->registerChannel($this->channel, true);
      }
      catch (sfPluginException $e) {}
    }

    parent::__construct($dispatcher, $environment);

    // register OpenPNE for dependencies
    $this->registerOpenPNEPackage();
  }

  public function getChannel()
  {
    return $this->getEnvironment()->getRegistry()->getChannel($this->channel);
  }

  public function getBaseURL()
  {
    return $this->getChannel()->getBaseURL('REST1.1');
  }

  public function retrieveChannelXml($path)
  {
    $rest = $this->getEnvironment()->getRest();
    return $rest->_rest->retrieveXml($this->getBaseURL().$path);
  }
<commit_msg>(fixes #1780) fixed to continue the install process whether can access to channel server or not<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.
 */

// Remove E_STRICT and E_DEPRECATED from error_reporting
error_reporting(error_reporting() & ~(E_STRICT | E_DEPRECATED));

/**
 * opPluginManager allows you to manage OpenPNE plugins.
 *
 * @package    OpenPNE
 * @subpackage plugin
 * @author     <NAME> <<EMAIL>>
 */
class opPluginManager extends sfSymfonyPluginManager
{
  const OPENPNE_PLUGIN_CHANNEL = 'plugins.openpne.jp';
  const OPENPNE_PLUGIN_LIST_BASE_URL = 'http://plugins.openpne.jp/packages/';

  protected $channel = null;

  public function __construct(sfEventDispatcher $dispatcher, sfPearEnvironment $environment = null, $channel = null)
  {
    if (!$environment)
    {
      $tz = @date_default_timezone_get();

      $environment = new sfPearEnvironment($dispatcher, array(
        'plugin_dir'            => sfConfig::get('sf_plugins_dir'),
        'cache_dir'             => sfConfig::get('sf_cache_dir').'/.pear',
        'web_dir'               => sfConfig::get('sf_web_dir'),
        'rest_base_class'       => 'opPearRest',
        'downloader_base_class' => 'opPluginDownloader',
      ));

      date_default_timezone_set($tz);

      $this->channel = $channel;
      if (!$this->channel)
      {
        $this->channel = self::getDefaultPluginChannelServerName();
      }

      try
      {
        $environment->registerChannel($this->channel, true);
      }
      catch (sfPluginException $e) {}
    }

    parent::__construct($dispatcher, $environment);

    // register OpenPNE for dependencies
    try
    {
      $this->registerOpenPNEPackage();
    }
    catch (sfPluginException $e) {}
  }

  public function getChannel()
  {
    return $this->getEnvironment()->getRegistry()->getChannel($this->channel);
  }

  public function getBaseURL()
  {
    return $this->getChannel()->getBaseURL('REST1.1');
  }

  public function retrieveChannelXml($path)
  {
    $rest = $this->getEnvironment()->getRest();
    return $rest->_rest->retrieveXml($this->getBaseURL().$path);
  }

{'fraction_non_alphanumeric': 0.13303769401330376, 'fraction_numerical': 0.0017738359201773836, 'mean_word_length': 3.2839506172839505, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 53, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '2960262', 'n_tokens_mistral': 1396, 'n_tokens_neox': 1353, 'n_words': 291}