Skip to content

Commit 088b946

Browse files
committed
Merge pull request #17 from damienalexandre/sfnomailer
Allow to disable SwiftMailer for real by using sfNoMailer
2 parents 916c251 + 52c233e commit 088b946

File tree

3 files changed

+88
-3
lines changed

3 files changed

+88
-3
lines changed

CHANGELOG.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@ CHANGELOG
66
* optimized sfCompileConfigHandler and added unit tests
77
* added possibility to use sfAPCCache without APC (same as sfNoCache)
88
* added logger into service container for command
9-
* optimized sfPatternRouting cache with unserialise sfRoute objects on demand, huge gain with lookup_cache_dedicated_keys
9+
* optimized sfPatternRouting cache with unserialise sfRoute objects on demand, huge gain with `lookup_cache_dedicated_keys`
1010
* added sf_cli core configuration
1111
* added default option --no-debug for tasks (usefull for project:optimize task)
12-
* used is_file instead of file_exists in sfFileCache, sfAutoload, sfApplicationConfiguration, sfProjectConfiguration and sfSessionTestStorage classes
12+
* used `is_file` instead of `file_exists` in sfFileCache, sfAutoload, sfApplicationConfiguration, sfProjectConfiguration and sfSessionTestStorage classes
1313
* added sfBaseTask::isVerbose() method
1414
* fixed "plugin:publish-assets" task generate absolute symlinks
1515
* fixed "project:optimize" task: file permissions, configurable environment and module generation
@@ -34,7 +34,7 @@ CHANGELOG
3434
* better code coverage for sfWebRequest class unit tests
3535
* added parameters proxy to sfWebRequest::getClientIp() method (default true)
3636
* introduced trust_proxy option on sfWebRequest (default true)
37-
* added call to fastcgi_finish_request() function if available on sfWebResponse::run() method
37+
* added call to `fastcgi_finish_request()` function if available on sfWebResponse::run() method
3838
* added possibility to launch bin/coverage task for only one class
3939
* added sfRequest::getOption() method
4040
* used SQLite 3 for php 5.3 or later, as it's required for php 5.4
@@ -74,6 +74,7 @@ CHANGELOG
7474
* imported sfServiceContainer component
7575
* replaced embedded swiftmailer by upstream submodule of swiftmailer 4.1
7676
* removed sfPropelPlugin
77+
* add `sfNoMailer` class for application without mail
7778

7879
05/30/12: Versions 1.4.18
7980
-------------------------

WHATS_NEW.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,17 @@ Configuration
167167

168168
A new configuration `sf_upload_dir_name` contains 'uploads' have been added.
169169

170+
Performance
171+
-----------
172+
173+
### Disable SwiftMailer for real
174+
175+
You can now completely disable SwiftMailer (which is initialized on **each** request by default) by using
176+
the new `sfNoMailer` class in your factories.yml:
177+
178+
mailer:
179+
class: sfNoMailer
180+
170181
Test
171182
----
172183

lib/mailer/sfNoMailer.class.php

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
<?php
2+
3+
/**
4+
* sfMailer is the main entry point for the mailer system - sfNoMailer disable all mailer features.
5+
*/
6+
class sfNoMailer
7+
{
8+
public function __construct(sfEventDispatcher $dispatcher, $options)
9+
{
10+
}
11+
12+
public function getRealtimeTransport()
13+
{
14+
return null;
15+
}
16+
17+
public function setRealtimeTransport(Swift_Transport $transport)
18+
{
19+
}
20+
21+
public function getLogger()
22+
{
23+
return null;
24+
}
25+
26+
public function setLogger($logger)
27+
{
28+
}
29+
30+
public function getDeliveryStrategy()
31+
{
32+
return null;
33+
}
34+
35+
public function getDeliveryAddress()
36+
{
37+
return null;
38+
}
39+
40+
public function setDeliveryAddress($address)
41+
{
42+
}
43+
44+
public function compose($from = null, $to = null, $subject = null, $body = null)
45+
{
46+
return null;
47+
}
48+
49+
public function composeAndSend($from, $to, $subject, $body)
50+
{
51+
return null;
52+
}
53+
54+
public function sendNextImmediately()
55+
{
56+
return null;
57+
}
58+
59+
public function send(Swift_Mime_Message $message, &$failedRecipients = null)
60+
{
61+
return null;
62+
}
63+
64+
public function flushQueue(&$failedRecipients = null)
65+
{
66+
return null;
67+
}
68+
69+
public function getSpool()
70+
{
71+
return null;
72+
}
73+
}

0 commit comments

Comments
 (0)