Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
D
Dwoo
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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Common
Dwoo
Commits
7093aa38
Commit
7093aa38
authored
Feb 05, 2009
by
seldaek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Dwoo_Template::$chmod is now enforced for directories as well
fixes #18 git-svn-id:
svn://dwoo.org/dwoo/trunk@244
0598d79b-80c4-4d41-97ba-ac86fbbd088b
parent
19287dec
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
6 deletions
+21
-6
CHANGELOG
CHANGELOG
+1
-0
String.php
lib/Dwoo/Template/String.php
+20
-6
No files found.
CHANGELOG
View file @
7093aa38
...
...
@@ -10,6 +10,7 @@
* Fixed assignments not handling multi-line values correctly
* Fixed parameter parsing issue when a plugin name was all uppercased
* Fixes assignments failing with autoEscape enabled
* Dwoo_Template::$chmod is now enforced for directories as well (#18)
[2008-12-24] 1.0.1
* Direct assignments like {$foo = 5} now allow spaces around the operator
...
...
lib/Dwoo/Template/String.php
View file @
7093aa38
...
...
@@ -299,7 +299,7 @@ class Dwoo_Template_String implements Dwoo_ITemplate
fwrite
(
$file
,
$output
);
fclose
(
$file
);
$this
->
makeDirectory
(
dirname
(
$cachedFile
));
$this
->
makeDirectory
(
dirname
(
$cachedFile
)
,
$cacheDir
);
if
(
!@
rename
(
$temp
,
$cachedFile
))
{
@
unlink
(
$cachedFile
);
@
rename
(
$temp
,
$cachedFile
);
...
...
@@ -365,7 +365,7 @@ class Dwoo_Template_String implements Dwoo_ITemplate
$compiler
->
setCustomPlugins
(
$dwoo
->
getCustomPlugins
());
$compiler
->
setSecurityPolicy
(
$dwoo
->
getSecurityPolicy
());
$this
->
makeDirectory
(
dirname
(
$compiledFile
));
$this
->
makeDirectory
(
dirname
(
$compiledFile
)
,
$dwoo
->
getCompileDir
()
);
file_put_contents
(
$compiledFile
,
$compiler
->
compile
(
$dwoo
,
$this
));
if
(
$this
->
chmod
!==
null
)
{
chmod
(
$compiledFile
,
$this
->
chmod
);
...
...
@@ -455,17 +455,31 @@ class Dwoo_Template_String implements Dwoo_ITemplate
* ensures the given path exists
*
* @param string $path any path
* @param string $baseDir the base directory where the directory is created
* ($path must still contain the full path, $baseDir
* is only used for unix permissions)
*/
protected
function
makeDirectory
(
$path
)
protected
function
makeDirectory
(
$path
,
$baseDir
=
null
)
{
if
(
is_dir
(
$path
)
===
true
)
{
return
;
}
if
(
$this
->
chmod
!
==
null
)
{
mkdir
(
$path
,
$this
->
chmod
,
true
)
;
if
(
$this
->
chmod
=
==
null
)
{
$chmod
=
0777
;
}
else
{
mkdir
(
$path
,
0777
,
true
);
$chmod
=
$this
->
chmod
;
}
mkdir
(
$path
,
$chmod
,
true
);
// enforce the correct mode for all directories created
if
(
strpos
(
PHP_OS
,
'WIN'
)
!==
0
&&
$baseDir
!==
null
)
{
$path
=
strtr
(
str_replace
(
$baseDir
,
''
,
$path
),
'\\'
,
'/'
);
$folders
=
explode
(
'/'
,
$path
);
foreach
(
$folders
as
$folder
)
{
$baseDir
.=
$folder
.
DIRECTORY_SEPARATOR
;
chmod
(
$baseDir
,
$chmod
);
}
}
}
}
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