cleaner extension loading
This commit is contained in:
parent
dba8acea02
commit
b1c6894fbc
3 changed files with 15 additions and 24 deletions
|
@ -565,11 +565,20 @@ function _load_core_files()
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function _load_extension_files()
|
||||||
|
{
|
||||||
|
ExtensionInfo::load_all_extension_info();
|
||||||
|
Extension::determine_enabled_extensions();
|
||||||
|
require_all(zglob("ext/{".Extension::get_enabled_extensions_as_string()."}/main.php"));
|
||||||
|
}
|
||||||
|
|
||||||
function _load_theme_files()
|
function _load_theme_files()
|
||||||
{
|
{
|
||||||
$theme = get_theme();
|
$theme = get_theme();
|
||||||
$files = _get_themelet_files($theme);
|
require_once('themes/'.$theme.'/page.class.php');
|
||||||
require_all($files);
|
require_once('themes/'.$theme.'/themelet.class.php');
|
||||||
|
require_all(zglob("ext/{".Extension::get_enabled_extensions_as_string()."}/theme.php"));
|
||||||
|
require_all(zglob('themes/'.$theme.'/{'.Extension::get_enabled_extensions_as_string().'}.theme.php'));
|
||||||
}
|
}
|
||||||
|
|
||||||
function _set_up_shimmie_environment(): void
|
function _set_up_shimmie_environment(): void
|
||||||
|
@ -595,19 +604,6 @@ function _set_up_shimmie_environment(): void
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function _get_themelet_files(string $_theme): array
|
|
||||||
{
|
|
||||||
$base_themelets = [];
|
|
||||||
$base_themelets[] = 'themes/'.$_theme.'/page.class.php';
|
|
||||||
$base_themelets[] = 'themes/'.$_theme.'/themelet.class.php';
|
|
||||||
|
|
||||||
$ext_themelets = zglob("ext/{".Extension::get_enabled_extensions_as_string()."}/theme.php");
|
|
||||||
$custom_themelets = zglob('themes/'.$_theme.'/{'.Extension::get_enabled_extensions_as_string().'}.theme.php');
|
|
||||||
|
|
||||||
return array_merge($base_themelets, $ext_themelets, $custom_themelets);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Used to display fatal errors to the web user.
|
* Used to display fatal errors to the web user.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -50,9 +50,7 @@ _load_core_files();
|
||||||
$cache = loadCache(CACHE_DSN);
|
$cache = loadCache(CACHE_DSN);
|
||||||
$database = new Database(DATABASE_DSN);
|
$database = new Database(DATABASE_DSN);
|
||||||
$config = new DatabaseConfig($database);
|
$config = new DatabaseConfig($database);
|
||||||
ExtensionInfo::load_all_extension_info();
|
_load_extension_files();
|
||||||
Extension::determine_enabled_extensions();
|
|
||||||
require_all(zglob("ext/{".Extension::get_enabled_extensions_as_string()."}/main.php"));
|
|
||||||
_load_theme_files();
|
_load_theme_files();
|
||||||
$page = new Page();
|
$page = new Page();
|
||||||
_load_event_listeners();
|
_load_event_listeners();
|
||||||
|
|
|
@ -26,18 +26,15 @@ $_tracer = new \EventTracer();
|
||||||
$_tracer->begin("bootstrap");
|
$_tracer->begin("bootstrap");
|
||||||
_load_core_files();
|
_load_core_files();
|
||||||
$cache = loadCache(CACHE_DSN);
|
$cache = loadCache(CACHE_DSN);
|
||||||
$dsn = getenv("TEST_DSN");
|
$database = new Database(getenv("TEST_DSN") ?: "sqlite::memory:");
|
||||||
$database = new Database($dsn ? $dsn : "sqlite::memory:");
|
|
||||||
create_dirs();
|
create_dirs();
|
||||||
create_tables($database);
|
create_tables($database);
|
||||||
$config = new DatabaseConfig($database);
|
$config = new DatabaseConfig($database);
|
||||||
ExtensionInfo::load_all_extension_info();
|
_load_extension_files();
|
||||||
Extension::determine_enabled_extensions();
|
|
||||||
require_all(zglob("ext/{".Extension::get_enabled_extensions_as_string()."}/main.php"));
|
|
||||||
_load_theme_files();
|
_load_theme_files();
|
||||||
$page = new Page();
|
$page = new Page();
|
||||||
_load_event_listeners();
|
_load_event_listeners();
|
||||||
$config->set_string("thumb_engine", "static"); # GD has less overhead per-call
|
$config->set_string("thumb_engine", "static");
|
||||||
$config->set_bool("nice_urls", true);
|
$config->set_bool("nice_urls", true);
|
||||||
send_event(new DatabaseUpgradeEvent());
|
send_event(new DatabaseUpgradeEvent());
|
||||||
send_event(new InitExtEvent());
|
send_event(new InitExtEvent());
|
||||||
|
|
Reference in a new issue