diff options
Diffstat (limited to 'core/controllers')
-rw-r--r-- | core/controllers/welcome.php | 50 |
1 files changed, 48 insertions, 2 deletions
diff --git a/core/controllers/welcome.php b/core/controllers/welcome.php index 3329a402..1e77ad4a 100644 --- a/core/controllers/welcome.php +++ b/core/controllers/welcome.php @@ -17,8 +17,54 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ -class Welcome_Controller extends Controller { +class Welcome_Controller extends Template_Controller { + public $template = 'welcome.html'; + function Index() { - print new View('welcome.html'); + } + + function Syscheck() { + $errors = array(); + if (!file_exists(VARPATH)) { + $error = new stdClass(); + $error->message = "Missing: " . VARPATH; + $error->instructions[] = "mkdir " . VARPATH; + $error->instructions[] = "chmod 777 " . VARPATH; + $errors[] = $error; + } else if (!is_writable(VARPATH)) { + $error = new stdClass(); + $error->message = "Not writable: " . VARPATH; + $error->instructions[] = "chmod 777 " . VARPATH; + $errors[] = $error; + } + + $db_php = VARPATH . "database.php"; + if (!file_exists($db_php)) { + $error = new stdClass(); + $error->message = "Missing: $db_php"; + $error->instructions[] = "cp kohana/config/database.php $db_php"; + $error->instructions[] = "chmod 644 $db_php"; + $error->message2 = "Then edit this file and enter your database configuration settings."; + $errors[] = $error; + } else if (!is_readable($db_php)) { + $error->message = "Not readable: $db_php"; + $error->instructions[] = "chmod 644 $db_php"; + $error->message2 = "Then edit this file and enter your database configuration settings."; + $errors[] = $error; + } + + if (empty($errors)) { + Database::instance()->connect(); + } + + $this->_create_directories(); + $this->template = new View('welcome_syscheck.html'); + $this->template->errors = $errors; + } + + function _create_directories() { + foreach (array("logs") as $dir) { + @mkdir(VARPATH . "$dir"); + } } } |