Skip to content

Commit

Permalink
Merge pull request #708 from Geolim4/master
Browse files Browse the repository at this point in the history
Released 7.1.0
  • Loading branch information
Geolim4 authored Sep 15, 2019
2 parents 2cb775c + 53b3961 commit 11c7b17
Show file tree
Hide file tree
Showing 7 changed files with 132 additions and 12 deletions.
6 changes: 4 additions & 2 deletions .github/stale.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,13 @@ exemptLabels:
- "[-_-] In Process"
- ">_< Working & Scheduled"
# Label to use when marking an issue as stale
staleLabel: wontfix
staleLabel: ">_< Wontfix"
# Comment to post when marking an issue as stale. Set to `false` to disable
markComment: >
This issue has been automatically marked as stale because it has not had
recent activity. It will be closed if no further activity occurs. Thank you
for your contributions.
# Comment to post when closing a stale issue. Set to `false` to disable
closeComment: false
closeComment: >
This issue has now been automatically closed because of complete inactivity. Feel free to comment otu below to keep it open. Thank you
for your contributions.
20 changes: 20 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,23 @@
## 7.1.0
#### _"Wake the rust"_
##### 15 september 2019
- __Drivers__
- Fixed #692 // MongoDB driver DNS seedlist format (@Geolim4)
- Fixed #679 // TLS connexion for (P)Redis (@Geolim4)
- Fixed #689 // (P)redis persistent / pooled connections (@Geolim4)
- Fixed #680 // APC driverClear fails (@Geolim4)
- Fixed #699 // Fatal type error with ssdb-server >1.9.7 (@dmz86)
- Fixed #694 // Files driver rare bug (@Geolim4)
- __Helpers__
- Fixed #700 // Psr16Adapter::deleteMultiple/getMultiple converts $keys to an array (@bylexus)
- Fixed #685 // Minor bug - fatal error in psr16 adapter if an exception is thrown (@MaximilianKresse)
- __Global__

- __Misc__
- Updated "stale" policy (@geolim4)
- Added Security Policy (@geolim4)
- Fixed #695 // Typo in docs/examples/files.php (@hiroin)

## 7.0.5
#### _"Rusted"_
##### 3 march 2019
Expand Down
22 changes: 22 additions & 0 deletions SECURITY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Security Policy
If you discover any vulnerability please be aware of the following table of supported versions below.
Then feel free to contact me at the email address provided in the bottom of that page.

## Supported Versions
| Version | End of support | End of life |
| ------- | -------------------- | ------------------ |
| 8.0 | Not yet planned | Not yet planned |
| 7.1 | July 2021 | July 2022 |
| 7.0 | July 2019 | July 2020 |
| 6.0 | July 2020 | July 2021 |
| 5.0 | July 2018 | July 2019 |
| 4.0 | July 2017 | January 2018 |
| < 4.0 | N/A | N/A |

More details on the [Wiki](https://github.com/PHPSocialNetwork/phpfastcache/wiki/%5BV4%CB%96%5D-Global-support-timeline)

## Reporting a Vulnerability
If you discover any security vulnerability contact me at contact#at#geolim4.com with a subject formatted like that:\
`[PHPFASTCACHE][VULNERABILITY] Your subject goes here`

Thanks in advance for taking the time to report me that in private.
23 changes: 23 additions & 0 deletions lib/Phpfastcache/Drivers/Mongodb/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,11 @@ class Config extends ConfigurationOption
*/
protected $driverOptions = [];

/**
* @var string
*/
protected $protocol = 'mongodb';

/**
* @return string
*/
Expand Down Expand Up @@ -250,4 +255,22 @@ public function setDriverOptions(array $driverOptions): self
$this->driverOptions = $driverOptions;
return $this;
}

/**
* @return string
*/
public function getProtocol(): string
{
return $this->protocol;
}

/**
* @param string $protocol
* @return self
*/
public function setProtocol(string $protocol): self
{
$this->protocol = $protocol;
return $this;
}
}
19 changes: 10 additions & 9 deletions lib/Phpfastcache/Drivers/Mongodb/Driver.php
Original file line number Diff line number Diff line change
Expand Up @@ -228,28 +228,29 @@ protected function buildConnectionURI($databaseName = ''): string
$servers = $this->getConfig()->getServers();
$options = $this->getConfig()->getOptions();

$protocol = $this->getConfig()->getProtocol();
$host = $this->getConfig()->getHost();
$port = $this->getConfig()->getPort();
$username = $this->getConfig()->getUsername();
$password = $this->getConfig()->getPassword();

if( \count($servers) > 0 ){
$host = \array_reduce($servers, function($carry, $data){
$host = \array_reduce($servers, static function($carry, $data){
$carry .= ($carry === '' ? '' : ',').$data['host'].':'.$data['port'];
return $carry;
}, '');
$port = false;
}

return implode('', [
'mongodb://',
($username ?: ''),
($password ? ":{$password}" : ''),
($username ? '@' : ''),
return \implode('', [
"{$protocol}://",
$username ?: '',
$password ? ":{$password}" : '',
$username ? '@' : '',
$host,
($port !== 27017 && $port !== false ? ":{$port}" : ''),
($databaseName ? "/{$databaseName}" : ''),
(\count($options) > 0 ? '?'.\http_build_query($options) : ''),
$port !== 27017 && $port !== false ? ":{$port}" : '',
$databaseName ? "/{$databaseName}" : '',
\count($options) > 0 ? '?'.\http_build_query($options) : '',
]);
}

Expand Down
51 changes: 51 additions & 0 deletions lib/Phpfastcache/Drivers/Predis/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
namespace Phpfastcache\Drivers\Predis;

use Phpfastcache\Config\ConfigurationOption;
use Phpfastcache\Exceptions\PhpfastcacheInvalidConfigurationException;

class Config extends ConfigurationOption
{
Expand Down Expand Up @@ -55,6 +56,16 @@ class Config extends ConfigurationOption
*/
protected $timeout = 5;

/**
* @var bool
*/
protected $persistent = false;

/**
* @var string
*/
protected $scheme = 'unix';

/**
* @return string
*/
Expand Down Expand Up @@ -196,4 +207,44 @@ public function setTimeout(int $timeout): self
$this->timeout = $timeout;
return $this;
}

/**
* @return bool
*/
public function isPersistent(): bool
{
return $this->persistent;
}

/**
* @param bool $persistent
* @return Config
*/
public function setPersistent(bool $persistent): Config
{
$this->persistent = $persistent;
return $this;
}

/**
* @return string
*/
public function getScheme(): string
{
return $this->scheme;
}

/**
* @param string $scheme
* @return Config
* @throws PhpfastcacheInvalidConfigurationException
*/
public function setScheme(string $scheme): Config
{
if(!\in_array($scheme, ['unix', 'tls'], true)){
throw new PhpfastcacheInvalidConfigurationException('Invalid scheme: ' . $scheme);
}
$this->scheme = $scheme;
return $this;
}
}
3 changes: 2 additions & 1 deletion lib/Phpfastcache/Drivers/Predis/Driver.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,8 @@ protected function driverConnect(): bool

if (!empty($this->getConfig()->getPath())) {
$this->instance = new PredisClient([
'scheme' => 'unix',
'scheme' => $this->getConfig()->getScheme(),
'persistent' => $this->getConfig()->isPersistent(),
'timeout' => $this->getConfig()->getTimeout(),
'path' => $this->getConfig()->getPath(),
], $options);
Expand Down

0 comments on commit 11c7b17

Please sign in to comment.