From cb89e4477b4188e65ef7a5255b19443fa56066a6 Mon Sep 17 00:00:00 2001 From: "o.pinke" Date: Tue, 12 Mar 2024 16:13:38 +0100 Subject: [PATCH] optimize code --- conlite/cronjobs/move_articles.php | 31 ++++++++++--------- conlite/cronjobs/move_old_stats.php | 34 +++++++++++---------- conlite/cronjobs/optimize_database.php | 42 ++++++++++++++------------ 3 files changed, 58 insertions(+), 49 deletions(-) diff --git a/conlite/cronjobs/move_articles.php b/conlite/cronjobs/move_articles.php index 641cba6..b3a2960 100644 --- a/conlite/cronjobs/move_articles.php +++ b/conlite/cronjobs/move_articles.php @@ -25,20 +25,23 @@ if (!defined("CON_FRAMEWORK")) { // Contenido startup process include_once ('../includes/startup.php'); -include_once ($cfg['path']['contenido'].$cfg["path"]["classes"] . 'class.user.php'); -include_once ($cfg['path']['contenido'].$cfg["path"]["classes"] . 'class.xml.php'); -include_once ($cfg['path']['contenido'].$cfg["path"]["classes"] . 'class.navigation.php'); -include_once ($cfg['path']['contenido'].$cfg["path"]["classes"] . 'template/class.template.php'); -include_once ($cfg['path']['contenido'].$cfg["path"]["classes"] . 'class.backend.php'); -include_once ($cfg['path']['contenido'].$cfg["path"]["classes"] . 'class.table.php'); -include_once ($cfg['path']['contenido'].$cfg["path"]["classes"] . 'class.notification.php'); -include_once ($cfg['path']['contenido'].$cfg["path"]["classes"] . 'class.area.php'); -include_once ($cfg['path']['contenido'].$cfg["path"]["classes"] . 'class.layout.php'); -include_once ($cfg['path']['contenido'].$cfg["path"]["classes"] . 'class.client.php'); -include_once ($cfg['path']['contenido'].$cfg["path"]["classes"] . 'class.cat.php'); -include_once ($cfg['path']['contenido'].$cfg["path"]["classes"] . 'class.treeitem.php'); -include_once ($cfg['path']['contenido'].$cfg["path"]["includes"] . 'cfg_language_de.inc.php'); -include_once ($cfg['path']['contenido'].$cfg["path"]["includes"] . 'functions.con.php'); +$classPath = cRegistry::getConfigValue('path', 'conlite') . cRegistry::getConfigValue('path', 'classes'); +$includesPath = cRegistry::getConfigValue('path', 'conlite') . cRegistry::getConfigValue('path', 'includes'); + +include_once ($classPath . 'class.user.php'); +include_once ($classPath . 'class.xml.php'); +include_once ($classPath . 'class.navigation.php'); +include_once ($classPath . 'template/class.template.php'); +include_once ($classPath . 'class.backend.php'); +include_once ($classPath . 'class.table.php'); +include_once ($classPath . 'class.notification.php'); +include_once ($classPath . 'class.area.php'); +include_once ($classPath . 'class.layout.php'); +include_once ($classPath . 'class.client.php'); +include_once ($classPath . 'class.cat.php'); +include_once ($classPath . 'class.treeitem.php'); +include_once ($includesPath . 'cfg_language_de.inc.php'); +include_once ($includesPath . 'functions.con.php'); if(!isRunningFromWeb() || function_exists("runJob") || $area == "cronjobs") { $db = new DB_ConLite; diff --git a/conlite/cronjobs/move_old_stats.php b/conlite/cronjobs/move_old_stats.php index d3583a6..e9558c1 100644 --- a/conlite/cronjobs/move_old_stats.php +++ b/conlite/cronjobs/move_old_stats.php @@ -25,20 +25,23 @@ if (!defined("CON_FRAMEWORK")) { // Contenido startup process include_once ('../includes/startup.php'); -include_once ($cfg['path']['contenido'].$cfg["path"]["classes"] . 'class.user.php'); -include_once ($cfg['path']['contenido'].$cfg["path"]["classes"] . 'class.xml.php'); -include_once ($cfg['path']['contenido'].$cfg["path"]["classes"] . 'class.navigation.php'); -include_once ($cfg['path']['contenido'].$cfg["path"]["classes"] . 'template/class.template.php'); -include_once ($cfg['path']['contenido'].$cfg["path"]["classes"] . 'class.backend.php'); -include_once ($cfg['path']['contenido'].$cfg["path"]["classes"] . 'class.table.php'); -include_once ($cfg['path']['contenido'].$cfg["path"]["classes"] . 'class.notification.php'); -include_once ($cfg['path']['contenido'].$cfg["path"]["classes"] . 'class.area.php'); -include_once ($cfg['path']['contenido'].$cfg["path"]["classes"] . 'class.layout.php'); -include_once ($cfg['path']['contenido'].$cfg["path"]["classes"] . 'class.client.php'); -include_once ($cfg['path']['contenido'].$cfg["path"]["classes"] . 'class.cat.php'); -include_once ($cfg['path']['contenido'].$cfg["path"]["classes"] . 'class.treeitem.php'); -include_once ($cfg['path']['contenido'].$cfg["path"]["includes"] . 'cfg_language_de.inc.php'); -include_once ($cfg['path']['contenido'].$cfg["path"]["includes"] . 'functions.stat.php'); +$classPath = cRegistry::getConfigValue('path', 'conlite') . cRegistry::getConfigValue('path', 'classes'); +$includesPath = cRegistry::getConfigValue('path', 'conlite') . cRegistry::getConfigValue('path', 'includes'); + +include_once ($classPath . 'class.user.php'); +include_once ($classPath . 'class.xml.php'); +include_once ($classPath . 'class.navigation.php'); +include_once ($classPath . 'template/class.template.php'); +include_once ($classPath . 'class.backend.php'); +include_once ($classPath . 'class.table.php'); +include_once ($classPath . 'class.notification.php'); +include_once ($classPath . 'class.area.php'); +include_once ($classPath . 'class.layout.php'); +include_once ($classPath . 'class.client.php'); +include_once ($classPath . 'class.cat.php'); +include_once ($classPath . 'class.treeitem.php'); +include_once ($includesPath . 'cfg_language_de.inc.php'); +include_once ($includesPath . 'functions.stat.php'); if (!isRunningFromWeb() || function_exists("runJob") || $area == "cronjobs") { @@ -57,5 +60,4 @@ if (!isRunningFromWeb() || function_exists("runJob") || $area == "cronjobs") statsArchive(sprintf("%04d%02d",$year,$month)); -} -?> +} \ No newline at end of file diff --git a/conlite/cronjobs/optimize_database.php b/conlite/cronjobs/optimize_database.php index 23bc31c..2955494 100644 --- a/conlite/cronjobs/optimize_database.php +++ b/conlite/cronjobs/optimize_database.php @@ -25,37 +25,41 @@ if (!defined("CON_FRAMEWORK")) { // Contenido startup process include_once ('../includes/startup.php'); -include_once ($cfg['path']['contenido'].$cfg["path"]["classes"] . 'class.user.php'); -include_once ($cfg['path']['contenido'].$cfg["path"]["classes"] . 'class.xml.php'); -include_once ($cfg['path']['contenido'].$cfg["path"]["classes"] . 'class.navigation.php'); -include_once ($cfg['path']['contenido'].$cfg["path"]["classes"] . 'template/class.template.php'); -include_once ($cfg['path']['contenido'].$cfg["path"]["classes"] . 'class.backend.php'); -include_once ($cfg['path']['contenido'].$cfg["path"]["classes"] . 'class.table.php'); -include_once ($cfg['path']['contenido'].$cfg["path"]["classes"] . 'class.notification.php'); -include_once ($cfg['path']['contenido'].$cfg["path"]["classes"] . 'class.area.php'); -include_once ($cfg['path']['contenido'].$cfg["path"]["classes"] . 'class.layout.php'); -include_once ($cfg['path']['contenido'].$cfg["path"]["classes"] . 'class.client.php'); -include_once ($cfg['path']['contenido'].$cfg["path"]["classes"] . 'class.cat.php'); -include_once ($cfg['path']['contenido'].$cfg["path"]["classes"] . 'class.treeitem.php'); -include_once ($cfg['path']['contenido'].$cfg["path"]["includes"] . 'cfg_language_de.inc.php'); -include_once ($cfg['path']['contenido'].$cfg["path"]["includes"] . 'functions.stat.php'); +$classPath = cRegistry::getConfigValue('path', 'conlite') . cRegistry::getConfigValue('path', 'classes'); +$includesPath = cRegistry::getConfigValue('path', 'conlite') . cRegistry::getConfigValue('path', 'includes'); + +include_once ($classPath . 'class.user.php'); +include_once ($classPath . 'class.xml.php'); +include_once ($classPath . 'class.navigation.php'); +include_once ($classPath . 'template/class.template.php'); +include_once ($classPath . 'class.backend.php'); +include_once ($classPath . 'class.table.php'); +include_once ($classPath . 'class.notification.php'); +include_once ($classPath . 'class.area.php'); +include_once ($classPath . 'class.layout.php'); +include_once ($classPath . 'class.client.php'); +include_once ($classPath . 'class.cat.php'); +include_once ($classPath . 'class.treeitem.php'); +include_once ($includesPath . 'cfg_language_de.inc.php'); +include_once ($includesPath . 'functions.stat.php'); global $cfg; if(!isRunningFromWeb() || function_exists("runJob") || $area == "cronjobs") { $db = new DB_ConLite; - foreach ($cfg["tab"] as $key => $value) + $tables = cRegistry::getConfigValue('tab'); + + foreach ($tables as $key => $value) { $sql = "OPTIMIZE TABLE ".$value; $db->query($sql); } - if ($cfg["statistics_heap_table"]) { - $sHeapTable = $cfg['tab']['stat_heap_table']; + if (cRegistry::getConfigValue('statistics_heap_table')) { + $sHeapTable = cRegistry::getConfigValue('tab', 'stat_heap_table'); buildHeapTable ($sHeapTable, $db); } -} -?> +} \ No newline at end of file