Example #1
0
 public function __construct(SVNRepositoryConfig $repoConfig, IOInterface $io, Config $config)
 {
     // @TODO: add event dispatcher?
     $this->repoConfig = $repoConfig;
     $this->plugin = $repoConfig->getPlugin();
     // check url immediately - can't do anything without it
     $urls = [];
     foreach ((array) $repoConfig->get('url') as $url) {
         if (($urlParts = parse_url($url)) === false || empty($urlParts['scheme'])) {
             continue;
         }
         // untrailingslashit
         $urls[] = rtrim($url, '/');
     }
     if (!count($urls)) {
         throw new \UnexpectedValueException('No valid URLs for SVN repository: ' . print_r($repoConfig->get('url'), true));
     }
     $repoConfig->set('url', $urls);
     // use the cache TTL from the config?
     if ($repoConfig->get('cache-ttl') === 'config') {
         $repoConfig->set('cache-ttl', $config->get('cache-files-ttl'));
     }
     $this->io = $io;
     $this->cache = new Cache($io, $config->get('cache-repo-dir') . '/' . preg_replace('{[^a-z0-9.]}i', '-', reset($urls)));
     $this->loader = new ArrayLoader();
     // clear out stale cache
     $this->cache->gc($repoConfig->get('cache-ttl'), $config->get('cache-files-maxsize'));
     $this->vendors = $repoConfig->get('vendors');
     $this->defaultVendor = key($this->vendors);
     // create an SvnUtil to execute commands
     $this->svnUtil = new SvnUtil($io, $repoConfig->get('trust-cert'));
 }
 function __construct()
 {
     $this->config = ['url' => 'https://wpcom-themes.svn.automattic.com/', 'provider-paths' => ['/'], 'package-paths' => [''], 'package-types' => ['wordpress-theme' => 'wordpress-com'], 'name-filter' => [$this, 'filterProvider'], 'version-filter' => [$this, 'filterVersion'], 'package-filter' => [$this, 'filterPackage'], 'search-handler' => [$this, 'search'], 'cache-handler' => [$this, 'cache'], 'cache-ttl' => 604800, 'trust-cert' => true];
     parent::__construct();
 }
Example #3
0
 function __construct()
 {
     $this->config = ['url' => 'https://themes.svn.wordpress.org/', 'package-types' => ['wordpress-theme' => 'wordpress-theme'], 'package-filter' => [$this, 'filterPackage'], 'search-handler' => [$this, 'search'], 'cache-handler' => [$this, 'cache'], 'cache-ttl' => 'config', 'trust-cert' => true];
     parent::__construct();
 }
Example #4
0
 function __construct()
 {
     // set here so that we have a reference to $this
     $this->config = ['url' => 'https://plugins.svn.wordpress.org/', 'package-paths' => ['/tags/', '/trunk'], 'package-types' => ['wordpress-plugin' => 'wordpress-plugin', 'wordpress-muplugin' => 'wordpress-muplugin'], 'package-filter' => [$this, 'filterPackage'], 'search-handler' => [$this, 'search'], 'cache-handler' => [$this, 'cache'], 'cache-ttl' => 'config', 'trust-cert' => true];
     parent::__construct();
 }