Do the chmod only if we are on linux and if we are the owner of the file

git-svn-id: https://svn.fournier38.fr/svn/ProgSVN/trunk@1474 bf3deb0d-5f1a-0410-827f-c0cc1f45334c
This commit is contained in:
2014-06-20 11:23:17 +00:00
parent d168f3a06f
commit f1ca57b4cb

View File

@@ -161,7 +161,8 @@ class dblayer extends PDO
if (file_exists ($file) && ! is_writeable ($file)) if (file_exists ($file) && ! is_writeable ($file))
throw new Exception (_("The SQLite database file is write protected"), throw new Exception (_("The SQLite database file is write protected"),
500); 500);
chmod ($file, 0666); if (function_exists ("posix_getuid") && fileowner ($file) === posix_getuid ())
chmod ($file, 0666);
// Force ForeignKeys support (disabled by default) // Force ForeignKeys support (disabled by default)
$this->db->exec("PRAGMA foreign_keys = ON"); $this->db->exec("PRAGMA foreign_keys = ON");
break; break;