Backend\Modules\Extensions\Engine\Model::isWritable PHP Method

isWritable() public static method

The default is_writable function has problems due to Windows ACLs "bug"
public static isWritable ( string $path ) : boolean
$path string The path to check.
return boolean
    public static function isWritable($path)
    {
        $path = rtrim((string) $path, '/');
        $file = uniqid('', true) . '.tmp';
        $return = @file_put_contents($path . '/' . $file, 'temporary file', FILE_APPEND);
        if ($return === false) {
            return false;
        }
        unlink($path . '/' . $file);
        return true;
    }

Usage Example

Example #1
0
 /**
  * Do we have write rights to the modules folders?
  *
  * @return bool
  */
 private function isWritable()
 {
     // check if writable
     if (!BackendExtensionsModel::isWritable(FRONTEND_PATH . '/Themes')) {
         return false;
     }
     // everything is writable
     return true;
 }
All Usage Examples Of Backend\Modules\Extensions\Engine\Model::isWritable