From fc8cf562f5d7d4f0514512703f017f2979a6dea6 Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Mon, 19 Jan 2009 07:26:25 +0000 Subject: Fix up various little things to get File_Structure_Test to pass. --- core/controllers/welcome.php | 3 ++- core/tests/File_Structure_Test.php | 8 +++++--- installer/database_config.php | 4 ++-- installer/index.php | 5 +---- installer/init_var.php | 3 ++- installer/install.sql | 6 +++--- 6 files changed, 15 insertions(+), 14 deletions(-) diff --git a/core/controllers/welcome.php b/core/controllers/welcome.php index ab23fe99..e009452f 100644 --- a/core/controllers/welcome.php +++ b/core/controllers/welcome.php @@ -531,7 +531,8 @@ class Welcome_Controller extends Template_Controller { } $fd = fopen($var_file, "w"); - fwrite($fd, "\n"); + fwrite($fd, " $file){ if ($file->getBasename() == "database.php") { continue; diff --git a/core/tests/File_Structure_Test.php b/core/tests/File_Structure_Test.php index 2c6bd239..e648192a 100644 --- a/core/tests/File_Structure_Test.php +++ b/core/tests/File_Structure_Test.php @@ -60,7 +60,9 @@ class File_Structure_Test extends Unit_Test_Case { $expected = $this->_get_preamble(__FILE__); foreach ($dir as $file) { - if (preg_match("/views/", $file->getPathname())) { + if (preg_match("/views/", $file->getPathname()) || + $file->getPathName() == DOCROOT . "installer/database_config.php" || + $file->getPathName() == DOCROOT . "installer/init_var.php") { // The preamble for views is a single line that prevents direct script access $lines = file($file->getPathname()); $this->assert_equal( @@ -70,8 +72,8 @@ class File_Structure_Test extends Unit_Test_Case { } else if (preg_match("|\.php$|", $file->getPathname())) { $actual = $this->_get_preamble($file->getPathname()); if ($file->getPathName() == DOCROOT . "index.php" || - $file->getPathName() == DOCROOT . "installer/install.php") { - // index.php and installer.php allow direct access, so modify our expectations for them + $file->getPathName() == DOCROOT . "installer/index.php") { + // index.php and installer/index.php allow direct access; modify our expectations for them $index_expected = $expected; $index_expected[0] = "assert_equal($index_expected, $actual, "in file: {$file->getPathname()}"); diff --git a/installer/database_config.php b/installer/database_config.php index 78492eba..3cc452ed 100644 --- a/installer/database_config.php +++ b/installer/database_config.php @@ -1,5 +1,5 @@ - - defined('SYSPATH') OR die('No direct access allowed.'); + + defined("SYSPATH") or die("No direct script access."); /** * @package Database diff --git a/installer/index.php b/installer/index.php index 0d77188d..e76a1f98 100644 --- a/installer/index.php +++ b/installer/index.php @@ -28,10 +28,7 @@ */ define("DOCROOT", dirname(dirname(__FILE__)) . "/"); define("VARPATH", DOCROOT . "var/"); - -// Define this to get the preamable to pass -// @todo: change all preambles to key off of VARPATH instead -define("SYSPATH", "anything"); +define("SYSPATH", "DEFINED_TO_SOMETHING_SO_THAT_WE_CAN_KEEP_CONSISTENT_PREAMBLES_IN_THE_INSTALLER"); require(DOCROOT . "installer/installer.php"); installer::command_line(); diff --git a/installer/init_var.php b/installer/init_var.php index 471de7e7..7c5509f5 100644 --- a/installer/init_var.php +++ b/installer/init_var.php @@ -1,4 +1,5 @@ - +