From 327cbde3aa0ac54c406e7a4b32bd68e6c69af190 Mon Sep 17 00:00:00 2001 From: Adrian Jones Date: Fri, 19 Apr 2024 08:44:55 -0700 Subject: [PATCH] Add check for availability of getRaw to prevent errors in older versions of PW. --- TracyDebugger.module.php | 2 +- .../plugins/AdminerProcessWireLogin.php | 24 +++++++++++++------ 2 files changed, 18 insertions(+), 8 deletions(-) diff --git a/TracyDebugger.module.php b/TracyDebugger.module.php index 16f3469..12a82a2 100644 --- a/TracyDebugger.module.php +++ b/TracyDebugger.module.php @@ -27,7 +27,7 @@ public static function getModuleInfo() { 'summary' => __('Tracy debugger from Nette with many PW specific custom tools.', __FILE__), 'author' => 'Adrian Jones', 'href' => 'https://processwire.com/talk/forum/58-tracy-debugger/', - 'version' => '4.26.20', + 'version' => '4.26.21', 'autoload' => 100000, // in PW 3.0.114+ higher numbers are loaded first - we want Tracy first 'singular' => true, 'requires' => 'ProcessWire>=2.7.2, PHP>=5.4.4', diff --git a/panels/Adminer/plugins/AdminerProcessWireLogin.php b/panels/Adminer/plugins/AdminerProcessWireLogin.php index 6236985..1eeba17 100644 --- a/panels/Adminer/plugins/AdminerProcessWireLogin.php +++ b/panels/Adminer/plugins/AdminerProcessWireLogin.php @@ -139,17 +139,27 @@ public function selectVal(&$val, $link, $field, $original) { if(wire('modules')->isInstalled('PagePaths')) { $label[] = 'url'; } - $name = wire('pages')->getRaw('id='.$val, $label); - if($name) { - $name = (isset($name['title']) ? $name['title'] : $name['name']) . (isset($name['url']) ? ' ('.$name['url'].')' : ''); - $val = ''.$val.''; + if(method_exists(wire('pages'), 'getRaw')) { + $name = wire('pages')->getRaw('id='.$val, $label); + if($name) { + $name = (isset($name['title']) ? $name['title'] : $name['name']) . (isset($name['url']) ? ' ('.$name['url'].')' : ''); + $val = ''.$val.''; + } + } + else { + $val = ''.$val.''; } } } elseif(in_array($field['field'], array('uid', 'user_id', 'created_users_id', 'modified_users_id', 'user_created', 'user_updated'))) { - $name = wire('pages')->getRaw('id='.$val, 'name'); - if($name) { - $val = ''.$val.''; + if(method_exists(wire('pages'), 'getRaw')) { + $name = wire('pages')->getRaw('id='.$val, 'name'); + if($name) { + $val = ''.$val.''; + } + } + else { + $val = ''.$val.''; } } }