File Permissions Checks

We can easily include necessary configuration in our "includes/steps.php" file to verify if certain files/folders exists and are readable/writable.

In this example lets check if the folder "cache" and file "config.php" exist and are writable. We'll also check if the file "license.txt" exists and is readable. Our "includes/step.php" file should contain the code similar to this:

<?php
$steps 
= array(
  array(
    
'name' => 'Welcome to the wizard',
    
'fields' => array(
      array(
        
'type' => 'info',
        
'value' => 'Please verify that these requirements have been met.',
      ),
      array(
        
'type' => 'file-permissions',
        
'label' => 'Folders and files',
        
'items' => array(
          
'../cache/' => 'write',
          
'../config.php' => 'write',
          
'../license.txt' => 'read',
        )
      )
    )
  )
);
?>

You may notice that each folder/file in the above example has a "../" prefix. The reason we have those there is because normally you would have your installation wizard file in its own folder such as "install". Thus your main application files would be one level above "install" folder in the directory tree. For example:

  • cache/
  • install/ (this is your installation wizard)
  • images/
  • system/
  • config.php
  • license.txt