Check for existing rules and converter and for write permissions

@return boolean returns true if both files are writable
162443
public function isWritable()
        {
                if (file_exists($this->phpids_base.self::FILENAME_RULES) &&
                        is_writable($this->phpids_base.self::FILENAME_RULES) &&
                        file_exists($this->phpids_base.self::FILENAME_CONVERTER) &&
                        is_writable($this->phpids_base.self::FILENAME_CONVERTER)) {
                        return true;
                } else {
            return false;
                }

        }
1059792
private function canGenerate()
    {
        foreach ($this->generatedFiles as $file) {
            if ($uses = $file->getData('generator')) {
                if (count($uses) > 0) {
                    return true;
                }
            }
        }

        return false;
    }
1047421
public function isWritable() {

		if(false !== $this -> file -> getExists()) {

			$this -> refresh();
			
			return $this -> file -> getWritable();
		}

		return false;
	}
108840
public function isWriteAllowed()
    {
        $msgRepl = ['%s' => $this->relPath];

        // No file, directory not writable
        if (!file_exists($this->absPath) && (!is_writable(dirname($this->absPath)) && !is_writable(dirname(dirname($this->absPath))))) {
            $msg = Trans::__(
                "The translations file '%s' can't be created. You will have to use your own editor to make modifications to this file.",
                $msgRepl
            );
            $this->app['logger.flash']->warning($msg);

        // Have a file, but not writable
        } elseif (file_exists($this->absPath) && !is_writable($this->absPath)) {
            $msg = Trans::__(
                'general.phrase.file-not-writable',
                $msgRepl
            );
            $this->app['logger.flash']->warning($msg);

        // File is not readable: abort
        } elseif (file_exists($this->absPath) && !is_readable($this->absPath)) {
            $msg = Trans::__('general.phrase.error-translation-file-not-readable', $msgRepl);
            $this->app->abort(Response::HTTP_NOT_FOUND, $msg);

        // File is writeable
        } else {
            return true;
        }

        return false;
    }
615792
protected function ensureDirectoryWritable() {
    // Reality check to prevent stomping on the local filesystem if there is
    // something wrong with the config.
    if (!$this->directory) {
      throw new BltException('Could not save data to a file because the path setting is mis-configured.');
    }

    $writable = is_dir($this->directory) || (!file_exists($this->directory) && @mkdir($this->directory, 0777, TRUE));
    $writable = $writable && is_writable($this->directory);
    if (!$writable) {
      throw new BltException(
        'Could not save data to a file because the path {path} cannot be written to.',
        ['path' => $this->directory]
      );
    }
  }
625816
public function isWritable() {

		if(false !== $this -> directory -> getExists()) {

			$this -> refresh();
			
			return $this -> directory -> getWritable();
		}

		return false;
	}
802655
public function isWritableByCurrentUser()
    {
        if (isset($this->hasWritePermission)) {
            return $this->hasWritePermission;
        }

        // performance improvement, do not detect this in __construct otherwise likely rather "big" query to DB.
        $this->hasWritePermission = Piwik::isUserHasSomeViewAccess();

        return $this->hasWritePermission;
    }
224746
public function canEdit(): bool
    {
        if ($this->isPendingDeletion()) {
            return false;
        }

        if (Auth::isManager($this->record->tree())) {
            return true;
        }

        // Members cannot edit RESN, CHAN and locked records
        return Auth::isEditor($this->record->tree()) && strpos($this->gedcom, "\n2 RESN locked") === false && $this->getTag() !== 'RESN' && $this->getTag() !== 'CHAN';
    }
401948
private function isPathWritable(): bool
    {
        if (! file_exists($this->path)) {
            return is_writable(dirname($this->path));
        }

        return is_writable($this->path);
    }
415192
protected function has_system_permission($filepath, $permissions) {
        if (in_array('r', $permissions)) {
            if (!is_readable($filepath)) {
                Log::info('Not readable path "' . $filepath . '"');
                return false;
            };
        }
        if (in_array('w', $permissions)) {
            if (!is_writable($filepath)) {
                Log::info('Not writable path "' . $filepath . '"');
                return false;
            }
        }
        return true;
    }
864804
public function checkFilesystem()
    {
        $results = array(
            $this->checkPermissions(GC_FILE_CONFIG_COMPILED)
        );

        if (file_exists(GC_FILE_CONFIG_COMPILED_OVERRIDE)) {
            $results[] = $this->checkPermissions(GC_FILE_CONFIG_COMPILED_OVERRIDE);
        }

        $filtered = array_filter($results, 'is_string');
        return empty($filtered) ? true : $filtered;
    }
966053
public function canWriteConfiguration()
    {
        $fileLocation = SettingsFiles::getOverrideSettingsFile();

        return @is_writable(file_exists($fileLocation) ? $fileLocation : Environment::getConfigPath() . '/');
    }
1226081
static function isWriteable( $filename )
    {
        if ( eZSys::osType() != 'win32' )
            return is_writable( $filename );

        /* PHP function is_writable() doesn't work correctly on Windows NT descendants.
         * So we have to use the following hack on those OSes.
         */
        if ( !( $fd = @fopen( $filename, 'a' ) ) )
            return FALSE;

        fclose( $fd );

        return TRUE;
    }
376810
public function check_permissions() {
        $context = context_module::instance($this->cm->id);
        return has_capability('mod/glossary:exportentry', $context)
            || ($this->entry->userid == $this->user->id && has_capability('mod/glossary:exportownentry', $context));
    }
1340797
public function isFileWritable($moduleName) {
		
		$folder = APPLICATION_PATH . ('common'!=$moduleName ? '/modules/' . $moduleName : '') . '/translations';
		$file = $folder . '/' . $this->getRepresentation() . '.ini';
		
		if ((file_exists($file) and is_writable($file)) or (!file_exists($file) and is_dir($folder) and is_writable($folder))) {
			return TRUE;
		} else {
			return FALSE;
		}
		
	}
1357918
public function writeFile($overwrite = false) {
		$overwrite = ($this->type == self::TYPE_ENTITY) ? false : $overwrite;
		if (($this->existsFile() < self::FILE_MATCH) || $overwrite) {
			//$checkPath = dirname($this->getPath());
			if (@file_put_contents($this->getPath(), $this->getCode(), LOCK_EX)) {
				@chmod($this->getPath(), 0666);
				return true;
			}/* else {
				throw new Exception\PermissionException('Write access to Entity OR Model dirs denied');
			}*/
		}
		return false;
	}
638285
private function _validate()
	{
		$this->checkOverwritePermission();
		$this->checkHasValidUploadDirectory();
		$this->checkFileSize();
		$this->checkFileTypeIsAllowed();
		$this->checkFileTypeIsNotBlocked();

		return true;
	}