diff options
author | Pascal Chevrel <pascal@chevrel.org> | 2012-03-07 09:57:58 +0100 |
---|---|---|
committer | Pascal Chevrel <pascal@chevrel.org> | 2012-03-07 09:57:58 +0100 |
commit | 76b4cfa134d7a39206dc9f6eebacd72867bba40e (patch) | |
tree | 6cd38518cca33ec82b2e9a4e4fdb19d9f0a2ee50 /install.php | |
parent | d5943db5285b324b8831a613d487e64065d12eae (diff) | |
download | planet-76b4cfa134d7a39206dc9f6eebacd72867bba40e.tar planet-76b4cfa134d7a39206dc9f6eebacd72867bba40e.tar.gz planet-76b4cfa134d7a39206dc9f6eebacd72867bba40e.tar.bz2 planet-76b4cfa134d7a39206dc9f6eebacd72867bba40e.tar.xz planet-76b4cfa134d7a39206dc9f6eebacd72867bba40e.zip |
refactor testing of requirements to have more readable and expandable code, any new file requirement is now an addition to the array
Diffstat (limited to 'install.php')
-rw-r--r-- | install.php | 43 |
1 files changed, 27 insertions, 16 deletions
diff --git a/install.php b/install.php index 051c719..06ffc5c 100644 --- a/install.php +++ b/install.php @@ -35,36 +35,47 @@ if (file_exists(CONFIG_FILE) && file_exists(PWD_FILE)) { $status = 'installed'; } } else { - + //Requirements $tests = array( 'php5' => array( - 'label'=>'Server is running PHP5', - 'solution' => 'Check your server documentation to activate PHP5.' + 'file' => false, + 'label' => 'Server is running PHP5', + 'solution' => 'Check your server documentation to activate PHP5.', + 'result' => phpversion() >= 5 ), 'custom' => array( - 'label' => '<code>./custom</code> is writable', - 'solution' => 'Change the access rights for <code>./custom</code> with CHMOD' + 'file' => '/custom', + 'label' => '<code>./custom</code> is writable', + 'solution' => 'Change the access rights for <code>./custom</code> with CHMOD' ), 'opml' => array( - 'label'=>'<code>./custom/people.opml</code> is writable', - 'solution' => 'Change the access rights for <code>./custom/people.opml</code> with CHMOD' + 'file' => '/custom/people.opml', + 'label' => '<code>./custom/people.opml</code> is writable', + 'solution' => 'Change the access rights for <code>./custom/people.opml</code> with CHMOD' ), 'changepassword' => array( - 'label'=>'Administrator password can be changed', - 'solution' => 'Change the access right for <code>./admin/inc/pwd.inc.php</code> with CHMOD' + 'file' => '/admin/inc/pwd.inc.php', + 'label' => 'Administrator password can be changed', + 'solution' => 'Change the access right for <code>./admin/inc/pwd.inc.php</code> with CHMOD' ), 'cache' => array( - 'label'=>'<code>./cache</code> is writable', - 'solution' => 'Make <code>./cache</code> writable with CHMOD' + 'file' => '/cache', + 'label' => '<code>./cache</code> is writable', + 'solution' => 'Make <code>./cache</code> writable with CHMOD' ), );
- $tests['php5']['result'] = (5 <= phpversion());
- $tests['custom']['result'] = is_writable(dirname(__FILE__).'/custom'); - $tests['opml']['result'] = is_writable(dirname(__FILE__).'/custom/people.opml');
- $tests['changepassword']['result'] = is_writable(dirname(__FILE__).'/admin/inc/pwd.inc.php');
- $tests['cache']['result'] = is_writable(dirname(__FILE__).'/cache'); + foreach ($tests as $k => $v) { + // test file requirements, exclude php5 test + if ($tests[$k]['file']) { + if(is_writable(dirname(__FILE__) . $tests[$k]['file'])) { + $tests[$k]['result'] = true; + } else { + $tests[$k]['result'] = false; + } + } + } $bInstallOk = true; $strInstall = ''; |