Skip to content

Commit

Permalink
Added check for LDAP
Browse files Browse the repository at this point in the history
  • Loading branch information
Timo A. Hummel committed Sep 3, 2017
1 parent 80bdd19 commit 3bcee16
Showing 1 changed file with 16 additions and 11 deletions.
27 changes: 16 additions & 11 deletions app/PartKeeprRequirements.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@ function_exists('imagecreate'),
sprintf('GD library not found'),
sprintf('Install the GD library extension'));

$this->addRequirement(
function_exists('ldap_connect'),
sprintf('LDAP library not found'),
sprintf('Install the LDAP library extension'));

$this->addRequirement(
function_exists('curl_init'),
sprintf('CURL library not found'),
Expand All @@ -30,9 +35,9 @@ function_exists('curl_init'),
sprintf('The php.ini memory_limit directive must be set to 128MB or higher. Your limit is set to %s',
ini_get('memory_limit')));

$this->checkWritable(realpath(dirname(__FILE__).'/../data/'));
$this->checkWritable(realpath(dirname(__FILE__).'/../app/'));
$this->checkWritable(realpath(dirname(__FILE__).'/../web/'));
$this->checkWritable(realpath(dirname(__FILE__) . '/../data/'));
$this->checkWritable(realpath(dirname(__FILE__) . '/../app/'));
$this->checkWritable(realpath(dirname(__FILE__) . '/../web/'));

$this->addRecommendation(
function_exists('apc_fetch'),
Expand Down Expand Up @@ -98,7 +103,7 @@ protected function checkWritable($path)
*/
protected function getBytesIniSetting($setting)
{
return (int) $this->returnBytes(ini_get($setting));
return (int)$this->returnBytes(ini_get($setting));
}

/**
Expand Down Expand Up @@ -140,24 +145,24 @@ protected function returnBytes($val)
protected function isWritableRecursive($dir)
{
if (!is_writable($dir)) {
throw new \Exception($dir.' is not writable.');
throw new \Exception($dir . ' is not writable.');
}

$folder = opendir($dir);
while ($file = readdir($folder)) {
if ($file != '.' && $file != '..') {
if (!is_writable($dir.'/'.$file)) {
if (!is_writable($dir . '/' . $file)) {
closedir($folder);
throw new \Exception($dir.'/'.$file.' is not writable.');
throw new \Exception($dir . '/' . $file . ' is not writable.');
} else {
// Skip hidden directories
if ((is_dir($dir.'/'.$file)) && ($file[0] == '.')) {
if ((is_dir($dir . '/' . $file)) && ($file[0] == '.')) {
continue;
}
if (is_dir($dir.'/'.$file)) {
if (!$this->isWritableRecursive($dir.'/'.$file)) {
if (is_dir($dir . '/' . $file)) {
if (!$this->isWritableRecursive($dir . '/' . $file)) {
closedir($folder);
throw new \Exception($dir.'/'.$file.' is not writable.');
throw new \Exception($dir . '/' . $file . ' is not writable.');
}
}
}
Expand Down

0 comments on commit 3bcee16

Please sign in to comment.