/**
  * Return false if the database connection has not been configured in the eShop configuration file.
  *
  * @param ConfigFile $config
  *
  * @return bool
  */
 protected function isDatabaseConfigured(ConfigFile $config)
 {
     $isValid = true;
     // If the shop has not been configured yet the hostname has the format '<dbHost>'
     if (false !== strpos($config->getVar('dbHost'), '<')) {
         $isValid = false;
     }
     return $isValid;
 }
 /**
  * Checks if permissions on servers are correctly setup
  *
  * @param string $sPath    check path [optional]
  * @param int    $iMinPerm min permission level, default 777 [optional]
  *
  * @return int
  */
 public function checkServerPermissions($sPath = null, $iMinPerm = 777)
 {
     clearstatcache();
     $sPath = $sPath ? $sPath : getShopBasePath();
     // special config file check
     $sFullPath = $sPath . "config.inc.php";
     if (!is_readable($sFullPath) || $this->isAdmin() && is_writable($sFullPath) || !$this->isAdmin() && !is_writable($sFullPath)) {
         return 0;
     }
     $sTmp = "{$sPath}/tmp/";
     $config = new ConfigFile(getShopBasePath() . "/config.inc.php");
     $sCfgTmp = $config->getVar('sCompileDir');
     if ($sCfgTmp && strpos($sCfgTmp, '<sCompileDir') === false) {
         $sTmp = $sCfgTmp;
     }
     $aPathsToCheck = array($sPath . 'out/pictures/promo/', $sPath . 'out/pictures/master/', $sPath . 'out/pictures/generated/', $sPath . 'out/pictures/media/', $sPath . 'out/media/', $sPath . 'log/', $sTmp);
     $iModStat = 2;
     $sPathToCheck = reset($aPathsToCheck);
     while ($sPathToCheck) {
         // missing file/folder?
         if (!file_exists($sPathToCheck)) {
             $iModStat = 0;
             break;
         }
         if (is_dir($sPathToCheck)) {
             // adding subfolders
             $aSubF = glob($sPathToCheck . "*", GLOB_ONLYDIR);
             if (is_array($aSubF)) {
                 foreach ($aSubF as $sNewFolder) {
                     $aPathsToCheck[] = $sNewFolder . "/";
                 }
             }
         }
         // testing if file permissions >= $iMinPerm
         if (!is_readable($sPathToCheck) || !is_writable($sPathToCheck)) {
             $iModStat = 0;
             break;
         }
         $sPathToCheck = next($aPathsToCheck);
     }
     return $iModStat;
 }