| 144 | | /* if ($result !== 0) { */ |
| 145 | | /* throw new Stagehand_TestRunner_Exception(); */ |
| 146 | | /* } */ |
| 147 | | } |
| 148 | | |
| 149 | | // }}} |
| 150 | | // {{{ _collectElements() |
| 151 | | |
| 152 | | /** |
| 153 | | */ |
| 154 | | private function _collectElements($directory) |
| 155 | | { |
| 156 | | $files = scandir($directory); |
| 157 | | for ($i = 0, $count = count($files); $i < $count; ++$i) { |
| 158 | | if ($files[$i] == '.' || $files[$i] == '..') { |
| 159 | | continue; |
| 160 | | } |
| 161 | | |
| 162 | | foreach ($this->_excludePatterns as $excludePattern) { |
| 163 | | if (preg_match($excludePattern, $files[$i])) { |
| 164 | | continue 2; |
| 165 | | } |
| 166 | | } |
| 167 | | |
| 168 | | $element = $directory . DIRECTORY_SEPARATOR . $files[$i]; |
| 169 | | if (!$this->_isFirstTime) { |
| 170 | | if (!array_key_exists($element, $this->_previousElements)) { |
| 171 | | throw new Stagehand_TestRunner_Exception(); |
| 172 | | } |
| 173 | | |
| 174 | | if (!is_dir($element)) { |
| 175 | | $mtime = filemtime($element); |
| 176 | | if ($this->_previousElements[$element]['mtime'] != $mtime) { |
| 177 | | throw new Stagehand_TestRunner_Exception(); |
| 178 | | } |
| 179 | | } |
| 180 | | |
| 181 | | $perms = fileperms($element); |
| 182 | | if ($this->_previousElements[$element]['perms'] != $perms) { |
| 183 | | throw new Stagehand_TestRunner_Exception(); |
| 184 | | } |
| 185 | | } |
| 186 | | |
| 187 | | if (!is_dir($element)) { |
| 188 | | $this->_currentElements[$element]['mtime'] = filemtime($element); |
| 189 | | } |
| 190 | | |
| 191 | | $this->_currentElements[$element]['perms'] = fileperms($element); |
| 192 | | |
| 193 | | if (is_dir($element)) { |
| 194 | | $this->_collectElements($element); |
| 195 | | } |
| 196 | | } |
| | 185 | } |
| | 186 | } |
| | 187 | |
| | 188 | // }}} |
| | 189 | // {{{ _collectElements() |
| | 190 | |
| | 191 | /** |
| | 192 | * Collects all files and directories in the directory and detects any |
| | 193 | * changes of a file or directory immediately. |
| | 194 | * |
| | 195 | * @param string $directory |
| | 196 | * @throws Stagehand_TestRunner_Exception |
| | 197 | */ |
| | 198 | private function _collectElements($directory) |
| | 199 | { |
| | 200 | $files = scandir($directory); |
| | 201 | for ($i = 0, $count = count($files); $i < $count; ++$i) { |
| | 202 | if ($files[$i] == '.' || $files[$i] == '..') { |
| | 203 | continue; |
| | 204 | } |
| | 205 | |
| | 206 | foreach ($this->_excludePatterns as $excludePattern) { |
| | 207 | if (preg_match($excludePattern, $files[$i])) { |
| | 208 | continue 2; |
| | 209 | } |
| | 210 | } |
| | 211 | |
| | 212 | $element = $directory . DIRECTORY_SEPARATOR . $files[$i]; |
| | 213 | if (!$this->_isFirstTime) { |
| | 214 | if (!array_key_exists($element, $this->_previousElements)) { |
| | 215 | throw new Stagehand_TestRunner_Exception(); |
| | 216 | } |
| | 217 | |
| | 218 | if (!is_dir($element)) { |
| | 219 | $mtime = filemtime($element); |
| | 220 | if ($this->_previousElements[$element]['mtime'] != $mtime) { |
| | 221 | throw new Stagehand_TestRunner_Exception(); |
| | 222 | } |
| | 223 | } |
| | 224 | |
| | 225 | $perms = fileperms($element); |
| | 226 | if ($this->_previousElements[$element]['perms'] != $perms) { |
| | 227 | throw new Stagehand_TestRunner_Exception(); |
| | 228 | } |
| | 229 | } |
| | 230 | |
| | 231 | if (!is_dir($element)) { |
| | 232 | $this->_currentElements[$element]['mtime'] = filemtime($element); |
| | 233 | } |
| | 234 | |
| | 235 | $this->_currentElements[$element]['perms'] = fileperms($element); |
| | 236 | |
| | 237 | if (is_dir($element)) { |
| | 238 | $this->_collectElements($element); |
| | 239 | } |