View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0005092 | OXID eShop (all versions) | 2.8. Service | public | 2013-04-30 12:11 | 2022-02-01 14:39 |
Reporter | AndreHerrmann | Assigned To | |||
Priority | normal | Severity | feature | Reproducibility | always |
Status | confirmed | Resolution | open | ||
Product Version | 4.6.5 revision 49955 | ||||
Summary | 0005092: Making problems in checkServerPermissions() visible | ||||
Description | Due oxsysrequirements is not allowed to be overloaded, I would like to request to implement my patch beneath. It's about a problem I periodically come in touch with. The red light is not very meaningfull if you have the task to debug this and help page only shows the base paths to be checked. Wouldn't it be nicer if the user directly sees the pathes the shop is complaining about? | ||||
Additional Information | Here's my quick patch suggest, which I recently used to be able to find the bad path which made modstat light red: /** * 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 ) { $sVerPrefix = ''; clearstatcache(); $sPath = $sPath ? $sPath : getShopBasePath(); // special config file check $sFullPath = $sPath . "config.inc.php"; if ( !is_readable( $sFullPath ) || ( isAdmin() && is_writable( $sFullPath ) ) || ( !isAdmin() && !is_writable( $sFullPath ) ) ) { return 0; } $sTmp = "$sPath/tmp$sVerPrefix/"; if (class_exists('oxConfig')) { $sCfgTmp = $this->getConfig()->getConfigParam('sCompileDir'); if (strpos($sCfgTmp, '<sCompileDir_') === false) { $sTmp = $sCfgTmp; } } $aPathsToCheck = array( $sPath."out/pictures{$sVerPrefix}/promo/", $sPath."out/pictures{$sVerPrefix}/media/", $sPath."out/pictures{$sVerPrefix}/master/", $sPath."out/pictures{$sVerPrefix}/generated/", $sPath."log/", $sTmp ); $aFcErrorMessages = array(); $iModStat = 2; $sPathToCheck = reset( $aPathsToCheck ); while ( $sPathToCheck ) { // missing file/folder? if ( !file_exists( $sPathToCheck ) ) { $iModStat = 0; $aFcErrorMessages[] = "Missing file/folder $sPathToCheck"; } 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 ( ( (int) substr( decoct( fileperms( $sFullPath ) ), 2 ) ) < $iMinPerm ) { if ( !is_readable( $sPathToCheck ) || !is_writable( $sPathToCheck ) ) { $sFcType = ""; if ( !is_readable( $sPathToCheck ) ) { $sFcType .= "read"; } if ( !is_writable( $sPathToCheck ) ) { if ( $sFcType != '' ) { $sFcType .= " and"; } $sFcType .= " write"; } $aFcErrorMessages[] = "$sPathToCheck has no $sFcType permissions"; $iModStat = 0; } $sPathToCheck = next( $aPathsToCheck ); } if ( count( $aFcErrorMessages ) > 0 ) { $sFcErrorMessages = implode( " ", $aFcErrorMessages ); oxUtilsView::getInstance()->addErrorToDisplay( oxNew( 'oxException', "File-Access-Errors: ".$sFcErrorMessages ) ); } return $iModStat; } | ||||
Tags | No tags attached. | ||||
Attached Files | |||||
Theme | Not defined | ||||
Browser | All | ||||
PHP Version | Not defined | ||||
Database Version | Not defined | ||||