mirror of
https://github.com/ezyang/htmlpurifier.git
synced 2025-01-03 05:11:52 +00:00
Stop using umask to make definition cache. Fixes #32
This is not really the right way to solve the ACL problem, but there isn't really any reason we should be mucking about with the umask. Mucked around with the test case to make it pass, but I think it's probably a bit delicate now. Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
This commit is contained in:
parent
b307f3d9ef
commit
0c3e68dd03
@ -219,9 +219,15 @@ class HTMLPurifier_DefinitionCache_Serializer extends HTMLPurifier_DefinitionCac
|
|||||||
} elseif (!$this->_testPermissions($base, $chmod)) {
|
} elseif (!$this->_testPermissions($base, $chmod)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
$old = umask(0000);
|
|
||||||
mkdir($directory, $chmod);
|
mkdir($directory, $chmod);
|
||||||
umask($old);
|
if (!$this->_testPermissions($directory, $chmod)) {
|
||||||
|
trigger_error(
|
||||||
|
'Base directory ' . $base . ' does not exist,
|
||||||
|
please create or change using %Cache.SerializerPath',
|
||||||
|
E_USER_WARNING
|
||||||
|
);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
} elseif (!$this->_testPermissions($directory, $chmod)) {
|
} elseif (!$this->_testPermissions($directory, $chmod)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -211,14 +211,14 @@ class HTMLPurifier_DefinitionCache_SerializerTest extends HTMLPurifier_Definitio
|
|||||||
$config->setReturnValue('get', 1, array('Test.DefinitionRev'));
|
$config->setReturnValue('get', 1, array('Test.DefinitionRev'));
|
||||||
$dir = dirname(__FILE__) . '/SerializerTest';
|
$dir = dirname(__FILE__) . '/SerializerTest';
|
||||||
$config->setReturnValue('get', $dir, array('Cache.SerializerPath'));
|
$config->setReturnValue('get', $dir, array('Cache.SerializerPath'));
|
||||||
$config->setReturnValue('get', 0777, array('Cache.SerializerPermissions'));
|
$config->setReturnValue('get', 0700, array('Cache.SerializerPermissions'));
|
||||||
|
|
||||||
$def_original = $this->generateDefinition();
|
$def_original = $this->generateDefinition();
|
||||||
$cache->add($def_original, $config);
|
$cache->add($def_original, $config);
|
||||||
$this->assertFileExist($dir . '/Test/1.0.0,serial,1.ser');
|
$this->assertFileExist($dir . '/Test/1.0.0,serial,1.ser');
|
||||||
|
|
||||||
$this->assertEqual(0666, 0777 & fileperms($dir . '/Test/1.0.0,serial,1.ser'));
|
$this->assertEqual(0600, 0777 & fileperms($dir . '/Test/1.0.0,serial,1.ser'));
|
||||||
$this->assertEqual(0777, 0777 & fileperms($dir . '/Test'));
|
$this->assertEqual(0700, 0777 & fileperms($dir . '/Test'));
|
||||||
|
|
||||||
unlink($dir . '/Test/1.0.0,serial,1.ser');
|
unlink($dir . '/Test/1.0.0,serial,1.ser');
|
||||||
rmdir( $dir . '/Test');
|
rmdir( $dir . '/Test');
|
||||||
|
Loading…
Reference in New Issue
Block a user