Sauvegardes avec extension .bak.php pour plus de sécurité

Évite le téléchargement
pull/340/head
Alexandre Alapetite 11 years ago
parent bc4116ea77
commit 8beb15460a
  1. 2
      app/Models/Configuration.php
  2. 2
      data/.gitignore
  3. 2
      lib/Minz/Configuration.php

@ -79,7 +79,7 @@ class FreshRSS_Configuration {
}
public function save() {
@rename($this->filename, $this->filename . '.bak');
@rename($this->filename, $this->filename . '.bak.php');
if (file_put_contents($this->filename, "<?php\n return " . var_export($this->data, true) . ';', LOCK_EX) === false) {
throw new Minz_PermissionDeniedException($this->filename);
}

2
data/.gitignore vendored

@ -4,4 +4,4 @@ config.php
*.sqlite
touch.txt
no-cache.txt
*.bak
*.bak.php

@ -156,7 +156,7 @@ class Minz_Configuration {
),
'db' => self::$db,
);
@rename(DATA_PATH . self::CONF_PATH_NAME, DATA_PATH . self::CONF_PATH_NAME . '.bak');
@rename(DATA_PATH . self::CONF_PATH_NAME, DATA_PATH . self::CONF_PATH_NAME . '.bak.php');
$result = file_put_contents(DATA_PATH . self::CONF_PATH_NAME, "<?php\n return " . var_export($ini_array, true) . ';');
if (function_exists('opcache_invalidate')) {
opcache_invalidate(DATA_PATH . self::CONF_PATH_NAME); //Clear PHP 5.5+ cache for include

Loading…
Cancel
Save