2007-04-16 11:58:25 +00:00
|
|
|
<?php
|
2009-08-20 22:37:17 +00:00
|
|
|
/*
|
2008-04-11 06:12:07 +00:00
|
|
|
* Name: System Info
|
|
|
|
* Author: Shish <webmaster@shishnet.org>
|
|
|
|
* License: GPLv2
|
2009-01-16 08:18:41 +00:00
|
|
|
* Description: Show various bits of system information
|
|
|
|
* Documentation:
|
|
|
|
* Knowing the information that this extension shows can be
|
|
|
|
* very useful for debugging. There's also an option to send
|
|
|
|
* your stats to my database, so I can get some idea of how
|
|
|
|
* shimmie is used, which servers I need to support, which
|
|
|
|
* versions of PHP I should test with, etc.
|
2008-04-11 06:12:07 +00:00
|
|
|
*/
|
2007-04-16 11:58:25 +00:00
|
|
|
|
2019-05-28 16:59:38 +00:00
|
|
|
class ET extends Extension
|
|
|
|
{
|
|
|
|
public function onPageRequest(PageRequestEvent $event)
|
|
|
|
{
|
|
|
|
global $user;
|
|
|
|
if ($event->page_matches("system_info")) {
|
|
|
|
if ($user->can("view_sysinfo")) {
|
|
|
|
$this->theme->display_info_page($this->get_info());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2007-04-16 11:58:25 +00:00
|
|
|
|
2019-05-28 16:59:38 +00:00
|
|
|
public function onUserBlockBuilding(UserBlockBuildingEvent $event)
|
|
|
|
{
|
|
|
|
global $user;
|
|
|
|
if ($user->can("view_sysinfo")) {
|
|
|
|
$event->add_link("System Info", make_link("system_info"));
|
|
|
|
}
|
|
|
|
}
|
2007-08-24 22:29:34 +00:00
|
|
|
|
2019-05-28 16:59:38 +00:00
|
|
|
/**
|
|
|
|
* Collect the information and return it in a keyed array.
|
|
|
|
*/
|
|
|
|
private function get_info()
|
|
|
|
{
|
|
|
|
global $config, $database;
|
2007-04-16 11:58:25 +00:00
|
|
|
|
2019-05-28 16:59:38 +00:00
|
|
|
$info = [];
|
|
|
|
$info['site_title'] = $config->get_string("title");
|
|
|
|
$info['site_theme'] = $config->get_string("theme");
|
|
|
|
$info['site_url'] = "http://" . $_SERVER["HTTP_HOST"] . get_base_href();
|
2007-04-16 11:58:25 +00:00
|
|
|
|
2019-05-28 16:59:38 +00:00
|
|
|
$info['sys_shimmie'] = VERSION;
|
|
|
|
$info['sys_schema'] = $config->get_string("db_version");
|
|
|
|
$info['sys_php'] = phpversion();
|
|
|
|
$info['sys_db'] = $database->get_driver_name();
|
|
|
|
$info['sys_os'] = php_uname();
|
|
|
|
$info['sys_disk'] = to_shorthand_int(disk_total_space("./") - disk_free_space("./")) . " / " .
|
|
|
|
to_shorthand_int(disk_total_space("./"));
|
|
|
|
$info['sys_server'] = isset($_SERVER["SERVER_SOFTWARE"]) ? $_SERVER["SERVER_SOFTWARE"] : 'unknown';
|
2019-06-18 18:45:59 +00:00
|
|
|
|
2019-06-24 15:05:16 +00:00
|
|
|
$info[MediaConfig::FFMPEG_PATH] = $config->get_string(MediaConfig::FFMPEG_PATH);
|
|
|
|
$info[MediaConfig::CONVERT_PATH] = $config->get_string(MediaConfig::CONVERT_PATH);
|
|
|
|
$info[MediaConfig::MEM_LIMIT] = $config->get_int(MediaConfig::MEM_LIMIT);
|
2019-06-18 18:45:59 +00:00
|
|
|
|
|
|
|
$info[ImageConfig::THUMB_ENGINE] = $config->get_string(ImageConfig::THUMB_ENGINE);
|
|
|
|
$info[ImageConfig::THUMB_QUALITY] = $config->get_int(ImageConfig::THUMB_QUALITY);
|
|
|
|
$info[ImageConfig::THUMB_WIDTH] = $config->get_int(ImageConfig::THUMB_WIDTH);
|
|
|
|
$info[ImageConfig::THUMB_HEIGHT] = $config->get_int(ImageConfig::THUMB_HEIGHT);
|
|
|
|
$info[ImageConfig::THUMB_SCALING] = $config->get_int(ImageConfig::THUMB_SCALING);
|
|
|
|
$info[ImageConfig::THUMB_TYPE] = $config->get_string(ImageConfig::THUMB_TYPE);
|
2007-04-16 11:58:25 +00:00
|
|
|
|
2019-05-28 16:59:38 +00:00
|
|
|
$info['stat_images'] = $database->get_one("SELECT COUNT(*) FROM images");
|
|
|
|
$info['stat_comments'] = $database->get_one("SELECT COUNT(*) FROM comments");
|
|
|
|
$info['stat_users'] = $database->get_one("SELECT COUNT(*) FROM users");
|
|
|
|
$info['stat_tags'] = $database->get_one("SELECT COUNT(*) FROM tags");
|
|
|
|
$info['stat_image_tags'] = $database->get_one("SELECT COUNT(*) FROM image_tags");
|
2007-04-16 11:58:25 +00:00
|
|
|
|
2019-05-28 16:59:38 +00:00
|
|
|
$els = [];
|
|
|
|
foreach (get_declared_classes() as $class) {
|
|
|
|
$rclass = new ReflectionClass($class);
|
|
|
|
if ($rclass->isAbstract()) {
|
|
|
|
// don't do anything
|
|
|
|
} elseif (is_subclass_of($class, "Extension")) {
|
|
|
|
$els[] = $class;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
$info['sys_extensions'] = join(', ', $els);
|
2009-01-04 19:18:37 +00:00
|
|
|
|
2019-05-28 16:59:38 +00:00
|
|
|
//$cfs = array();
|
|
|
|
//foreach($database->get_all("SELECT name, value FROM config") as $pair) {
|
|
|
|
// $cfs[] = $pair['name']."=".$pair['value'];
|
|
|
|
//}
|
|
|
|
//$info[''] = "Config: ".join(", ", $cfs);
|
2007-04-16 11:58:25 +00:00
|
|
|
|
2019-05-28 16:59:38 +00:00
|
|
|
return $info;
|
|
|
|
}
|
2007-04-16 11:58:25 +00:00
|
|
|
}
|