Skip to content

Commit

Permalink
Merge pull request #87 from amnuts/working/3.4.0
Browse files Browse the repository at this point in the history
Working/3.4.0
  • Loading branch information
amnuts authored Aug 2, 2022
2 parents 06ddd7d + 19c78c8 commit a4af194
Show file tree
Hide file tree
Showing 11 changed files with 874 additions and 431 deletions.
6 changes: 3 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
/status.js
/src/status.js
/.idea
/.module-cache
/node_modules
/vendor
/package-lock.json
/build/*
!/build/template.phps
!/build/build.php
!/build/_frontend
/vendor
!/build/_languages
/*.js
196 changes: 129 additions & 67 deletions README.md

Large diffs are not rendered by default.

172 changes: 100 additions & 72 deletions build/_frontend/interface.jsx

Large diffs are not rendered by default.

107 changes: 107 additions & 0 deletions build/_languages/example.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
{
"(unsafe) Collect constants": "",
"++, +=, series of jumps": "",
"Adjust used stack": "",
"Ascending": "",
"Available functions": "",
"blacklist misses": "",
"buffer size": "",
"Cached": "",
"CALL GRAPH optimization": "",
"CFG based optimization": "",
"Compile all functions on script load": "",
"Compile functions on first execution": "",
"Constant conversion and jumps": "",
"CPU-specific optimization": "",
"CSE, STRING construction": "",
"Currently unused": "",
"DCE (dead code elimination)": "",
"Descending": "",
"DFA based optimization": "",
"Directives": "",
"Disable CPU-specific optimization": "",
"Disable real-time update": "",
"Do not perform register allocation": "",
"Enable real-time update": "",
"Enable use of AVX, if the CPU supports it": "",
"false": "",
"File list pagination": "",
"force file invalidation": "",
"free memory": "",
"General info": "",
"has been invalidated": "",
"hit rate": "",
"hits": "",
"Host": "",
"Ignored": "",
"INIT_FCALL_BY_NAME -> DO_FCALL": "",
"Inline functions": "",
"Inline VM handlers": "",
"interned strings usage": "",
"Invalidate all matching files": "",
"jit buffer free": "",
"jit buffer": "",
"keys": "",
"Last modified": "",
"last modified": "",
"Last reset": "",
"Last used": "",
"last used": "",
"max cached keys": "",
"Memory consumption": "",
"memory usage": "",
"memory": "",
"Merge equal constants": "",
"Minimal JIT (call standard VM handlers)": "",
"never": "",
"Next": "",
"No files have been cached or you have <i>opcache.file_cache_only<\/i> turned on": "",
"No files have been ignored via <i>opcache.blacklist_filename<\/i>": "",
"No files have been preloaded <i>opcache.preload<\/i>": "",
"No JIT": "",
"no value": "",
"NOP removal": "",
"number of cached files": "",
"number of cached keys": "",
"Number of hits": "",
"number of hits": "",
"number of misses": "",
"number of strings": "",
"opcache statistics": "",
"Optimization level": "",
"Optimize whole script": "",
"Overview": "",
"Path": "",
"Perform block-local register allocation": "",
"Perform global register allocation": "",
"preload memory": "",
"Preloaded": "",
"Previous": "",
"Profile functions on first request and compile the hottest functions afterwards": "",
"Profile on the fly and compile hot functions": "",
"Register allocation": "",
"Remove unused variables": "",
"Reset cache": "",
"SCCP (constant propagation)": "",
"Script": "",
"Server Software": "",
"Sort order": "",
"Start time": "",
"Start typing to filter on script path": "",
"TMP VAR usage": "",
"total memory": "",
"Trigger": "",
"true": "",
"Use call graph": "",
"Use tracing JIT. Profile on the fly and compile traces for hot code segments": "",
"Use type inference": "",
"used memory": "",
"View manual page": "",
"View {0} manual entry": "",
"wasted memory": "",
"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>.": "",
"{0} files cached": "",
"{0} files cached, {1} showing due to filter '{2}'": "",
"{0} ignore file locations": "",
"{0} preloaded files": ""
}
107 changes: 107 additions & 0 deletions build/_languages/fr.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
{
"(unsafe) Collect constants": "(instable) Collecter les constantes",
"++, +=, series of jumps": "++, +=, séries de sauts",
"Adjust used stack": "Ajuster la pile utilisée",
"Ascending": "Croissant",
"Available functions": "Fonctions disponibles",
"blacklist misses": "Ratés mis sur liste noire",
"buffer size": "taille du tampon",
"Cached": "En cache",
"CALL GRAPH optimization": "Optimisation CALL GRAPH",
"CFG based optimization": "Optimisation basée sur CFG",
"Compile all functions on script load": "Compiler toutes les fonctions au chargement du script",
"Compile functions on first execution": "Compiler les fonctions à la première exécution",
"Constant conversion and jumps": "Conversion des constantes et sauts",
"CPU-specific optimization": "Optimisation spécifique au CPU",
"CSE, STRING construction": "Construction CSE, STRING",
"Currently unused": "Actuellement inutilisé",
"DCE (dead code elimination)": "DCE (élimination du code mort)",
"Descending": "Décroissant",
"DFA based optimization": "Optimisation basée sur DFA",
"Directives": "Directives",
"Disable CPU-specific optimization": "Désactiver l'optimisation spécifique au processeur",
"Disable real-time update": "Désactiver la mise à jour en temps réel",
"Do not perform register allocation": "Ne pas effectuer d'allocation de registre",
"Enable real-time update": "Activer la mise à jour en temps réel",
"Enable use of AVX, if the CPU supports it": "Activer l'utilisation d'AVX, si le CPU le prend en charge",
"false": "faux",
"File list pagination": "Pagination de la liste des fichiers",
"force file invalidation": "forcer l'invalidation du fichier",
"free memory": "mémoire libre",
"General info": "Informations générales",
"has been invalidated": "a été invalidé",
"hit rate": "taux de succès",
"hits": "accès",
"Host": "Hôte",
"Ignored": "Ignoré",
"INIT_FCALL_BY_NAME -> DO_FCALL": "INIT_FCALL_BY_NAME -> DO_FCALL",
"Inline functions": "Fonctions inline",
"Inline VM handlers": "Gestionnaires de VM inline",
"interned strings usage": "utilisation des chaînes internées",
"Invalidate all matching files": "Invalider tous les fichiers correspondants",
"jit buffer free": "tampon jit libre",
"jit buffer": "tampon jit",
"keys": "clés",
"Last modified": "Dernière modification",
"last modified": "dernière modification",
"Last reset": "Dernière réinitialisation",
"Last used": "Dernière utilisation",
"last used": "dernière utilisation",
"max cached keys": "max de clés en cache",
"Memory consumption": "Consommation mémoire",
"memory usage": "utilisation de la mémoire",
"memory": "mémoire",
"Merge equal constants": "Fusionner les constantes égales",
"Minimal JIT (call standard VM handlers)": "JIT minimal (appel des gestionnaires de VM standard)",
"never": "jamais",
"Next": "Suivant",
"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é",
"No files have been ignored via <i>opcache.blacklist_filename<\/i>": "Aucun fichier n'a été ignoré via <i>opcache.blacklist_filename<\/i>",
"No files have been preloaded <i>opcache.preload<\/i>": "Aucun fichier n'a été préchargé <i>opcache.preload<\/i>",
"No JIT": "Pas de JIT",
"no value": "pas de valeur",
"NOP removal": "Suppression de NOP",
"number of cached files": "nombre de fichiers en cache",
"number of cached keys": "nombre de clés en cache",
"Number of hits": "Nombre d'accès",
"number of hits": "nombre d'accès",
"number of misses": "nombre de ratés",
"number of strings": "nombre de chaînes",
"opcache statistics": "statistiques d'opcache",
"Optimization level": "Niveau d'optimisation",
"Optimize whole script": "Optimiser tout le script",
"Overview": "Vue d'ensemble",
"Path": "Chemin",
"Perform block-local register allocation": "Effectuer l'allocation de registre local de bloc",
"Perform global register allocation": "Effectuer une allocation de registre globale",
"preload memory": "précharger la mémoire",
"Preloaded": "Préchargé",
"Previous": "Précédent",
"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",
"Profile on the fly and compile hot functions": "Profiling à la volée et compiler les fonctions les plus fréquentes",
"Register allocation": "Allocation de registre",
"Remove unused variables": "Supprimer les variables inutilisées",
"Reset cache": "Réinitialiser le cache",
"SCCP (constant propagation)": "SCCP (propagation des constantes)",
"Script": "Script",
"Server Software": "Logiciel serveur",
"Sort order": "Ordre de tri",
"Start time": "Heure de début",
"Start typing to filter on script path": "Commencez à taper pour filtrer sur le chemin du script",
"TMP VAR usage": "Utilisation TMP VAR",
"total memory": "mémoire totale",
"Trigger": "Déclencheur",
"true": "vrai",
"Use call graph": "Utiliser le graphe des appels",
"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",
"Use type inference": "Utiliser l'inférence de type",
"used memory": "mémoire utilisée",
"View manual page": "Voir la page du manuel",
"View {0} manual entry": "Voir la page {0} du manuel",
"wasted memory": "mémoire perdue",
"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>.",
"{0} files cached": "{0} fichiers mis en cache",
"{0} files cached, {1} showing due to filter '{2}'": "{0} fichiers mis en cache, {1} s'affichent en raison du filtre '{2}'",
"{0} ignore file locations": "{0} ignore les fichiers en fonction de l'emplacement",
"{0} preloaded files": "{0} fichiers préchargés"
}
37 changes: 33 additions & 4 deletions build/build.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,27 @@
* OPcache GUI - build script
*
* @author Andrew Collington, [email protected]
* @version 3.3.1
* @version 3.4.0
* @link https://github.com/amnuts/opcache-gui
* @license MIT, https://acollington.mit-license.org/
*/

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

if ($useLanguage !== null) {
$useLanguage = preg_replace('/[^a-z_-]/', '', $useLanguage);
$languageFile = __DIR__ . "/_languages/{$useLanguage}.json";
if (!file_exists($languageFile)) {
echo "The '{$useLanguage}' file does not exist - using default English\n\n";
} else {
$languagePack = "<<< EOJSON\n" . file_get_contents($languageFile) . "\nEOJSON";
}
}

if (!file_exists($parentPath . '/node_modules')) {
echo "🐢 Installing node modules\n";
exec('npm install');
Expand All @@ -25,12 +39,27 @@
$template = trim(file_get_contents(__DIR__ . '/template.phps'));
$jsOutput = trim(file_get_contents(__DIR__ . '/interface.js'));
$cssOutput = trim(file_get_contents(__DIR__ . '/interface.css'));
$phpOutput = trim(join('', array_slice(file($parentPath . '/src/Opcache/Service.php'), 3)));
$phpOutput = trim(implode('', array_slice(file($parentPath . '/src/Opcache/Service.php'), 3)));

$output = str_replace(
['{{JS_OUTPUT}}', '{{CSS_OUTPUT}}', '{{PHP_OUTPUT}}'],
[$jsOutput, $cssOutput, $phpOutput],
['{{JS_OUTPUT}}', '{{CSS_OUTPUT}}', '{{PHP_OUTPUT}}', '{{LANGUAGE_PACK}}'],
[$jsOutput, $cssOutput, $phpOutput, $languagePack],
$template
);
if ($makeJsLocal) {
echo "🔗 Making js links local\n";
$jsTags = [];
$matched = preg_match_all('!<script src="([^"]*)"></script>!', $output, $jsTags);
if ($matched) {
foreach ($jsTags[1] as $jsUrl) {
$jsFile = basename($jsUrl);
$jsFilePath = $parentPath . '/' . $jsFile;
file_put_contents($jsFilePath, file_get_contents('https:' . $jsUrl));
$output = str_replace($jsUrl, $jsFile, $output);
}
}
}

file_put_contents($parentPath . '/index.php', $output);

echo "💯 Done!\n";
52 changes: 28 additions & 24 deletions build/template.phps
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ namespace Amnuts\Opcache;
* A simple but effective single-file GUI for the OPcache PHP extension.
*
* @author Andrew Collington, [email protected]
* @version 3.3.1
* @version 3.4.0
* @link https://github.com/amnuts/opcache-gui
* @license MIT, https://acollington.mit-license.org/
*/
Expand All @@ -20,24 +20,27 @@ namespace Amnuts\Opcache;
*/

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

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

?>
<!DOCTYPE html>
<html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<title>OPcache statistics on <?= $opcache->getData('version', 'host'); ?></title>
<script src="//unpkg.com/react/umd/react.production.min.js" crossorigin></script>
<script src="//unpkg.com/react-dom/umd/react-dom.production.min.js" crossorigin></script>
<script src="//unpkg.com/axios/dist/axios.min.js" crossorigin></script>
<style type="text/css">
<script src="//unpkg.com/react/umd/react.production.min.js"></script>
<script src="//unpkg.com/react-dom/umd/react-dom.production.min.js"></script>
<script src="//unpkg.com/axios/dist/axios.min.js"></script>
<style>
{{CSS_OUTPUT}}
</style>
</head>
Expand Down Expand Up @@ -99,7 +102,8 @@ $opcache = (new Service($options))->handle();
highlight: <?= json_encode($opcache->getOption('highlight')); ?>,
debounceRate: <?= $opcache->getOption('debounce_rate'); ?>,
perPageLimit: <?= json_encode($opcache->getOption('per_page')); ?>,
realtimeRefresh: <?= json_encode($opcache->getOption('refresh_time')); ?>
realtimeRefresh: <?= json_encode($opcache->getOption('refresh_time')); ?>,
language: <?= json_encode($opcache->getOption('language_pack')); ?>,
}), document.getElementById('interface'));

</script>
Expand Down
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"keywords": ["opcache", "cache", "gui", "opcodes", "interface"],
"minimum-stability": "stable",
"license": "MIT",
"version": "3.4.0",
"authors": [
{
"name": "Andrew Collington",
Expand Down
Loading

0 comments on commit a4af194

Please sign in to comment.