Skip to content

Commit

Permalink
Tracy error in diagnostics panel fix
Browse files Browse the repository at this point in the history
  • Loading branch information
bicisteadm committed Dec 27, 2019
1 parent 47b7496 commit e3f42c7
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 8 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
vendor
composer.lock
composer.phar
.idea
.editorconfig
12 changes: 9 additions & 3 deletions WebLoader/Filter/CssUrlsFilter.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,13 @@ class CssUrlsFilter
private $docRoot;


public function __construct(string $docRoot, string $basePath = '/')
/**
* CssUrlsFilter constructor.
* @param string $docRoot
* @param string $basePath
* @throws InvalidArgumentException
*/
public function __construct(string $docRoot, string $basePath = '/')
{
$this->docRoot = Path::normalize($docRoot);

Expand All @@ -51,11 +57,11 @@ public function absolutizeUrl(string $url, string $quote, string $cssFile): stri

$cssFile = Path::normalize($cssFile);

$pathInfo = pathinfo($_SERVER['PHP_SELF']);
$pathInfo = pathinfo($_SERVER['PHP_SELF']);

// inside document root
if (strncmp($cssFile, $this->docRoot, strlen($this->docRoot)) === 0) {
$path = $this->basePath . substr(dirname($cssFile), strlen($this->docRoot)) . DIRECTORY_SEPARATOR . $url;
$path = $pathInfo['dirname'] ."/". $this->basePath . substr(dirname($cssFile), strlen($this->docRoot)) . DIRECTORY_SEPARATOR . $url;
} else {
// outside document root we don't know
$path = $pathInfo['dirname'] ."/". $this->basePath . dirname($cssFile). DIRECTORY_SEPARATOR . $url;
Expand Down
24 changes: 19 additions & 5 deletions WebLoader/Nette/Extension.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public function getConfigSchema(): Schema
'jsDefaults' => Expect::structure([
'checkLastModified' => Expect::bool(true),
'debug' => Expect::bool(false),
'sourceDir' => Expect::string('%wwwDir%/js'),
'sourceDir' => Expect::string('%wwwDir%'),
'tempDir' => Expect::string('%wwwDir%/' . self::DEFAULT_TEMP_PATH),
'tempPath' => Expect::string(self::DEFAULT_TEMP_PATH),
'files' => Expect::array(),
Expand All @@ -51,7 +51,7 @@ public function getConfigSchema(): Schema
'cssDefaults' => Expect::structure([
'checkLastModified' => Expect::bool(true),
'debug' => Expect::bool(false),
'sourceDir' => Expect::string('%wwwDir%/css')->dynamic(),
'sourceDir' => Expect::string('%wwwDir%')->dynamic(),
'tempDir' => Expect::string('%wwwDir%/' . self::DEFAULT_TEMP_PATH),
'tempPath' => Expect::string(self::DEFAULT_TEMP_PATH),
'files' => Expect::array(),
Expand All @@ -73,7 +73,10 @@ public function getConfigSchema(): Schema
}


public function loadConfiguration(): void
/**
* @throws CompilationException
*/
public function loadConfiguration(): void
{
$builder = $this->getContainerBuilder();

Expand Down Expand Up @@ -205,7 +208,13 @@ public function install(Configurator $configurator): void
}


private function findFiles(array $filesConfig, string $sourceDir): array
/**
* @param array $filesConfig
* @param string $sourceDir
* @return array
* @throws FileNotFoundException
*/
private function findFiles(array $filesConfig, string $sourceDir): array
{
$normalizedFiles = [];

Expand Down Expand Up @@ -250,7 +259,12 @@ private function findFiles(array $filesConfig, string $sourceDir): array
}


protected function checkFileExists(string $file, string $sourceDir): void
/**
* @param string $file
* @param string $sourceDir
* @throws FileNotFoundException
*/
protected function checkFileExists(string $file, string $sourceDir): void
{
if (!$this->fileExists($file)) {
$tmp = rtrim($sourceDir, '/\\') . DIRECTORY_SEPARATOR . $file;
Expand Down

1 comment on commit e3f42c7

@bicisteadm
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixes #1

Please sign in to comment.