Skip to content

Commit 784ffb5

Browse files
committed
fixes
1 parent b218376 commit 784ffb5

File tree

5 files changed

+23
-11
lines changed

5 files changed

+23
-11
lines changed

README.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,16 @@ To customize the configuration, do not edit `config.dist.php` directly, but copy
6161

6262
Replace all files and delete the `/tmp/twig` folder (it contains compiled Twig templates).
6363

64+
## Cronjob
65+
66+
You can add these links to your cronjob to collect metrics when the dashboard is not open:
67+
68+
Redis `https://example.com/phpCacheAdmin/?dashboard=redis&ajax&metrics`
69+
70+
Memcached `https://example.com/phpCacheAdmin/?dashboard=memcached&ajax&metrics`
71+
72+
Metrics are collected whenever this link is refreshed, so you can set any time in the cronjob.
73+
6474
## Environment variables
6575

6676
All keys from the [config](https://github.com/RobiNN1/phpCacheAdmin/blob/master/config.dist.php) file are supported ENV variables,
@@ -147,6 +157,8 @@ services:
147157
148158
## Custom Dashboards
149159
160+
Here is an example of how to implement a custom dashboard
161+
150162
- [FileCache](https://github.com/RobiNN1/FileCache-Dashboard) ([`robinn/cache`](https://github.com/RobiNN1/Cache)) dashboard.
151163

152164
## Contributing

config.dist.php

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@
6161
//'separator' => ':', // Separator for tree view (optional)
6262
],
6363
],
64-
//'apcuseparator' => ':', // Separator for tree view (optional)
64+
'apcuseparator' => ':', // Separator for tree view (optional)
6565
// Example of authentication with http auth.
6666
/*'auth' => static function (): void {
6767
$username = 'admin';
@@ -149,8 +149,9 @@
149149
'panelrefresh' => 30, // In seconds, refresh interval for panels - default 30
150150
'metricsrefresh' => 60, // In seconds, refresh interval for metrics - default 60
151151
'metricstab' => 1440, // Default tab in metrics, 60 - Last hour, 1440 - Last day, 10080 - Last week, 43200 - Last month - default 1440
152-
'hash' => 'pca', // Any random string to secure a metrics DB file
153-
'tmpdir' => __DIR__.'/tmp',
154-
//'pcapath' => 'vendor/robinn/phpcacheadmin/', // Path to the package when installed via composer. User for assets.
155-
//'url' => '/', // URL to the package, e.g., /phpcacheadmin
152+
'hash' => 'pca', // Any random string to secure a metrics DB file.
153+
'metricsdir' => __DIR__.'/tmp/metrics', // Directory for metrics DB files.
154+
'twigcache' => __DIR__.'/tmp/twig', // Directory for Twig cache files.
155+
//'pcapath' => 'vendor/robinn/phpcacheadmin/', // Path to the package when installed via composer. Used for assets.
156+
//'url' => '/', // URL to the dashboard when installed via composer, e.g., /phpcacheadmin
156157
];

src/Dashboards/Memcached/MemcachedMetrics.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ public function __construct(
3333
) {
3434
$server_name = Helpers::getServerTitle($servers[$selected]);
3535
$hash = md5($server_name.Config::get('hash', 'pca'));
36-
$tmp = Config::get('tmpdir', __DIR__.'/../../../tmp');
37-
$db = $tmp.'/memcached_metrics_'.$hash.'.db';
36+
$dir = Config::get('metricsdir', __DIR__.'/../../../tmp/metrics');
37+
$db = $dir.'/memcached_metrics_'.$hash.'.db';
3838

3939
$this->pdo = new PDO('sqlite:'.$db);
4040
$this->pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);

src/Dashboards/Redis/RedisMetrics.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ public function __construct(
3333
) {
3434
$server_name = Helpers::getServerTitle($servers[$selected]);
3535
$hash = md5($server_name.Config::get('hash', 'pca'));
36-
$tmp = Config::get('tmpdir', __DIR__.'/../../../tmp');
37-
$db = $tmp.'/redis_metrics_'.$hash.'.db';
36+
$dir = Config::get('metricsdir', __DIR__.'/../../../tmp/metrics');
37+
$db = $dir.'/redis_metrics_'.$hash.'.db';
3838

3939
$this->pdo = new PDO('sqlite:'.$db);
4040
$this->pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);

src/Template.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,8 @@ public function addPath(string $namespace, string $path): void {
4949

5050
private function initTwig(): Environment {
5151
$loader = new FilesystemLoader(__DIR__.'/../templates');
52-
$tmp = Config::get('tmpdir', __DIR__.'/../tmp');
5352
$twig = new Environment($loader, [
54-
'cache' => Config::get('twigcache', $tmp.'/twig'),
53+
'cache' => Config::get('twigcache', __DIR__.'/../tmp/twig'),
5554
'debug' => Config::get('twigdebug', false),
5655
]);
5756

0 commit comments

Comments
 (0)