Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 562ca3d

Browse files
Merge branch '2.3' into 2.4
* 2.3: add missing options revert #11510, moved to 2.6 [WebProfilerBundle] Fixed double height of canvas
2 parents 16c94d2 + b674e67 commit 562ca3d

File tree

4 files changed

+12
-100
lines changed

4 files changed

+12
-100
lines changed

src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/time.html.twig

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,6 @@
193193
x = request.left * ratio + space, // position
194194
canvas = cache.get(elementId) || cache.set(elementId, document.getElementById(elementId)),
195195
ctx = canvas.getContext("2d"),
196-
backingStoreRatio,
197196
scaleRatio,
198197
devicePixelRatio;
199198
@@ -206,11 +205,8 @@
206205
207206
// For retina displays so text and boxes will be crisp
208207
devicePixelRatio = window.devicePixelRatio == "undefined" ? 1 : window.devicePixelRatio;
209-
backingStoreRatio = ctx.webkitBackingStorePixelRatio == "undefined" ? 1 : ctx.webkitBackingStorePixelRatio;
210208
scaleRatio = devicePixelRatio / 1;
211209
212-
canvasHeight += gapPerEvent * drawableEvents.length;
213-
214210
canvas.width = width * scaleRatio;
215211
canvas.height = canvasHeight * scaleRatio;
216212
@@ -363,7 +359,7 @@
363359
var self = this;
364360
365361
_requests.forEach(function(request) {
366-
self.drawOne(request, maxRequestTime, threshold, width);
362+
self.drawOne(request, _maxRequestTime, threshold, width);
367363
});
368364
};
369365

src/Symfony/Component/HttpFoundation/Session/Storage/Handler/MongoDbSessionHandler.php

Lines changed: 7 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,9 @@ public function __construct($mongo, array $options)
6262
$this->mongo = $mongo;
6363

6464
$this->options = array_merge(array(
65-
'id_field' => '_id',
66-
'data_field' => 'data',
67-
'time_field' => 'time',
68-
'expiry_field' => false,
65+
'id_field' => '_id',
66+
'data_field' => 'data',
67+
'time_field' => 'time',
6968
), $options);
7069
}
7170

@@ -110,9 +109,6 @@ public function gc($maxlifetime)
110109
*
111110
* See: http://docs.mongodb.org/manual/tutorial/expire-data/
112111
*/
113-
if (false !== $this->options['expiry_field']) {
114-
return true;
115-
}
116112
$time = new \MongoDate(time() - $maxlifetime);
117113

118114
$this->getCollection()->remove(array(
@@ -127,27 +123,12 @@ public function gc($maxlifetime)
127123
*/
128124
public function write($sessionId, $data)
129125
{
130-
$fields = array(
131-
$this->options['data_field'] => new \MongoBinData($data, \MongoBinData::BYTE_ARRAY),
132-
$this->options['time_field'] => new \MongoDate(),
133-
);
134-
135-
/* Note: As discussed in the gc method of this class. You can utilise
136-
* TTL collections in MongoDB 2.2+
137-
* We are setting the "expiry_field" as part of the write operation here
138-
* You will need to create the index on your collection that expires documents
139-
* at that time
140-
* e.g.
141-
* db.MySessionCollection.ensureIndex( { "expireAt": 1 }, { expireAfterSeconds: 0 } )
142-
*/
143-
if (false !== $this->options['expiry_field']) {
144-
$expiry = new \MongoDate(time() + (int) ini_get('session.gc_maxlifetime'));
145-
$fields[$this->options['expiry_field']] = $expiry;
146-
}
147-
148126
$this->getCollection()->update(
149127
array($this->options['id_field'] => $sessionId),
150-
array('$set' => $fields),
128+
array('$set' => array(
129+
$this->options['data_field'] => new \MongoBinData($data, \MongoBinData::BYTE_ARRAY),
130+
$this->options['time_field'] => new \MongoDate(),
131+
)),
151132
array('upsert' => true, 'multiple' => false)
152133
);
153134

src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/MongoDbSessionHandlerTest.php

Lines changed: 3 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ protected function setUp()
4141
'data_field' => 'data',
4242
'time_field' => 'time',
4343
'database' => 'sf2-test',
44-
'collection' => 'session-test',
44+
'collection' => 'session-test'
4545
);
4646

4747
$this->storage = new MongoDbSessionHandler($this->mongo, $this->options);
@@ -100,45 +100,6 @@ public function testWrite()
100100
$that->assertInstanceOf('MongoDate', $data[$this->options['time_field']]);
101101
}
102102

103-
public function testWriteWhenUsingExpiresField()
104-
{
105-
$this->options = array(
106-
'id_field' => '_id',
107-
'data_field' => 'data',
108-
'time_field' => 'time',
109-
'database' => 'sf2-test',
110-
'collection' => 'session-test',
111-
'expiry_field' => 'expiresAt'
112-
);
113-
114-
$this->storage = new MongoDbSessionHandler($this->mongo, $this->options);
115-
116-
$collection = $this->createMongoCollectionMock();
117-
118-
$this->mongo->expects($this->once())
119-
->method('selectCollection')
120-
->with($this->options['database'], $this->options['collection'])
121-
->will($this->returnValue($collection));
122-
123-
$that = $this;
124-
$data = array();
125-
126-
$collection->expects($this->once())
127-
->method('update')
128-
->will($this->returnCallback(function ($criteria, $updateData, $options) use ($that, &$data) {
129-
$that->assertEquals(array($that->options['id_field'] => 'foo'), $criteria);
130-
$that->assertEquals(array('upsert' => true, 'multiple' => false), $options);
131-
132-
$data = $updateData['$set'];
133-
}));
134-
135-
$this->assertTrue($this->storage->write('foo', 'bar'));
136-
137-
$this->assertEquals('bar', $data[$this->options['data_field']]->bin);
138-
$that->assertInstanceOf('MongoDate', $data[$this->options['time_field']]);
139-
$that->assertInstanceOf('MongoDate', $data[$this->options['expiry_field']]);
140-
}
141-
142103
public function testReplaceSessionData()
143104
{
144105
$collection = $this->createMongoCollectionMock();
@@ -193,36 +154,10 @@ public function testGc()
193154
->method('remove')
194155
->will($this->returnCallback(function ($criteria) use ($that) {
195156
$that->assertInstanceOf('MongoDate', $criteria[$that->options['time_field']]['$lt']);
196-
$that->assertGreaterThanOrEqual(time() - 1, $criteria[$that->options['time_field']]['$lt']->sec);
157+
$that->assertGreaterThanOrEqual(time() - -1, $criteria[$that->options['time_field']]['$lt']->sec);
197158
}));
198159

199-
$this->assertTrue($this->storage->gc(1));
200-
}
201-
202-
public function testGcWhenUsingExpiresField()
203-
{
204-
$this->options = array(
205-
'id_field' => '_id',
206-
'data_field' => 'data',
207-
'time_field' => 'time',
208-
'database' => 'sf2-test',
209-
'collection' => 'session-test',
210-
'expiry_field' => 'expiresAt'
211-
);
212-
213-
$this->storage = new MongoDbSessionHandler($this->mongo, $this->options);
214-
215-
$collection = $this->createMongoCollectionMock();
216-
217-
$this->mongo->expects($this->never())
218-
->method('selectCollection');
219-
220-
$that = $this;
221-
222-
$collection->expects($this->never())
223-
->method('remove');
224-
225-
$this->assertTrue($this->storage->gc(1));
160+
$this->assertTrue($this->storage->gc(-1));
226161
}
227162

228163
public function testGetConnection()

src/Symfony/Component/Validator/Resources/translations/validators.nl.xlf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@
180180
</trans-unit>
181181
<trans-unit id="48">
182182
<source>This value should have exactly {{ limit }} character.|This value should have exactly {{ limit }} characters.</source>
183-
<target>Deze waarde moet exact {{ limit }} tekens lang zijn.</target>
183+
<target>Deze waarde moet exact {{ limit }} teken lang zijn.|Deze waarde moet exact {{ limit }} tekens lang zijn.</target>
184184
</trans-unit>
185185
<trans-unit id="49">
186186
<source>The file was only partially uploaded.</source>

0 commit comments

Comments
 (0)