Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

missing file notice implemented for groups

  • Loading branch information...
commit 1b842a07e4a5636fce035e0f3eacd3bd4fb9b083 1 parent 6d5a173
@mrclay mrclay authored committed
Showing with 17 additions and 7 deletions.
  1. +17 −7 min/lib/Minify/Controller/MinApp.php
View
24 min/lib/Minify/Controller/MinApp.php
@@ -35,7 +35,7 @@ public function setupSources($options) {
unset($options['minApp']);
$sources = array();
$this->selectionId = '';
- $missingUri = '';
+ $firstMissingResource = null;
if (isset($_GET['g'])) {
// add group(s)
@@ -70,7 +70,14 @@ public function setupSources($options) {
$sources[] = $this->_getFileSource($realpath, $cOptions);
} else {
$this->log("The path \"{$file}\" (realpath \"{$realpath}\") could not be found (or was not a file)");
- return $options;
+ if (null === $firstMissingResource) {
+ $firstMissingResource = basename($file);
+ continue;
+ } else {
+ $secondMissingResource = basename($file);
+ $this->log("More than one file was missing: '$firstMissingResource', '$secondMissingResource'");
+ return $options;
+ }
}
}
if ($sources) {
@@ -135,11 +142,12 @@ public function setupSources($options) {
$realpath = realpath($path);
if (false === $realpath || ! is_file($realpath)) {
$this->log("The path \"{$path}\" (realpath \"{$realpath}\") could not be found (or was not a file)");
- if (! $missingUri) {
- $missingUri = $uri;
+ if (null === $firstMissingResource) {
+ $firstMissingResource = $uri;
continue;
} else {
- $this->log("More than one file was missing: '$missingUri', '$uri'");
+ $secondMissingResource = $uri;
+ $this->log("More than one file was missing: '$firstMissingResource', '$secondMissingResource`'");
return $options;
}
}
@@ -159,11 +167,13 @@ public function setupSources($options) {
$this->selectionId .= implode(',', $basenames) . $ext;
}
if ($sources) {
- if ($missingUri) {
+ if (null !== $firstMissingResource) {
array_unshift($sources, new Minify_Source(array(
'id' => 'missingFile'
+ // should not cause cache invalidation
,'lastModified' => 0
- ,'content' => "/* Minify: missing file '" . ltrim($missingUri, '/') . "' */\n"
+ // due to caching, filename is unreliable.
+ ,'content' => "/* Minify: at least one missing file. See " . Minify::URL_DEBUG . " */\n"
,'minifier' => ''
)));
}
Please sign in to comment.
Something went wrong with that request. Please try again.