diff --git a/src/Controller/Component.php b/src/Controller/Component.php index 4a75ed4..c389198 100644 --- a/src/Controller/Component.php +++ b/src/Controller/Component.php @@ -167,7 +167,7 @@ class Controller_Component function getInfo() { $filename = Path::join($this->viewPath[0], 'install.json'); if (file_exists($filename)) { - $settings = json_decode(file_get_contents($filename), true); + $settings = json_decode(File::getContents($filename), true); return $settings; } return array(); diff --git a/src/Database/Manager.php b/src/Database/Manager.php index 036710c..ec354c7 100644 --- a/src/Database/Manager.php +++ b/src/Database/Manager.php @@ -141,7 +141,7 @@ class Database_Manager $this->db->query($q); } - function getConstraintDef($c) { + function getConstraintDef(/*.array.*/$c) { if ($c['type'] == 'unique') { return "UNIQUE(" . implode(", ", $c['fields']) . ")"; } diff --git a/src/File.php b/src/File.php new file mode 100644 index 0000000..888a44b --- /dev/null +++ b/src/File.php @@ -0,0 +1,11 @@ +format == 'json') { - $settings = json_decode(file_get_contents($this->file), true); + $settings = json_decode(File::getContents($this->file), true); } else { include ($this->file); } diff --git a/src/Tools/SQLStatementExtractor.php b/src/Tools/SQLStatementExtractor.php index 180d779..739f6c7 100644 --- a/src/Tools/SQLStatementExtractor.php +++ b/src/Tools/SQLStatementExtractor.php @@ -38,10 +38,10 @@ class Tools_SQLStatementExtractor { */ public static function extractFile($filename) { $buffer = file_get_contents($filename); - if ($buffer === false) { - throw new Exception("Unable to read file: " . $filename); + if ($buffer !== false) { + return self::extractStatements(self::getLines($buffer)); } - return self::extractStatements(self::getLines($buffer)); + throw new Exception("Unable to read file: " . $filename); } /**