Skip to content

Commit 3e30be7

Browse files
committed
Refactored cli-service structure
1 parent 4434dc0 commit 3e30be7

19 files changed

+91
-2688
lines changed

composer.json

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,11 @@
1919
],
2020
"homepage": "https://cypht.org",
2121
"license": "LGPL-2.1",
22+
"autoload": {
23+
"psr-4": {
24+
"Services\\": "services/"
25+
}
26+
},
2227
"authors": [
2328
{
2429
"name": "Jason Munro",
@@ -38,7 +43,6 @@
3843
"bacon/bacon-qr-code": "^1.0.3 || ^2.0.0",
3944
"christian-riesen/base32": "^1.3.2",
4045
"composer": "^2.0.0",
41-
"cypht/cli-service": "*",
4246
"ext-curl": "*",
4347
"ext-fileinfo": "*",
4448
"ext-iconv": "*",
@@ -50,7 +54,9 @@
5054
"henrique-borba/php-sieve-manager": "^1.0",
5155
"league/commonmark": "^2.4",
5256
"paragonie/random_compat": "^2.0.18",
57+
"php-di/php-di": "^7.0",
5358
"php": ">=8.1",
59+
"symfony/console": "^6.4",
5460
"symfony/dotenv": "^4.3 || 5.4",
5561
"symfony/yaml": "~6.4.3",
5662
"thomaspark/bootswatch": "^5.3",
@@ -88,13 +94,5 @@
8894
"post-update-cmd": "composer suggest",
8995
"post-package-install": "composer suggest",
9096
"post-install-cmd": "composer suggest"
91-
},
92-
"minimum-stability": "dev",
93-
"prefer-stable": true,
94-
"repositories": [
95-
{
96-
"type": "path",
97-
"url": "./packages/cli-service"
98-
}
99-
]
97+
}
10098
}

composer.lock

Lines changed: 3 additions & 43 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

console

Lines changed: 39 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,53 @@
11
#!/usr/bin/env php
22
<?php
3-
define('SKIP_HM_DISPATCH', true);
4-
5-
63
// Load the application dependencies and bootstrap the application
7-
require_once __DIR__ . '/index.php';
4+
define('APP_PATH', '');
5+
define('VENDOR_PATH', APP_PATH.'vendor/');
6+
define('CONFIG_PATH', APP_PATH.'config/');
7+
define('WEB_ROOT', '');
8+
define('ASSETS_THEMES_ROOT', '');
9+
define('DEBUG_MODE', true);
10+
define('CACHE_ID', '');
11+
define('SITE_ID', '');
12+
define('JS_HASH', '');
13+
define('CSS_HASH', '');
14+
15+
/* show all warnings in debug mode */
16+
if (DEBUG_MODE) {
17+
error_reporting(E_ALL);
18+
}
19+
20+
/* don't let anything output content until we are ready */
21+
ob_start();
22+
23+
require VENDOR_PATH.'autoload.php';
24+
/* get includes */
25+
require APP_PATH.'lib/framework.php';
26+
$environment = Hm_Environment::getInstance();
27+
$environment->load();
28+
29+
/* get configuration */
30+
$config = new Hm_Site_Config_File();
31+
/* set default TZ */
32+
date_default_timezone_set($config->get('default_setting_timezone', 'UTC'));
33+
/* set the default since and per_source values */
34+
$environment->define_default_constants($config);
35+
36+
/* setup ini settings */
37+
if (!$config->get('disable_ini_settings')) {
38+
require APP_PATH.'lib/ini_set.php';
39+
}
840

941

1042
use Symfony\Component\Console\Application;
11-
use Cypht\Service\Providers\CommandServiceProvider;
43+
use Services\Providers\Hm_CommandServiceProvider;
1244

13-
$container = require __DIR__ . '/packages/cli-service/bootstrap.php';
45+
$container = require __DIR__ . '/services/Hm_bootstrap.php';
1446

1547
$application = new Application('Cypht Console', '1.0');
1648

1749
// Register commands automatically using the service provider
18-
$commandServiceProvider = new CommandServiceProvider();
50+
$commandServiceProvider = new Hm_CommandServiceProvider();
1951
$commandServiceProvider->register($application, $container);
2052

2153
// Run the console application

index.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,7 @@
4949
require APP_PATH.'lib/ini_set.php';
5050
}
5151
/* process the request */
52-
if (!defined('SKIP_HM_DISPATCH')) {
53-
new Hm_Dispatch($config);
54-
}
52+
new Hm_Dispatch($config);
5553

5654
/* log some debug stats about the page */
5755
if (DEBUG_MODE) {

packages/cli-service/.gitignore

Lines changed: 0 additions & 1 deletion
This file was deleted.

packages/cli-service/composer.json

Lines changed: 0 additions & 31 deletions
This file was deleted.

0 commit comments

Comments
 (0)