Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
yii2
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Rotua Panjaitan
yii2
Commits
0dfc8b1f
Commit
0dfc8b1f
authored
Jan 24, 2014
by
Qiang Xue
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactored BaseMailer about message file name generation.
parent
370b0564
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
2 deletions
+10
-2
BaseMailer.php
framework/mail/BaseMailer.php
+10
-2
No files found.
framework/mail/BaseMailer.php
View file @
0dfc8b1f
...
...
@@ -297,14 +297,22 @@ abstract class BaseMailer extends Component implements MailerInterface, ViewCont
if
(
$this
->
fileTransportCallback
!==
null
)
{
$file
=
$path
.
'/'
.
call_user_func
(
$this
->
fileTransportCallback
,
$this
,
$message
);
}
else
{
$time
=
microtime
(
true
);
$file
=
$path
.
'/'
.
date
(
'Ymd-His-'
,
$time
)
.
sprintf
(
'%04d'
,
(
int
)((
$time
-
(
int
)
$time
)
*
10000
))
.
'-'
.
sprintf
(
'%04d'
,
mt_rand
(
0
,
10000
))
.
'.eml'
;
$file
=
$this
->
generateMessageFileName
();
}
file_put_contents
(
$file
,
$message
->
toString
());
return
true
;
}
/**
* @return string the file name for saving the message when [[useFileTransport]] is true.
*/
public
function
generateMessageFileName
()
{
$time
=
microtime
(
true
);
return
date
(
'Ymd-His-'
,
$time
)
.
sprintf
(
'%04d'
,
(
int
)((
$time
-
(
int
)
$time
)
*
10000
))
.
'-'
.
sprintf
(
'%04d'
,
mt_rand
(
0
,
10000
))
.
'.eml'
;
}
/**
* Finds the view file corresponding to the specified relative view name.
* This method will return the view file by prefixing the view name with [[viewPath]].
* @param string $view a relative view name. The name does NOT start with a slash.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment