Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions lib/PhpStatistics.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ public function getPhpStatistics(): array {
'upload_max_filesize' => $this->phpIni->getBytes('upload_max_filesize'),
'opcache' => $this->getOPcacheStatus(),
'apcu' => $this->getAPCuStatus(),
'extensions' => $this->getLoadedPhpExtensions(),
];
}

Expand Down Expand Up @@ -112,4 +113,14 @@ protected function getAPCuStatus(): array {
'sma' => $smaInfo,
];
}

/**
* Get all loaded php extensions
*
* @return string as csv list of loaded extensions
*/
protected function getLoadedPhpExtensions(): string {
$extensions = (function_exists('get_loaded_extensions') ? get_loaded_extensions() : ['Unable to list extensions']);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

getLoadedPhpExtensions should probably return the list of extensions directly and fallback to null if the function doesn't exist, and we would do the implode part inside the template.

This would allow this function to be reusable elsewhere and the 'Unable to list extensions' message being translatable without injecting I10N into this class.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds cleaner to me, too. Shall i implement this task as separate PR? Or anyone else interested?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, please open a new PR. :)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done at #367

return implode(', ', $extensions);
}
}
4 changes: 4 additions & 0 deletions templates/settings-admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,10 @@ class="barchart"
<?php p($l->t('Upload max size:')); ?>
<em id="phpUploadMaxSize"><?php p($_['php']['upload_max_filesize']); ?></em>
</p>
<p>
<?php p($l->t('Extensions:')); ?>
<em id="phpExtensions"><?php p($_['php']['extensions']); ?></em>
</p>
</div>
</div>
</div>
Expand Down