Author: ornicar2
Date: 2010-02-11 00:53:58 +0100 (Thu, 11 Feb 2010)
New Revision: 27871
Modified:
plugins/diemPlugin/trunk/dmCorePlugin/config/dm/config.yml
plugins/diemPlugin/trunk/dmCorePlugin/data/skeleton/config/dm/config.yml
plugins/diemPlugin/trunk/dmCorePlugin/lib/config/dmFactoryConfigHandler.php
plugins/diemPlugin/trunk/dmCorePlugin/lib/core/dmBase.php
Log:
[Diem]
- Swift mailer is now loaded by default on each request.
You can disable it (performance boost) in config/dm/config.yml (see
dmCorePlugin/config/dm/config.yml, performance section).
If you disable Swift by default, you can enable it on demand by calling
dm::enableMailer();
Modified: plugins/diemPlugin/trunk/dmCorePlugin/config/dm/config.yml
===================================================================
--- plugins/diemPlugin/trunk/dmCorePlugin/config/dm/config.yml 2010-02-10
23:00:37 UTC (rev 27870)
+++ plugins/diemPlugin/trunk/dmCorePlugin/config/dm/config.yml 2010-02-10
23:53:58 UTC (rev 27871)
@@ -8,7 +8,7 @@
js:
compress: true # (RECOMMENDED) Performance : Minifies
javascripts and put them into a single compressed file
- cdn: # use cdn to load libraries
+ cdn:
enabled: false # Will use cdn to load javascript
libraries
lib.jquery:
'http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js'
head_inclusion: [ ] # If you want some libraries to be
included in the <head> section,
@@ -35,7 +35,7 @@
# More configuration : please use
ProjectConfiguration::configureDoctrine method
identifier_fields: [ name, title, slug, subject, id ] # Fields used to
represent a record with a string
cache_enabled: true # (RECOMMENDED) Use doctrine query
cache. No side effect, automatic cache invalidation )
- cache_result_enabled: true # (RECOMMENDED) Use doctrine result
cache where query->dmCache() is called
+ cache_result_enabled: false # Use doctrine result cache where
query->dmCache() is called
cache_result_enabled_default: false # Use doctrine result cache on every
query ( performance gain, possible issues )
backup: # keep a copy of files modified by Dm
code editors
@@ -58,6 +58,10 @@
locks: # whether to enable real time resource
locks
enabled: <?php echo sfConfig::get('sf_debug') ? "false\n" :
"true\n"; ?>
timeout: 10 # time in seconds to consider a user
is no more active on the page
+
+ performance:
+ enable_mailer: true # Set to false to disable Swift
loading: significant performance boost.
+ # If set to false, you can enable the
mailer on demand with dm::enableMailer()
###### dm internal config ######
Modified:
plugins/diemPlugin/trunk/dmCorePlugin/data/skeleton/config/dm/config.yml
===================================================================
--- plugins/diemPlugin/trunk/dmCorePlugin/data/skeleton/config/dm/config.yml
2010-02-10 23:00:37 UTC (rev 27870)
+++ plugins/diemPlugin/trunk/dmCorePlugin/data/skeleton/config/dm/config.yml
2010-02-10 23:53:58 UTC (rev 27871)
@@ -9,7 +9,7 @@
js:
compress: true # (RECOMMENDED) Performance : Minifies
javascripts and put them into a single compressed file
cdn:
- enabled: false # (RECOMMENDED) uses google cdn to
load jQuery
+ enabled: false # Uses google cdn to load jQuery
head_inclusion: [ ] # If you want some libraries to be
included in the <head> section,
# declare them here. This degrades
performances but is required
# by some symfony plugins that embed
jQuery code.
@@ -22,5 +22,7 @@
# More configuration : please use
ProjectConfiguration::configureDoctrine* methods
identifier_fields: [ name, title, subject, author, id ] # Fields used
to represent a record with a string
cache_enabled: true # (RECOMMENDED) Use doctrine query
cache. No side effect, automatic cache invalidation )
- cache_result_enabled: false # Use doctrine result cache when
query->dmCache() is called
- cache_result_enabled_default: false # Use doctrine result cache on every
query ( performance gain, possible issues )
\ No newline at end of file
+
+ performance:
+ enable_mailer: true # Set to false to disable Swift
loading: significant performance boost.
+ # If set to false, you can enable the
mailer on demand with dm::enableMailer()
\ No newline at end of file
Modified:
plugins/diemPlugin/trunk/dmCorePlugin/lib/config/dmFactoryConfigHandler.php
===================================================================
--- plugins/diemPlugin/trunk/dmCorePlugin/lib/config/dmFactoryConfigHandler.php
2010-02-10 23:00:37 UTC (rev 27870)
+++ plugins/diemPlugin/trunk/dmCorePlugin/lib/config/dmFactoryConfigHandler.php
2010-02-10 23:53:58 UTC (rev 27871)
@@ -6,9 +6,12 @@
public function execute($configFiles)
{
$code = parent::execute($configFiles);
-
- $code = str_replace('Swift::registerAutoload();', '//
Swift::registerAutoload();', $code);
- $code = str_replace('sfMailer::initialize();', '//
sfMailer::initialize();', $code);
+
+ if(!sfConfig::get('dm_performance_enable_mailer', true))
+ {
+ $code = str_replace('Swift::registerAutoload();', '//
Swift::registerAutoload();', $code);
+ $code = str_replace('sfMailer::initialize();', '//
sfMailer::initialize();', $code);
+ }
return $code;
}
Modified: plugins/diemPlugin/trunk/dmCorePlugin/lib/core/dmBase.php
===================================================================
--- plugins/diemPlugin/trunk/dmCorePlugin/lib/core/dmBase.php 2010-02-10
23:00:37 UTC (rev 27870)
+++ plugins/diemPlugin/trunk/dmCorePlugin/lib/core/dmBase.php 2010-02-10
23:53:58 UTC (rev 27871)
@@ -49,6 +49,18 @@
{
return self::$startTime;
}
+
+ /**
+ * Loads the Swift mailer
+ */
+ public static function enableMailer()
+ {
+ if(!class_exists('Swift_Message'))
+ {
+ Swift::registerAutoload();
+ sfMailer::initialize();
+ }
+ }
/**
* All context creations are made here.
@@ -153,7 +165,7 @@
return dmContext::getInstance()->getConfiguration()->loadHelpers($helpers);
}
- public function getHelper()
+ public static function getHelper()
{
return dmContext::getInstance()->getHelper();
}
--
You received this message because you are subscribed to the Google Groups
"symfony SVN" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/symfony-svn?hl=en.