1
0
mirror of https://github.com/e107inc/e107.git synced 2025-07-27 01:40:22 +02:00

Bugtracker #4425 - just warn if directories associated with optional features aren't writable

This commit is contained in:
e107steved
2008-07-09 21:38:24 +00:00
parent 5359d11628
commit 1ac0405641
2 changed files with 38 additions and 15 deletions

View File

@@ -145,5 +145,9 @@ define("LANINS_103", 'Reviews');
define("LANINS_104", 'Review Front Page ...');
define("LANINS_105", 'A database name or prefix beginning with some digits followed by \'e\' or \'E\' is not acceptable');
define("LANINS_106", '');
define("LANINS_106", 'WARNING - E107 cannot write to the directories and/or files listed. While this will not stop E107 installing, it will mean that certain features are not available.
You will need to change the file permissions to use these features');
define("LANINS_107", '');
define("LANINS_108", '');
?>

View File

@@ -11,8 +11,8 @@
| GNU General Public License (http://gnu.org).
|
| $Source: /cvs_backup/e107_0.8/install_.php,v $
| $Revision: 1.10 $
| $Date: 2008-07-08 21:09:13 $
| $Revision: 1.11 $
| $Date: 2008-07-09 21:38:24 $
| $Author: e107steved $
+----------------------------------------------------------------------------+
*/
@@ -399,7 +399,8 @@ class e_install
$this->template->SetTag("stage_pre", LANINS_002);
$this->template->SetTag("stage_num", LANINS_007);
$this->template->SetTag("stage_title", LANINS_008);
$not_writable = $this->check_writable_perms();
$not_writable = $this->check_writable_perms('must_write'); // Some directories MUST be writable
$opt_writable = $this->check_writable_perms('can_write'); // Some directories CAN optionally be writable
$version_fail = false;
$perms_errors = "";
if(count($not_writable))
@@ -411,6 +412,15 @@ class e_install
}
$perms_notes = LANINS_018;
}
elseif (count($opt_writable))
{
$perms_pass = true;
foreach ($opt_writable as $file)
{
$perms_errors .= (substr($file, -1) == "/" ? LANINS_010a : LANINS_010)."...<br /><b>{$file}</b><br />\n";
}
$perms_notes = LANINS_106;
}
else
{
$perms_pass = true;
@@ -710,19 +720,28 @@ This file has been generated by the installation script.
$e_forms->add_hidden_data("stage", ($force_stage ? $force_stage : ($this->stage + 1)));
}
function check_writable_perms(){
function check_writable_perms($list = 'must_write')
{
$bad_files = array();
$data = 'e107_config.php|{$CACHE_DIRECTORY}|{$UPLOADS_DIRECTORY}|{$FILES_DIRECTORY}public/avatars/|{$PLUGINS_DIRECTORY}|{$THEMES_DIRECTORY}';
foreach ($this->e107->e107_dirs as $dir_name => $value) {
$find[] = "{\${$dir_name}}";
$replace[] = "./$value";
$data['must_write'] = 'e107_config.php';
$data['can_write'] = '{$FILES_DIRECTORY}cache/|{$FILES_DIRECTORY}public/|{$FILES_DIRECTORY}public/avatars/|{$PLUGINS_DIRECTORY}|{$THEMES_DIRECTORY}';
$data = 'e107_config.php|{$FILES_DIRECTORY}public/temp/|{$FILES_DIRECTORY}public/logs/';
$data = '{$CACHE_DIRECTORY}|{$UPLOADS_DIRECTORY}|{$FILES_DIRECTORY}public/avatars/|{$PLUGINS_DIRECTORY}|{$THEMES_DIRECTORY}';
if (!isset($data[$list])) return $bad_files;
foreach ($this->e107->e107_dirs as $dir_name => $value)
{
$find[] = "{\${$dir_name}}";
$replace[] = "./$value";
}
$data = str_replace($find, $replace, $data);
$files = explode("|", trim($data));
foreach ($files as $file) {
if(!is_writable($file)) {
$bad_files[] = str_replace("./", "", $file);
}
$data[$list] = str_replace($find, $replace, $data[$list]);
$files = explode("|", trim($data[$list]));
foreach ($files as $file)
{
if(!is_writable($file))
{
$bad_files[] = str_replace("./", "", $file);
}
}
return $bad_files;
}