Skip to content

Commit a4af194

Browse files
authored
Merge pull request #87 from amnuts/working/3.4.0
Working/3.4.0
2 parents 06ddd7d + 19c78c8 commit a4af194

File tree

11 files changed

+874
-431
lines changed

11 files changed

+874
-431
lines changed

.gitignore

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
/status.js
2-
/src/status.js
31
/.idea
42
/.module-cache
53
/node_modules
4+
/vendor
65
/package-lock.json
76
/build/*
87
!/build/template.phps
98
!/build/build.php
109
!/build/_frontend
11-
/vendor
10+
!/build/_languages
11+
/*.js

README.md

+129-67
Large diffs are not rendered by default.

build/_frontend/interface.jsx

+100-72
Large diffs are not rendered by default.

build/_languages/example.json

+107
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
{
2+
"(unsafe) Collect constants": "",
3+
"++, +=, series of jumps": "",
4+
"Adjust used stack": "",
5+
"Ascending": "",
6+
"Available functions": "",
7+
"blacklist misses": "",
8+
"buffer size": "",
9+
"Cached": "",
10+
"CALL GRAPH optimization": "",
11+
"CFG based optimization": "",
12+
"Compile all functions on script load": "",
13+
"Compile functions on first execution": "",
14+
"Constant conversion and jumps": "",
15+
"CPU-specific optimization": "",
16+
"CSE, STRING construction": "",
17+
"Currently unused": "",
18+
"DCE (dead code elimination)": "",
19+
"Descending": "",
20+
"DFA based optimization": "",
21+
"Directives": "",
22+
"Disable CPU-specific optimization": "",
23+
"Disable real-time update": "",
24+
"Do not perform register allocation": "",
25+
"Enable real-time update": "",
26+
"Enable use of AVX, if the CPU supports it": "",
27+
"false": "",
28+
"File list pagination": "",
29+
"force file invalidation": "",
30+
"free memory": "",
31+
"General info": "",
32+
"has been invalidated": "",
33+
"hit rate": "",
34+
"hits": "",
35+
"Host": "",
36+
"Ignored": "",
37+
"INIT_FCALL_BY_NAME -> DO_FCALL": "",
38+
"Inline functions": "",
39+
"Inline VM handlers": "",
40+
"interned strings usage": "",
41+
"Invalidate all matching files": "",
42+
"jit buffer free": "",
43+
"jit buffer": "",
44+
"keys": "",
45+
"Last modified": "",
46+
"last modified": "",
47+
"Last reset": "",
48+
"Last used": "",
49+
"last used": "",
50+
"max cached keys": "",
51+
"Memory consumption": "",
52+
"memory usage": "",
53+
"memory": "",
54+
"Merge equal constants": "",
55+
"Minimal JIT (call standard VM handlers)": "",
56+
"never": "",
57+
"Next": "",
58+
"No files have been cached or you have <i>opcache.file_cache_only<\/i> turned on": "",
59+
"No files have been ignored via <i>opcache.blacklist_filename<\/i>": "",
60+
"No files have been preloaded <i>opcache.preload<\/i>": "",
61+
"No JIT": "",
62+
"no value": "",
63+
"NOP removal": "",
64+
"number of cached files": "",
65+
"number of cached keys": "",
66+
"Number of hits": "",
67+
"number of hits": "",
68+
"number of misses": "",
69+
"number of strings": "",
70+
"opcache statistics": "",
71+
"Optimization level": "",
72+
"Optimize whole script": "",
73+
"Overview": "",
74+
"Path": "",
75+
"Perform block-local register allocation": "",
76+
"Perform global register allocation": "",
77+
"preload memory": "",
78+
"Preloaded": "",
79+
"Previous": "",
80+
"Profile functions on first request and compile the hottest functions afterwards": "",
81+
"Profile on the fly and compile hot functions": "",
82+
"Register allocation": "",
83+
"Remove unused variables": "",
84+
"Reset cache": "",
85+
"SCCP (constant propagation)": "",
86+
"Script": "",
87+
"Server Software": "",
88+
"Sort order": "",
89+
"Start time": "",
90+
"Start typing to filter on script path": "",
91+
"TMP VAR usage": "",
92+
"total memory": "",
93+
"Trigger": "",
94+
"true": "",
95+
"Use call graph": "",
96+
"Use tracing JIT. Profile on the fly and compile traces for hot code segments": "",
97+
"Use type inference": "",
98+
"used memory": "",
99+
"View manual page": "",
100+
"View {0} manual entry": "",
101+
"wasted memory": "",
102+
"You have <i>opcache.file_cache_only<\/i> turned on. As a result, the memory information is not available. Statistics and file list may also not be returned by <i>opcache_get_statistics()<\/i>.": "",
103+
"{0} files cached": "",
104+
"{0} files cached, {1} showing due to filter '{2}'": "",
105+
"{0} ignore file locations": "",
106+
"{0} preloaded files": ""
107+
}

build/_languages/fr.json

+107
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
{
2+
"(unsafe) Collect constants": "(instable) Collecter les constantes",
3+
"++, +=, series of jumps": "++, +=, séries de sauts",
4+
"Adjust used stack": "Ajuster la pile utilisée",
5+
"Ascending": "Croissant",
6+
"Available functions": "Fonctions disponibles",
7+
"blacklist misses": "Ratés mis sur liste noire",
8+
"buffer size": "taille du tampon",
9+
"Cached": "En cache",
10+
"CALL GRAPH optimization": "Optimisation CALL GRAPH",
11+
"CFG based optimization": "Optimisation basée sur CFG",
12+
"Compile all functions on script load": "Compiler toutes les fonctions au chargement du script",
13+
"Compile functions on first execution": "Compiler les fonctions à la première exécution",
14+
"Constant conversion and jumps": "Conversion des constantes et sauts",
15+
"CPU-specific optimization": "Optimisation spécifique au CPU",
16+
"CSE, STRING construction": "Construction CSE, STRING",
17+
"Currently unused": "Actuellement inutilisé",
18+
"DCE (dead code elimination)": "DCE (élimination du code mort)",
19+
"Descending": "Décroissant",
20+
"DFA based optimization": "Optimisation basée sur DFA",
21+
"Directives": "Directives",
22+
"Disable CPU-specific optimization": "Désactiver l'optimisation spécifique au processeur",
23+
"Disable real-time update": "Désactiver la mise à jour en temps réel",
24+
"Do not perform register allocation": "Ne pas effectuer d'allocation de registre",
25+
"Enable real-time update": "Activer la mise à jour en temps réel",
26+
"Enable use of AVX, if the CPU supports it": "Activer l'utilisation d'AVX, si le CPU le prend en charge",
27+
"false": "faux",
28+
"File list pagination": "Pagination de la liste des fichiers",
29+
"force file invalidation": "forcer l'invalidation du fichier",
30+
"free memory": "mémoire libre",
31+
"General info": "Informations générales",
32+
"has been invalidated": "a été invalidé",
33+
"hit rate": "taux de succès",
34+
"hits": "accès",
35+
"Host": "Hôte",
36+
"Ignored": "Ignoré",
37+
"INIT_FCALL_BY_NAME -> DO_FCALL": "INIT_FCALL_BY_NAME -> DO_FCALL",
38+
"Inline functions": "Fonctions inline",
39+
"Inline VM handlers": "Gestionnaires de VM inline",
40+
"interned strings usage": "utilisation des chaînes internées",
41+
"Invalidate all matching files": "Invalider tous les fichiers correspondants",
42+
"jit buffer free": "tampon jit libre",
43+
"jit buffer": "tampon jit",
44+
"keys": "clés",
45+
"Last modified": "Dernière modification",
46+
"last modified": "dernière modification",
47+
"Last reset": "Dernière réinitialisation",
48+
"Last used": "Dernière utilisation",
49+
"last used": "dernière utilisation",
50+
"max cached keys": "max de clés en cache",
51+
"Memory consumption": "Consommation mémoire",
52+
"memory usage": "utilisation de la mémoire",
53+
"memory": "mémoire",
54+
"Merge equal constants": "Fusionner les constantes égales",
55+
"Minimal JIT (call standard VM handlers)": "JIT minimal (appel des gestionnaires de VM standard)",
56+
"never": "jamais",
57+
"Next": "Suivant",
58+
"No files have been cached or you have <i>opcache.file_cache_only<\/i> turned on": "Aucun fichier n'a été mis en cache ou vous avez <i>opcache.file_cache_only<\/i> activé",
59+
"No files have been ignored via <i>opcache.blacklist_filename<\/i>": "Aucun fichier n'a été ignoré via <i>opcache.blacklist_filename<\/i>",
60+
"No files have been preloaded <i>opcache.preload<\/i>": "Aucun fichier n'a été préchargé <i>opcache.preload<\/i>",
61+
"No JIT": "Pas de JIT",
62+
"no value": "pas de valeur",
63+
"NOP removal": "Suppression de NOP",
64+
"number of cached files": "nombre de fichiers en cache",
65+
"number of cached keys": "nombre de clés en cache",
66+
"Number of hits": "Nombre d'accès",
67+
"number of hits": "nombre d'accès",
68+
"number of misses": "nombre de ratés",
69+
"number of strings": "nombre de chaînes",
70+
"opcache statistics": "statistiques d'opcache",
71+
"Optimization level": "Niveau d'optimisation",
72+
"Optimize whole script": "Optimiser tout le script",
73+
"Overview": "Vue d'ensemble",
74+
"Path": "Chemin",
75+
"Perform block-local register allocation": "Effectuer l'allocation de registre local de bloc",
76+
"Perform global register allocation": "Effectuer une allocation de registre globale",
77+
"preload memory": "précharger la mémoire",
78+
"Preloaded": "Préchargé",
79+
"Previous": "Précédent",
80+
"Profile functions on first request and compile the hottest functions afterwards": "Profiling des fonctions à la première demande et compilation des fonctions les plus fréquentes par la suite",
81+
"Profile on the fly and compile hot functions": "Profiling à la volée et compiler les fonctions les plus fréquentes",
82+
"Register allocation": "Allocation de registre",
83+
"Remove unused variables": "Supprimer les variables inutilisées",
84+
"Reset cache": "Réinitialiser le cache",
85+
"SCCP (constant propagation)": "SCCP (propagation des constantes)",
86+
"Script": "Script",
87+
"Server Software": "Logiciel serveur",
88+
"Sort order": "Ordre de tri",
89+
"Start time": "Heure de début",
90+
"Start typing to filter on script path": "Commencez à taper pour filtrer sur le chemin du script",
91+
"TMP VAR usage": "Utilisation TMP VAR",
92+
"total memory": "mémoire totale",
93+
"Trigger": "Déclencheur",
94+
"true": "vrai",
95+
"Use call graph": "Utiliser le graphe des appels",
96+
"Use tracing JIT. Profile on the fly and compile traces for hot code segments": "Utilisez le suivi JIT. Profiling à la volée et compilation des traces pour les segments de code les plus fréquents",
97+
"Use type inference": "Utiliser l'inférence de type",
98+
"used memory": "mémoire utilisée",
99+
"View manual page": "Voir la page du manuel",
100+
"View {0} manual entry": "Voir la page {0} du manuel",
101+
"wasted memory": "mémoire perdue",
102+
"You have <i>opcache.file_cache_only<\/i> turned on. As a result, the memory information is not available. Statistics and file list may also not be returned by <i>opcache_get_statistics()<\/i>.": "Vous avez <i>opcache.file_cache_only<\/i> activé. Par conséquent, les informations sur la mémoire ne sont pas disponibles. Les statistiques et la liste de fichiers peuvent également ne pas être renvoyées par <i>opcache_get_statistics()<\/i>.",
103+
"{0} files cached": "{0} fichiers mis en cache",
104+
"{0} files cached, {1} showing due to filter '{2}'": "{0} fichiers mis en cache, {1} s'affichent en raison du filtre '{2}'",
105+
"{0} ignore file locations": "{0} ignore les fichiers en fonction de l'emplacement",
106+
"{0} preloaded files": "{0} fichiers préchargés"
107+
}

build/build.php

+33-4
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,27 @@
44
* OPcache GUI - build script
55
*
66
* @author Andrew Collington, andy@amnuts.com
7-
* @version 3.3.1
7+
* @version 3.4.0
88
* @link https://github.com/amnuts/opcache-gui
99
* @license MIT, https://acollington.mit-license.org/
1010
*/
1111

12+
$options = getopt('jl:', ['local-js', 'lang:']);
13+
$makeJsLocal = (isset($options['j']) || isset($options['local-js']));
14+
$useLanguage = $options['l'] ?? $options['lang'] ?? null;
15+
$languagePack = 'null';
1216
$parentPath = dirname(__DIR__);
1317

18+
if ($useLanguage !== null) {
19+
$useLanguage = preg_replace('/[^a-z_-]/', '', $useLanguage);
20+
$languageFile = __DIR__ . "/_languages/{$useLanguage}.json";
21+
if (!file_exists($languageFile)) {
22+
echo "The '{$useLanguage}' file does not exist - using default English\n\n";
23+
} else {
24+
$languagePack = "<<< EOJSON\n" . file_get_contents($languageFile) . "\nEOJSON";
25+
}
26+
}
27+
1428
if (!file_exists($parentPath . '/node_modules')) {
1529
echo "🐢 Installing node modules\n";
1630
exec('npm install');
@@ -25,12 +39,27 @@
2539
$template = trim(file_get_contents(__DIR__ . '/template.phps'));
2640
$jsOutput = trim(file_get_contents(__DIR__ . '/interface.js'));
2741
$cssOutput = trim(file_get_contents(__DIR__ . '/interface.css'));
28-
$phpOutput = trim(join('', array_slice(file($parentPath . '/src/Opcache/Service.php'), 3)));
42+
$phpOutput = trim(implode('', array_slice(file($parentPath . '/src/Opcache/Service.php'), 3)));
43+
2944
$output = str_replace(
30-
['{{JS_OUTPUT}}', '{{CSS_OUTPUT}}', '{{PHP_OUTPUT}}'],
31-
[$jsOutput, $cssOutput, $phpOutput],
45+
['{{JS_OUTPUT}}', '{{CSS_OUTPUT}}', '{{PHP_OUTPUT}}', '{{LANGUAGE_PACK}}'],
46+
[$jsOutput, $cssOutput, $phpOutput, $languagePack],
3247
$template
3348
);
49+
if ($makeJsLocal) {
50+
echo "🔗 Making js links local\n";
51+
$jsTags = [];
52+
$matched = preg_match_all('!<script src="([^"]*)"></script>!', $output, $jsTags);
53+
if ($matched) {
54+
foreach ($jsTags[1] as $jsUrl) {
55+
$jsFile = basename($jsUrl);
56+
$jsFilePath = $parentPath . '/' . $jsFile;
57+
file_put_contents($jsFilePath, file_get_contents('https:' . $jsUrl));
58+
$output = str_replace($jsUrl, $jsFile, $output);
59+
}
60+
}
61+
}
62+
3463
file_put_contents($parentPath . '/index.php', $output);
3564

3665
echo "💯 Done!\n";

build/template.phps

+28-24
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ namespace Amnuts\Opcache;
88
* A simple but effective single-file GUI for the OPcache PHP extension.
99
*
1010
* @author Andrew Collington, andy@amnuts.com
11-
* @version 3.3.1
11+
* @version 3.4.0
1212
* @link https://github.com/amnuts/opcache-gui
1313
* @license MIT, https://acollington.mit-license.org/
1414
*/
@@ -20,24 +20,27 @@ namespace Amnuts\Opcache;
2020
*/
2121

2222
$options = [
23-
'allow_filelist' => true, // show/hide the files tab
24-
'allow_invalidate' => true, // give a link to invalidate files
25-
'allow_reset' => true, // give option to reset the whole cache
26-
'allow_realtime' => true, // give option to enable/disable real-time updates
27-
'refresh_time' => 5, // how often the data will refresh, in seconds
28-
'size_precision' => 2, // Digits after decimal point
29-
'size_space' => false, // have '1MB' or '1 MB' when showing sizes
30-
'charts' => true, // show gauge chart or just big numbers
31-
'debounce_rate' => 250, // milliseconds after key press to send keyup event when filtering
32-
'per_page' => 200, // How many results per page to show in the file list, false for no pagination
33-
'cookie_name' => 'opcachegui', // name of cookie
34-
'cookie_ttl' => 365, // days to store cookie
23+
'allow_filelist' => true, // show/hide the files tab
24+
'allow_invalidate' => true, // give a link to invalidate files
25+
'allow_reset' => true, // give option to reset the whole cache
26+
'allow_realtime' => true, // give option to enable/disable real-time updates
27+
'refresh_time' => 5, // how often the data will refresh, in seconds
28+
'size_precision' => 2, // Digits after decimal point
29+
'size_space' => false, // have '1MB' or '1 MB' when showing sizes
30+
'charts' => true, // show gauge chart or just big numbers
31+
'debounce_rate' => 250, // milliseconds after key press to send keyup event when filtering
32+
'per_page' => 200, // How many results per page to show in the file list, false for no pagination
33+
'cookie_name' => 'opcachegui', // name of cookie
34+
'cookie_ttl' => 365, // days to store cookie
35+
'datetime_format' => 'D, d M Y H:i:s O', // Show datetime in this format
3536
'highlight' => [
36-
'memory' => true, // show the memory chart/big number
37-
'hits' => true, // show the hit rate chart/big number
38-
'keys' => true, // show the keys used chart/big number
39-
'jit' => true // show the jit buffer chart/big number
40-
]
37+
'memory' => true, // show the memory chart/big number
38+
'hits' => true, // show the hit rate chart/big number
39+
'keys' => true, // show the keys used chart/big number
40+
'jit' => true // show the jit buffer chart/big number
41+
],
42+
// json structure of all text strings used, or null for default
43+
'language_pack' => {{LANGUAGE_PACK}}
4144
];
4245

4346
/*
@@ -62,15 +65,15 @@ $opcache = (new Service($options))->handle();
6265

6366
?>
6467
<!DOCTYPE html>
65-
<html>
68+
<html lang="en">
6669
<head>
6770
<meta charset="UTF-8">
6871
<meta name="viewport" content="width=device-width,initial-scale=1.0">
6972
<title>OPcache statistics on <?= $opcache->getData('version', 'host'); ?></title>
70-
<script src="//unpkg.com/react/umd/react.production.min.js" crossorigin></script>
71-
<script src="//unpkg.com/react-dom/umd/react-dom.production.min.js" crossorigin></script>
72-
<script src="//unpkg.com/axios/dist/axios.min.js" crossorigin></script>
73-
<style type="text/css">
73+
<script src="//unpkg.com/react/umd/react.production.min.js"></script>
74+
<script src="//unpkg.com/react-dom/umd/react-dom.production.min.js"></script>
75+
<script src="//unpkg.com/axios/dist/axios.min.js"></script>
76+
<style>
7477
{{CSS_OUTPUT}}
7578
</style>
7679
</head>
@@ -99,7 +102,8 @@ $opcache = (new Service($options))->handle();
99102
highlight: <?= json_encode($opcache->getOption('highlight')); ?>,
100103
debounceRate: <?= $opcache->getOption('debounce_rate'); ?>,
101104
perPageLimit: <?= json_encode($opcache->getOption('per_page')); ?>,
102-
realtimeRefresh: <?= json_encode($opcache->getOption('refresh_time')); ?>
105+
realtimeRefresh: <?= json_encode($opcache->getOption('refresh_time')); ?>,
106+
language: <?= json_encode($opcache->getOption('language_pack')); ?>,
103107
}), document.getElementById('interface'));
104108

105109
</script>

composer.json

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
"keywords": ["opcache", "cache", "gui", "opcodes", "interface"],
55
"minimum-stability": "stable",
66
"license": "MIT",
7+
"version": "3.4.0",
78
"authors": [
89
{
910
"name": "Andrew Collington",

0 commit comments

Comments
 (0)