mirror of
https://github.com/Pathduck/gallery3.git
synced 2026-04-21 21:19:18 -04:00
Improve welcome scaffolding to walk you through getting the var
directory set up correctly and a database config file in place.
This commit is contained in:
@@ -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");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,16 +13,34 @@
|
||||
background: white;
|
||||
border: 1px solid black;
|
||||
margin: 0 auto;
|
||||
padding: -10px;
|
||||
}
|
||||
|
||||
div.inner {
|
||||
padding: 1em;
|
||||
padding: 0 1em 0 1em;
|
||||
margin: 0px;
|
||||
}
|
||||
|
||||
p {
|
||||
margin: 0 0 0 0;
|
||||
padding-left: 1em;
|
||||
}
|
||||
|
||||
pre {
|
||||
margin: 0;
|
||||
padding-left: 2em;
|
||||
}
|
||||
|
||||
.error {
|
||||
color: red;
|
||||
}
|
||||
|
||||
div.block {
|
||||
padding: 0px;
|
||||
margin: 0px;
|
||||
padding-bottom: 1em;
|
||||
}
|
||||
|
||||
ul {
|
||||
margin-top: -1em;
|
||||
}
|
||||
@@ -51,7 +69,14 @@
|
||||
links to get you started.
|
||||
</p>
|
||||
|
||||
<h2>Useful Links</h2>
|
||||
<h2>About your config</h2>
|
||||
<iframe width="100%" src="<?= url::site("welcome/syscheck") ?>"/></iframe>
|
||||
|
||||
<h2>Activities</h2>
|
||||
<p>
|
||||
</p>
|
||||
|
||||
<h2>Documentation</h2>
|
||||
<ul>
|
||||
<li>
|
||||
<a href="http://docs.google.com/Doc?id=dfjxt593_184ff9jhmd8&hl=en">Gallery3: Prioritized Feature List</a>
|
||||
|
||||
49
core/views/welcome_syscheck.html.php
Normal file
49
core/views/welcome_syscheck.html.php
Normal file
@@ -0,0 +1,49 @@
|
||||
<? defined("SYSPATH") or die("No direct script access."); ?>
|
||||
<html>
|
||||
<head>
|
||||
<title>Gallery3 Scaffold</title>
|
||||
<style>
|
||||
body {
|
||||
font-family: Trebuchet MS;
|
||||
}
|
||||
|
||||
p {
|
||||
margin: 0 0 0 0;
|
||||
padding: 5px;
|
||||
}
|
||||
|
||||
pre {
|
||||
margin: 0;
|
||||
padding-left: 1em;
|
||||
}
|
||||
|
||||
.error {
|
||||
color: red;
|
||||
}
|
||||
|
||||
div.block {
|
||||
border: 1px solid black;
|
||||
margin-bottom: 5px;
|
||||
paddding: 1em;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<? foreach ($errors as $error): ?>
|
||||
<div class="block">
|
||||
<p class="error">
|
||||
<?= $error->message ?>
|
||||
</p>
|
||||
<? foreach ($error->instructions as $line): ?>
|
||||
<pre><?= $line ?></pre>
|
||||
<? endforeach ?>
|
||||
|
||||
<? if (!empty($error->message2)): ?>
|
||||
<p class="error">
|
||||
<?= $error->message2 ?>
|
||||
</p>
|
||||
<? endif ?>
|
||||
</div>
|
||||
<? endforeach ?>
|
||||
</body>
|
||||
</html>
|
||||
@@ -49,7 +49,11 @@ if (PHP_SAPI == 'cli') {
|
||||
@system('mkdir -p test/var/logs');
|
||||
define('VARPATH', realpath('test/var') . '/');
|
||||
} else {
|
||||
define('VARPATH', realpath('var') . '/');
|
||||
if (file_exists('var')) {
|
||||
define('VARPATH', realpath('var') . '/');
|
||||
} else {
|
||||
define('VARPATH', getcwd() . "/var/");
|
||||
}
|
||||
}
|
||||
|
||||
// Initialize.
|
||||
|
||||
Reference in New Issue
Block a user