-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathstub.php
39 lines (29 loc) · 995 Bytes
/
stub.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
<?php
/**
* @file
* Stub file for the phar build.
*/
use Symfony\Component\Console\Application;
use Drutiny\CommandDiscovery;
use Doctrine\Common\Annotations\AnnotationRegistry;
ini_set('memory_limit', '-1');
const DRUTINY_LIB = __DIR__;
$timezone = 'UTC';
// Set the timezone to the local OS if supported.
if (file_exists('/etc/localtime')) {
$systemZoneName = readlink('/etc/localtime');
if (strpos($systemZoneName, 'zoneinfo') !== FALSE) {
$timezone = substr($systemZoneName, strpos($systemZoneName, 'zoneinfo') + 9);
}
}
date_default_timezone_set($timezone);
$loader = require DRUTINY_LIB . '/vendor/autoload.php';
AnnotationRegistry::registerLoader([$loader, 'loadClass']);
$version_filename = DRUTINY_LIB . '/VERSION';
$version = 'unknown';
if (file_exists($version_filename)) {
$version = file_get_contents($version_filename);
}
$application = new Application('Drutiny', $version);
$application->addCommands(CommandDiscovery::findCommands());
$application->run();