Exemple #1
0
     // on the server so this method will convert slashes to make it right
     $folderPath = FixPath($conf['savetofolder']);
     $results[$idx]['folder'] = TestFolderWriteability($folderPath);
     $results[$idx]['read'] = TestFileReadability($conf['maskname']);
     // Do not try to write or delete file if the folder failed
     if ($results[$idx]['read']['state'] == 'success' && ($results[$idx]['folder']['state'] == 'success' || $results[$idx]['folder']['state'] == 'ignored')) {
         $results[$idx]['write'] = TestFileWriteability($folderPath, $conf['maskname']);
         // Also do not try to delete a file if it cannot be written to
         if ($results[$idx]['write']['state'] != 'failed') {
             $results[$idx]['delete'] = TestFileDeletion($folderPath, $conf['maskname']);
         } else {
             $results[$idx]['delete'] = TestResults('ignored', 'Unable to perform this test due to previous failures');
         }
     } else {
         $results[$idx]['write'] = TestResults('ignored', 'Unable to perform this test due to previous failures');
         $results[$idx]['delete'] = TestResults('ignored', 'Unable to perform this test due to previous failures');
     }
     // If any test failed, do not continue
     if ($results[$idx]['folder']['state'] == 'failed' || $results[$idx]['read']['state'] == 'failed' || $results[$idx]['write']['state'] == 'failed' || $results[$idx]['delete']['state'] == 'failed') {
         $ioable = false;
     }
     $idx++;
 }
 if ($ioable) {
     $page->SuccessBox('The Installer has sufficient file permissions on this server.');
 } else {
     $page->InfoBox('All tests have to be successful inorder to continue');
 }
 // THIS TABLE USES THE SAME TABLE-CSS AS "USER ACCESS TEST" STEP!
 $page->StartTable(4, array('class' => 'dbtests', 'cellspacing' => '0', 'cellpadding' => '0'));
 foreach ($results as $testTypes) {
/** 
 *  Test if a file can be deleted or not
 */
function TestFileDeletion($folderPath, $fileName)
{
    if (unlink($folderPath . $fileName)) {
        return TestResults('success', 'The test-file <b>' . $fileName . '</b> has been removed');
    } else {
        $page->ErrorBox('The Installer is unable to delete <b>' . $folderPath . $fileName . '</b>, check your <tt>chmod</tt> permissions or contact ' . 'support to get this issue resolved.');
        return TestResults('failed', 'Unable to delete the test-file <b>' . $fileName . '</b>');
    }
}