[fix] Do not create .htaccess with Nginx

pull/226/head
magikcypress 7 years ago
parent af595ed96d
commit 90087123ba

@ -75,6 +75,10 @@ languageselection = false
; sha256 in HMAC for the deletion token ; sha256 in HMAC for the deletion token
zerobincompatibility = false zerobincompatibility = false
; allows you to specify the name of the web server you are using to use ParseBin.
; if you use Nginx, decommente and add nginx.
webserver = "Nginx"
[expire] [expire]
; expire value that is selected per default ; expire value that is selected per default
; make sure the value exists in [expire_options] ; make sure the value exists in [expire_options]

@ -54,6 +54,7 @@ class Configuration
'icon' => 'identicon', 'icon' => 'identicon',
'cspheader' => 'default-src \'none\'; manifest-src \'self\'; connect-src *; script-src \'self\'; style-src \'self\'; font-src \'self\'; img-src \'self\' data:; referrer no-referrer; sandbox allow-same-origin allow-scripts allow-forms allow-popups', 'cspheader' => 'default-src \'none\'; manifest-src \'self\'; connect-src *; script-src \'self\'; style-src \'self\'; font-src \'self\'; img-src \'self\' data:; referrer no-referrer; sandbox allow-same-origin allow-scripts allow-forms allow-popups',
'zerobincompatibility' => false, 'zerobincompatibility' => false,
'webserver' => 'Apache',
), ),
'expire' => array( 'expire' => array(
'default' => '1week', 'default' => '1week',

@ -82,21 +82,23 @@ abstract class AbstractPersistence
*/ */
protected static function _initialize() protected static function _initialize()
{ {
// Create storage directory if it does not exist. if (property_exists($data->meta, 'webserver') && $data->meta->webserver && $this->_conf->getKey('webserver') == "Apache") {
if (!is_dir(self::$_path)) { // Create storage directory if it does not exist.
if (!@mkdir(self::$_path, 0700)) { if (!is_dir(self::$_path)) {
throw new Exception('unable to create directory ' . self::$_path, 10); if (!@mkdir(self::$_path, 0700)) {
throw new Exception('unable to create directory ' . self::$_path, 10);
}
} }
} $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 = @file_put_contents( $file,
$file, 'Require all denied' . PHP_EOL,
'Require all denied' . PHP_EOL, LOCK_EX
LOCK_EX );
); if ($writtenBytes === false || $writtenBytes < 19) {
if ($writtenBytes === false || $writtenBytes < 19) { throw new Exception('unable to write to file ' . $file, 11);
throw new Exception('unable to write to file ' . $file, 11); }
} }
} }
} }

Loading…
Cancel
Save