Piwik\Filechecks::getErrorMessageMissingPermissions PHP Method

getErrorMessageMissingPermissions() public static method

Returns friendly error message explaining how to fix permissions
public static getErrorMessageMissingPermissions ( string $path ) : string
$path string to the directory missing permissions
return string Error message
    public static function getErrorMessageMissingPermissions($path)
    {
        $message = "Please check that the web server has enough permission to write to these files/directories:<br />";
        if (SettingsServer::isWindows()) {
            $message .= "On Windows, check that the folder is not read only and is writable.\n\n\t\t\t\t\t\tYou can try to execute:<br />";
        } else {
            $message .= "For example, on a GNU/Linux server if your Apache httpd user is " . self::getUser() . ", you can try to execute:<br />\n" . "<code>chown -R " . self::getUserAndGroup() . " " . $path . "</code><br />";
        }
        $message .= self::getMakeWritableCommand($path);
        return $message;
    }

Usage Example

Example #1
0
 protected function write(array $record)
 {
     try {
         parent::write($record);
     } catch (\UnexpectedValueException $e) {
         throw new \Exception(Filechecks::getErrorMessageMissingPermissions($this->url));
     }
 }
All Usage Examples Of Piwik\Filechecks::getErrorMessageMissingPermissions