Decides if leave or delete Setup directory dependent from configuration.

@return bool
171198
public function deleteSetupDirectory()
    {
        $blDeleteSetupDirectory = true;

        $sConfig = join("", file(getShopBasePath() . "config.inc.php"));
        if (strpos($sConfig, "this->blDelSetupDir = false;") !== false) {
            $blDeleteSetupDirectory = false;
        }

        return $blDeleteSetupDirectory;
    }
420810
protected function hasRoutingConfig()
    {
        $has_config = false;

        if ($this->locator) {
            try {
                $routing_file = $this->locator->locate($this->getRoutingFilename());

                if (filesize($routing_file) > 0) {
                    $this->debug(sprintf('hasRoutingConfig: Located Routing File %s', $routing_file));
                    $has_config = true;
                }
            } catch (\InvalidArgumentException $e) {}
        }

        return($has_config);
    }
437371
public function isUnoconvReady() {
		$cfgUnoconv = $this->_getUnoconvConfig();
		if ($cfgUnoconv === false) {
			return false;
		}

		if (!file_exists($cfgUnoconv['binaries'])) {
			return false;
		}

		return true;
	}
784909
def can_remove(self):
        '''
        
        '''
        dirbase = self.app.config["directory_remove"]
        return bool(dirbase and check_under_base(self.path, dirbase))
452637
public function dir_closedir()
    {
        if ($this->dirHandle === null) {
            return false;
        } else {
            self::restore();
            closedir($this->dirHandle);
            self::register();
            $this->dirHandle = null;
            return true;
        }
    }
999047
public function clear()
    {
        $result = true;
        $dir = new \DirectoryIterator($this->path);
        foreach ($dir as $file) {
            $extension = pathinfo($file->getFilename(), PATHINFO_EXTENSION);
            if (!$file->isDot() && $extension === 'ser') {
                if (!@unlink($this->path.'/'.$file->getFilename())) {
                    $result = false;
                }
            }
        }

        return $result;
    }
14359
public function delete()
    {
        $this->getLogger()->info('Deleting resolution ID ' . $this->resolutionId);
        $this->doDelete('/resolution/' . $this->resolutionId);

        return true;
    }
490267
public function setup(): Result
    {
        $result = new Result();
        try {
            $this->configureCacheDirectory();
        } catch (Exception $exception) {
            $result->addError(new Error('Failed to configure cache directory: %s', $exception->getCode(), [$exception->getMessage()], 'Cache Directory'));
        }
        return $result;
    }
868469
public function is_configured() {
        if ($this->get_config('runningmethod') === 'commandline') {
            return (bool)$this->get_config('pathtoclam');
        } else if ($this->get_config('runningmethod') === 'unixsocket') {
            return (bool)$this->get_config('pathtounixsocket');
        }
        return false;
    }
1324763
public final function has_admin_settings() {
        global $CFG;

        $pluginroot = $CFG->dirroot . '/mod/assign/' . substr($this->get_subtype(), strlen('assign')) . '/' . $this->get_type();
        $settingsfile = $pluginroot . '/settings.php';
        return file_exists($settingsfile);
    }
1046622
private function isCacheUpToDate()
    {
        if (!file_exists($this->cachedFile)) {
            return false;
        }

        $cacheTime  = filemtime($this->cachedFile);
        $configTime = max(filemtime($this->configPath), filemtime($this->envFile));

        return $cacheTime == $configTime;
    }
966053
public function canWriteConfiguration()
    {
        $fileLocation = SettingsFiles::getOverrideSettingsFile();

        return @is_writable(file_exists($fileLocation) ? $fileLocation : Environment::getConfigPath() . '/');
    }
1262007
public function Delete ()
	{
		
		// If there is a file and path
		
		if ($this->path && $this->filename)
		{
			
			// Delete file
			
			return self::_Delete ($this->path . $this->filename);
			
		}
		
		// Return TRUE
		
		return TRUE;
		
	}
84600
public function check()
    {
        $result = true;

        $configurationSettings = [
            'Database.Host',
            'Database.Username',
            'Database.Password',
            'Database.Port',
            'Database.Name',
        ];

        foreach ($configurationSettings as $setting) {
            if ($this->configuration->hasConfigurationKey($setting) === false) {
                $this->missingConfiguration[] = $setting;
                $result = false;
            }
        }

        return $result;
    }
741115
public function delete() {
        if (!$this->is_writable()) {
            return false;
        }

        if ($this->is_directory()) {
            $filepath = $this->lf->get_filepath();
            $fs = get_file_storage();
            $storedfiles = $fs->get_area_files($this->context->id, $this->get_component(), $this->lf->get_filearea(), $this->lf->get_itemid());
            foreach ($storedfiles as $file) {
                if (strpos($file->get_filepath(), $filepath) === 0) {
                    $file->delete();
                }
            }
        }

        return $this->lf->delete();
    }
443587
public function deleteOutdated(): bool
    {
        //TODO: check the need to call
        clearstatcache();
        
        $dh = @opendir($this->cacheDir);
        if (false === $dh) {
            return false;
        }
        
        while (false !== ($entry = readdir($dh))) {
            $filePath = $this->cacheDir . '/' . $entry;
            
            //exclude '.', '..', '.htaccess'
            if (!is_file($filePath) || 0 === strpos($entry, '.')) {
                continue;
            }
            
            try {
                $packet = $this->getPacketFromFile($filePath);
                if ($packet->outdated()) {
                    unlink($filePath);
                }
            } catch (BadPacketException $e) {
                unlink($filePath);
            }
        }
        
        closedir($dh);
        
        return true;
    }
741376
public function deleteDirectories( string $directory )
	{
		try {
			$allDirectories = Iterator::createInstance( $directory )->getDirectories();
		}
		catch( Exceptions\InvalidArgumentPathException $e ) { return false; }

		if( $allDirectories->isNotEmpty() )
		{
			/** @var \SplFileInfo $directoryName */
			foreach( $allDirectories as $directoryName )
			{
				$this->deleteDirectory( $directoryName->getPathname() );
			}
			return true;
		}

		return false;
	}