From be7747463773626cc14b5ed19bc6ca31c0c2fab4 Mon Sep 17 00:00:00 2001 From: Sarjuuk Date: Thu, 17 Dec 2020 22:07:44 +0100 Subject: [PATCH] Misc/Optimizations * general minor cleanups * do not sync characters that haven't logged in since last resync. --- includes/basetype.class.php | 7 +++---- includes/profiler.class.php | 15 ++++++++++++--- localization/locale_dede.php | 1 - pages/object.php | 2 +- 4 files changed, 16 insertions(+), 9 deletions(-) diff --git a/includes/basetype.class.php b/includes/basetype.class.php index ea50b64f..8e1dac72 100644 --- a/includes/basetype.class.php +++ b/includes/basetype.class.php @@ -10,7 +10,7 @@ abstract class BaseType public $error = true; protected $templates = []; - protected $curTpl = []; // lets iterate! + protected $curTpl = []; protected $matches = 0; // total matches unaffected by sqlLimit in config protected $dbNames = ['Aowow']; // multiple DBs in profiler @@ -59,7 +59,6 @@ abstract class BaseType $where = []; $linking = ' AND '; $limit = CFG_SQL_LIMIT_DEFAULT; - $className = get_class($this); if (!$this->queryBase || $conditions === null) return; @@ -270,7 +269,7 @@ abstract class BaseType foreach ($rows as $id => $row) { if (isset($this->templates[$id])) - trigger_error('guid for List already in use #'.$id, E_USER_WARNING); + trigger_error('GUID for List already in use #'.$id.'. Additional occurrence omitted!', E_USER_ERROR); else $this->templates[$id] = $row; } @@ -573,7 +572,7 @@ trait spawnHelper } } - private function createFullSpawns() // for display on map (objsct/npc detail page) + private function createFullSpawns() // for display on map (object/npc detail page) { $data = []; $wpSum = []; diff --git a/includes/profiler.class.php b/includes/profiler.class.php index 8dae2e53..1b582ea9 100644 --- a/includes/profiler.class.php +++ b/includes/profiler.class.php @@ -285,11 +285,20 @@ class Profiler return false; // reminder: this query should not fail: a placeholder entry is created as soon as a char listview is created or profile detail page is called - $profileId = DB::Aowow()->selectCell('SELECT id FROM ?_profiler_profiles WHERE realm = ?d AND realmGUID = ?d', $realmId, $char['guid']); - if (!$profileId) + $profile = DB::Aowow()->selectRow('SELECT id, lastupdated FROM ?_profiler_profiles WHERE realm = ?d AND realmGUID = ?d', $realmId, $char['guid']); + if (!$profile) return false; // well ... it failed - CLI::write('fetching char #'.$charGuid.' from realm #'.$realmId); + $profileId = $profile['id']; + + CLI::write('fetching char '.$char['name'].' (#'.$charGuid.') from realm #'.$realmId); + + if (!$char['online'] && $char['logout_time'] <= $profile['lastupdated']) + { + CLI::write('char did not log in since last update. skipping...'); + return true; + } + CLI::write('writing...'); $ra = (1 << ($char['race'] - 1)); diff --git a/localization/locale_dede.php b/localization/locale_dede.php index a5562e7f..719fd767 100644 --- a/localization/locale_dede.php +++ b/localization/locale_dede.php @@ -648,7 +648,6 @@ $lang = array( SAI_ACTION_LOAD_EQUIPMENT => ['(%2$d)?Lege nicht-standart Ausrüstung ab:Rüste %7$s; von Ausrüstungs-Template #[b]%1$d[/b] an #target#(%8$d)?: aus;.', 'Hinweis: Gegenstände für Kreaturen haben nicht zwingend ein Gegenstands-Template'], SAI_ACTION_TRIGGER_RANDOM_TIMED_EVENT => ['Löse definiertes verzögertes Ereignis innerhalb von %7$s aus.', null], SAI_ACTION_REMOVE_ALL_GAMEOBJECTS => ['Entferne alle Gameobjects von #target#.', null], - SAI_ACTION_STOP_MOTION => ['(%1$d)?Entferne motion type #[b]%1$d[/b] von #target#. :;(%2$d)?Beende Bewegung.:;', null], SAI_ACTION_PAUSE_MOVEMENT => ['Pausiere Bewegung aus Slot #[b]%1$d[/b] für %7$s.', 'Erzwungen'], null, // SAI_ACTION_PLAY_ANIMKIT = 128, // don't use on 3.3.5a null, // SAI_ACTION_SCENE_PLAY = 129, // don't use on 3.3.5a diff --git a/pages/object.php b/pages/object.php index 76ff3dc0..393edf48 100644 --- a/pages/object.php +++ b/pages/object.php @@ -111,7 +111,7 @@ class ObjectPage extends GenericPage // if no propper item is found use a skill if ($locks) - $infobox[] = $l ? $l : array_pop($locks); + $infobox[] = $l ?: array_pop($locks); } }