Merge branch 'master' into snyk
This commit is contained in:
commit
7311e9ce12
@ -90,12 +90,15 @@ abstract class AbstractPersistence
|
|||||||
}
|
}
|
||||||
$file = self::$_path . DIRECTORY_SEPARATOR . '.htaccess';
|
$file = self::$_path . DIRECTORY_SEPARATOR . '.htaccess';
|
||||||
if (!is_file($file)) {
|
if (!is_file($file)) {
|
||||||
$writtenBytes = @file_put_contents(
|
$writtenBytes = 0;
|
||||||
$file,
|
if ($fileCreated = @touch($file)) {
|
||||||
'Require all denied' . PHP_EOL,
|
$writtenBytes = @file_put_contents(
|
||||||
LOCK_EX
|
$file,
|
||||||
);
|
'Require all denied' . PHP_EOL,
|
||||||
if ($writtenBytes === false || $writtenBytes < 19) {
|
LOCK_EX
|
||||||
|
);
|
||||||
|
}
|
||||||
|
if ($fileCreated === false || $writtenBytes === false || $writtenBytes < 19) {
|
||||||
throw new Exception('unable to write to file ' . $file, 11);
|
throw new Exception('unable to write to file ' . $file, 11);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -115,8 +118,15 @@ abstract class AbstractPersistence
|
|||||||
{
|
{
|
||||||
self::_initialize();
|
self::_initialize();
|
||||||
$file = self::$_path . DIRECTORY_SEPARATOR . $filename;
|
$file = self::$_path . DIRECTORY_SEPARATOR . $filename;
|
||||||
$writtenBytes = @file_put_contents($file, $data, LOCK_EX);
|
$fileCreated = true;
|
||||||
if ($writtenBytes === false || $writtenBytes < strlen($data)) {
|
$writtenBytes = 0;
|
||||||
|
if (!is_file($file)) {
|
||||||
|
$fileCreated = @touch($file);
|
||||||
|
}
|
||||||
|
if ($fileCreated) {
|
||||||
|
$writtenBytes = @file_put_contents($file, $data, LOCK_EX);
|
||||||
|
}
|
||||||
|
if ($fileCreated === false || $writtenBytes === false || $writtenBytes < strlen($data)) {
|
||||||
throw new Exception('unable to write to file ' . $file, 13);
|
throw new Exception('unable to write to file ' . $file, 13);
|
||||||
}
|
}
|
||||||
@chmod($file, 0640); // protect file access
|
@chmod($file, 0640); // protect file access
|
||||||
|
@ -34,6 +34,7 @@ class GoogleCloudStorageTest extends PHPUnit_Framework_TestCase
|
|||||||
// do not report E_NOTICE as fsouza/fake-gcs-server does not return a `generation` value in the response
|
// do not report E_NOTICE as fsouza/fake-gcs-server does not return a `generation` value in the response
|
||||||
// which the Google Cloud Storage PHP library expects.
|
// which the Google Cloud Storage PHP library expects.
|
||||||
error_reporting(E_ERROR | E_WARNING | E_PARSE);
|
error_reporting(E_ERROR | E_WARNING | E_PARSE);
|
||||||
|
ini_set('error_log', stream_get_meta_data(tmpfile())['uri']);
|
||||||
$this->_model = GoogleCloudStorage::getInstance(array(
|
$this->_model = GoogleCloudStorage::getInstance(array(
|
||||||
'bucket' => self::$_bucket->name(),
|
'bucket' => self::$_bucket->name(),
|
||||||
'prefix' => 'pastes',
|
'prefix' => 'pastes',
|
||||||
|
Loading…
Reference in New Issue
Block a user