Subversion-Projekte lars-tiefland.laravel_shop

Revision

Details | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
148 lars 1
<?php
2
 
3
use Doctrine\DBAL\Tools\Console\ConsoleRunner;
4
 
5
fwrite(
6
    STDERR,
7
    '[Warning] The use of this script is discouraged.'
8
        . ' You find instructions on how to bootstrap the console runner in our documentation.'
9
        . PHP_EOL,
10
);
11
 
12
echo PHP_EOL . PHP_EOL;
13
 
14
$files       = [__DIR__ . '/../vendor/autoload.php', __DIR__ . '/../../../autoload.php'];
15
$loader      = null;
16
$cwd         = getcwd();
17
$directories = [$cwd, $cwd . DIRECTORY_SEPARATOR . 'config'];
18
$configFile  = null;
19
 
20
foreach ($files as $file) {
21
    if (file_exists($file)) {
22
        $loader = require $file;
23
 
24
        break;
25
    }
26
}
27
 
28
if (! $loader) {
29
    throw new RuntimeException('vendor/autoload.php could not be found. Did you run `php composer.phar install`?');
30
}
31
 
32
foreach ($directories as $directory) {
33
    $configFile = $directory . DIRECTORY_SEPARATOR . 'cli-config.php';
34
 
35
    if (file_exists($configFile)) {
36
        break;
37
    }
38
}
39
 
40
if (! file_exists($configFile)) {
41
    ConsoleRunner::printCliConfigTemplate();
42
 
43
    exit(1);
44
}
45
 
46
if (! is_readable($configFile)) {
47
    echo 'Configuration file [' . $configFile . '] does not have read permission.' . PHP_EOL;
48
 
49
    exit(1);
50
}
51
 
52
$commands           = [];
53
$connectionProvider = require $configFile;
54
 
55
ConsoleRunner::run($connectionProvider, $commands);