return TRUE;
}
+ /**
+ * Extract a single regex from a file.
+ *
+ * @param string $file
+ * File name
+ * @param string $regex
+ * A pattern to match. Ex: "foo=([a-z]+)".
+ * @return string|NULL
+ * The value matched.
+ */
+ protected static function extractRegex($file, $regex) {
+ $content = file_get_contents($file);
+ if (preg_match($regex, $content, $matches)) {
+ return $matches[1];
+ }
+ else {
+ return NULL;
+ }
+ }
+
}
if (!file_exists($this->getAbsFileName())) {
return TRUE;
}
- return $this->getChecksum() !== self::extractChecksum($this->getAbsFileName(), ';\(GenCodeChecksum:([a-z0-9]+)\);');
+ return $this->getChecksum() !== self::extractRegex($this->getAbsFileName(), ';\(GenCodeChecksum:([a-z0-9]+)\);');
}
public function run() {
return $absFileName;
}
- protected static function extractChecksum($file, $regex) {
- $content = file_get_contents($file);
- if (preg_match($regex, $content, $matches)) {
- return $matches[1];
- }
- else {
- return NULL;
- }
- }
-
protected function getChecksum() {
if (!$this->checksum) {
CRM_Utils_Array::flatten($this->tables[$this->name], $flat);