Minor fixes and path checks

This commit is contained in:
Klaus Silveira
2013-05-05 22:43:41 -03:00
parent f6852d2d83
commit 89bc96b4e0
2 changed files with 33 additions and 35 deletions

View File

@@ -4,32 +4,17 @@ if (!isset($config)) {
die("No configuration object provided.");
}
$repositories = $config->get('git', 'repositories');
if (!is_array($repositories)) {
# Convert the single item to an array - this is the internal handling
$repositories = array($repositories);
if (!is_writable(__DIR__ . DIRECTORY_SEPARATOR . 'cache')) {
die(sprintf('The "%s" folder must be writable for GitList to run.', __DIR__ . DIRECTORY_SEPARATOR . 'cache'));
}
$tmp_arr = array();
foreach ($repositories as $repo) {
$tmp = rtrim($repo, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR;
$tmp_arr []= $tmp;
}
$repositories = $tmp_arr;
// Startup and configure Silex application
$app = new GitList\Application($config, __DIR__);
// Mount the controllers
$app->mount('', new GitList\Controller\MainController());
$app->mount('', new GitList\Controller\BlobController());
$app->mount('', new GitList\Controller\CommitController());
$app->mount('', new GitList\Controller\TreeController());
return $app;