Skip to content

Commit 11c7b17

Browse files
authored
Merge pull request #708 from Geolim4/master
Released 7.1.0
2 parents 2cb775c + 53b3961 commit 11c7b17

File tree

7 files changed

+132
-12
lines changed

7 files changed

+132
-12
lines changed

.github/stale.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,13 @@ exemptLabels:
77
- "[-_-] In Process"
88
- ">_< Working & Scheduled"
99
# Label to use when marking an issue as stale
10-
staleLabel: wontfix
10+
staleLabel: ">_< Wontfix"
1111
# Comment to post when marking an issue as stale. Set to `false` to disable
1212
markComment: >
1313
This issue has been automatically marked as stale because it has not had
1414
recent activity. It will be closed if no further activity occurs. Thank you
1515
for your contributions.
1616
# Comment to post when closing a stale issue. Set to `false` to disable
17-
closeComment: false
17+
closeComment: >
18+
This issue has now been automatically closed because of complete inactivity. Feel free to comment otu below to keep it open. Thank you
19+
for your contributions.

CHANGELOG.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,23 @@
1+
## 7.1.0
2+
#### _"Wake the rust"_
3+
##### 15 september 2019
4+
- __Drivers__
5+
- Fixed #692 // MongoDB driver DNS seedlist format (@Geolim4)
6+
- Fixed #679 // TLS connexion for (P)Redis (@Geolim4)
7+
- Fixed #689 // (P)redis persistent / pooled connections (@Geolim4)
8+
- Fixed #680 // APC driverClear fails (@Geolim4)
9+
- Fixed #699 // Fatal type error with ssdb-server >1.9.7 (@dmz86)
10+
- Fixed #694 // Files driver rare bug (@Geolim4)
11+
- __Helpers__
12+
- Fixed #700 // Psr16Adapter::deleteMultiple/getMultiple converts $keys to an array (@bylexus)
13+
- Fixed #685 // Minor bug - fatal error in psr16 adapter if an exception is thrown (@MaximilianKresse)
14+
- __Global__
15+
16+
- __Misc__
17+
- Updated "stale" policy (@geolim4)
18+
- Added Security Policy (@geolim4)
19+
- Fixed #695 // Typo in docs/examples/files.php (@hiroin)
20+
121
## 7.0.5
222
#### _"Rusted"_
323
##### 3 march 2019

SECURITY.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Security Policy
2+
If you discover any vulnerability please be aware of the following table of supported versions below.
3+
Then feel free to contact me at the email address provided in the bottom of that page.
4+
5+
## Supported Versions
6+
| Version | End of support | End of life |
7+
| ------- | -------------------- | ------------------ |
8+
| 8.0 | Not yet planned | Not yet planned |
9+
| 7.1 | July 2021 | July 2022 |
10+
| 7.0 | July 2019 | July 2020 |
11+
| 6.0 | July 2020 | July 2021 |
12+
| 5.0 | July 2018 | July 2019 |
13+
| 4.0 | July 2017 | January 2018 |
14+
| < 4.0 | N/A | N/A |
15+
16+
More details on the [Uncyclo](https://github.com/PHPSocialNetwork/phpfastcache/wiki/%5BV4%CB%96%5D-Global-support-timeline)
17+
18+
## Reporting a Vulnerability
19+
If you discover any security vulnerability contact me at contact#at#geolim4.com with a subject formatted like that:\
20+
`[PHPFASTCACHE][VULNERABILITY] Your subject goes here`
21+
22+
Thanks in advance for taking the time to report me that in private.

lib/Phpfastcache/Drivers/Mongodb/Config.php

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,11 @@ class Config extends ConfigurationOption
7070
*/
7171
protected $driverOptions = [];
7272

73+
/**
74+
* @var string
75+
*/
76+
protected $protocol = 'mongodb';
77+
7378
/**
7479
* @return string
7580
*/
@@ -250,4 +255,22 @@ public function setDriverOptions(array $driverOptions): self
250255
$this->driverOptions = $driverOptions;
251256
return $this;
252257
}
258+
259+
/**
260+
* @return string
261+
*/
262+
public function getProtocol(): string
263+
{
264+
return $this->protocol;
265+
}
266+
267+
/**
268+
* @param string $protocol
269+
* @return self
270+
*/
271+
public function setProtocol(string $protocol): self
272+
{
273+
$this->protocol = $protocol;
274+
return $this;
275+
}
253276
}

lib/Phpfastcache/Drivers/Mongodb/Driver.php

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -228,28 +228,29 @@ protected function buildConnectionURI($databaseName = ''): string
228228
$servers = $this->getConfig()->getServers();
229229
$options = $this->getConfig()->getOptions();
230230

231+
$protocol = $this->getConfig()->getProtocol();
231232
$host = $this->getConfig()->getHost();
232233
$port = $this->getConfig()->getPort();
233234
$username = $this->getConfig()->getUsername();
234235
$password = $this->getConfig()->getPassword();
235236

236237
if( \count($servers) > 0 ){
237-
$host = \array_reduce($servers, function($carry, $data){
238+
$host = \array_reduce($servers, static function($carry, $data){
238239
$carry .= ($carry === '' ? '' : ',').$data['host'].':'.$data['port'];
239240
return $carry;
240241
}, '');
241242
$port = false;
242243
}
243244

244-
return implode('', [
245-
'mongodb://',
246-
($username ?: ''),
247-
($password ? ":{$password}" : ''),
248-
($username ? '@' : ''),
245+
return \implode('', [
246+
"{$protocol}://",
247+
$username ?: '',
248+
$password ? ":{$password}" : '',
249+
$username ? '@' : '',
249250
$host,
250-
($port !== 27017 && $port !== false ? ":{$port}" : ''),
251-
($databaseName ? "/{$databaseName}" : ''),
252-
(\count($options) > 0 ? '?'.\http_build_query($options) : ''),
251+
$port !== 27017 && $port !== false ? ":{$port}" : '',
252+
$databaseName ? "/{$databaseName}" : '',
253+
\count($options) > 0 ? '?'.\http_build_query($options) : '',
253254
]);
254255
}
255256

lib/Phpfastcache/Drivers/Predis/Config.php

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
namespace Phpfastcache\Drivers\Predis;
1818

1919
use Phpfastcache\Config\ConfigurationOption;
20+
use Phpfastcache\Exceptions\PhpfastcacheInvalidConfigurationException;
2021

2122
class Config extends ConfigurationOption
2223
{
@@ -55,6 +56,16 @@ class Config extends ConfigurationOption
5556
*/
5657
protected $timeout = 5;
5758

59+
/**
60+
* @var bool
61+
*/
62+
protected $persistent = false;
63+
64+
/**
65+
* @var string
66+
*/
67+
protected $scheme = 'unix';
68+
5869
/**
5970
* @return string
6071
*/
@@ -196,4 +207,44 @@ public function setTimeout(int $timeout): self
196207
$this->timeout = $timeout;
197208
return $this;
198209
}
210+
211+
/**
212+
* @return bool
213+
*/
214+
public function isPersistent(): bool
215+
{
216+
return $this->persistent;
217+
}
218+
219+
/**
220+
* @param bool $persistent
221+
* @return Config
222+
*/
223+
public function setPersistent(bool $persistent): Config
224+
{
225+
$this->persistent = $persistent;
226+
return $this;
227+
}
228+
229+
/**
230+
* @return string
231+
*/
232+
public function getScheme(): string
233+
{
234+
return $this->scheme;
235+
}
236+
237+
/**
238+
* @param string $scheme
239+
* @return Config
240+
* @throws PhpfastcacheInvalidConfigurationException
241+
*/
242+
public function setScheme(string $scheme): Config
243+
{
244+
if(!\in_array($scheme, ['unix', 'tls'], true)){
245+
throw new PhpfastcacheInvalidConfigurationException('Invalid scheme: ' . $scheme);
246+
}
247+
$this->scheme = $scheme;
248+
return $this;
249+
}
199250
}

lib/Phpfastcache/Drivers/Predis/Driver.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,8 @@ protected function driverConnect(): bool
8181

8282
if (!empty($this->getConfig()->getPath())) {
8383
$this->instance = new PredisClient([
84-
'scheme' => 'unix',
84+
'scheme' => $this->getConfig()->getScheme(),
85+
'persistent' => $this->getConfig()->isPersistent(),
8586
'timeout' => $this->getConfig()->getTimeout(),
8687
'path' => $this->getConfig()->getPath(),
8788
], $options);

0 commit comments

Comments
 (0)