You are here

function _imageapi_optimize_check_path in Image Optimize (or ImageAPI Optimize) 6

Same name and namespace in other branches
  1. 7 services/internal.inc \_imageapi_optimize_check_path()

Checks if a path exists and is executable

Warning: it does not check if the command is harmful. You should keep an eye on users with "administer imageapi" permission

1 call to _imageapi_optimize_check_path()
imageapi_optimize_validate_path in ./imageapi_optimize.module

File

./imageapi_optimize.module, line 174
Image optimize functionalities

Code

function _imageapi_optimize_check_path($path) {
  $errors = array();
  if (!empty($path)) {
    if (!is_file($path)) {
      $errors[] = t('The specified path %file does not exist.', array(
        '%file' => $path,
      ));
    }
    if (!$errors && !is_executable($path)) {
      $errors[] = t('The specified path %file is not executable.', array(
        '%file' => $path,
      ));
    }
    if ($errors && ($open_basedir = ini_get('open_basedir'))) {
      $errors[] = t('PHP\'s <a href="!open-basedir">open_basedir</a> security restriction is set to %open-basedir, which may be interfering with attempts to locate %file.', array(
        '%file' => $path,
        '%open-basedir' => $open_basedir,
        '!info-link' => url('http://php.net/features.safe-mode#ini.open-basedir'),
      ));
    }
  }
  return $errors;
}