Merge branch '3.2'
* 3.2: minor fix purge both http and https from http cache store
This commit is contained in:
commit
c958403dfa
@ -11,7 +11,7 @@
|
|||||||
|
|
||||||
namespace Symfony\Bridge\Doctrine\Tests\DependencyInjection;
|
namespace Symfony\Bridge\Doctrine\Tests\DependencyInjection;
|
||||||
|
|
||||||
use Symfony\Bundle\FrameworkBundle\Tests\TestCase;
|
use PHPUnit\Framework\TestCase;
|
||||||
use Symfony\Component\DependencyInjection\Definition;
|
use Symfony\Component\DependencyInjection\Definition;
|
||||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||||
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBag;
|
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBag;
|
||||||
|
@ -72,7 +72,7 @@ class EntityTypePerformanceTest extends FormPerformanceTestCase
|
|||||||
$ids = range(1, 300);
|
$ids = range(1, 300);
|
||||||
|
|
||||||
foreach ($ids as $id) {
|
foreach ($ids as $id) {
|
||||||
$name = 65 + chr($id % 57);
|
$name = 65 + (int) chr($id % 57);
|
||||||
$this->em->persist(new SingleIntIdEntity($id, $name));
|
$this->em->persist(new SingleIntIdEntity($id, $name));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -314,6 +314,23 @@ class Store implements StoreInterface
|
|||||||
return unserialize($entries);
|
return unserialize($entries);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Purges data for the given URL.
|
||||||
|
*
|
||||||
|
* This method purges both the HTTP and the HTTPS version of the cache entry.
|
||||||
|
*
|
||||||
|
* @param string $url A URL
|
||||||
|
*
|
||||||
|
* @return bool true if the URL exists with either HTTP or HTTPS scheme and has been purged, false otherwise
|
||||||
|
*/
|
||||||
|
public function purge($url)
|
||||||
|
{
|
||||||
|
$http = preg_replace('#^https#', 'http', $url);
|
||||||
|
$https = preg_replace('#^http#', 'https', $url);
|
||||||
|
|
||||||
|
return $this->doPurge($http) || $this->doPurge($https);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Purges data for the given URL.
|
* Purges data for the given URL.
|
||||||
*
|
*
|
||||||
@ -321,10 +338,9 @@ class Store implements StoreInterface
|
|||||||
*
|
*
|
||||||
* @return bool true if the URL exists and has been purged, false otherwise
|
* @return bool true if the URL exists and has been purged, false otherwise
|
||||||
*/
|
*/
|
||||||
public function purge($url)
|
private function doPurge($url)
|
||||||
{
|
{
|
||||||
$key = $this->getCacheKey(Request::create($url));
|
$key = $this->getCacheKey(Request::create($url));
|
||||||
|
|
||||||
if (isset($this->locks[$key])) {
|
if (isset($this->locks[$key])) {
|
||||||
flock($this->locks[$key], LOCK_UN);
|
flock($this->locks[$key], LOCK_UN);
|
||||||
fclose($this->locks[$key]);
|
fclose($this->locks[$key]);
|
||||||
|
Reference in New Issue
Block a user