tmp: render diagnostic
This commit is contained in:
@@ -2,8 +2,7 @@
|
||||
error_reporting(E_ALL);
|
||||
ini_set('display_errors', 1);
|
||||
|
||||
// Simulate exactly what admin does
|
||||
chdir(__DIR__ . '/admin'); // admin CWD
|
||||
chdir(__DIR__ . '/admin');
|
||||
|
||||
require_once '../config.php';
|
||||
require_once '../libraries/medoo/medoo.php';
|
||||
@@ -18,30 +17,29 @@ $mdb = new medoo([
|
||||
'charset' => 'utf8'
|
||||
]);
|
||||
|
||||
// Setup autoloader like admin/index.php
|
||||
function __autoload_diag($classname) {
|
||||
spl_autoload_register(function($classname) {
|
||||
$q = explode('\\', $classname);
|
||||
$c = array_pop($q);
|
||||
$f = '../autoload/' . implode('/', $q) . '/class.' . $c . '.php';
|
||||
if (file_exists($f)) { require_once($f); return; }
|
||||
$f = '../autoload/' . implode('/', $q) . '/' . $c . '.php';
|
||||
if (file_exists($f)) require_once($f);
|
||||
}
|
||||
spl_autoload_register('__autoload_diag');
|
||||
});
|
||||
|
||||
echo "<pre>\n";
|
||||
|
||||
// Test factory directly
|
||||
// Render just the licenses table portion
|
||||
$licenses = \admin\factory\Releases::get_licenses();
|
||||
echo "get_licenses() count: " . count($licenses) . "\n";
|
||||
echo "Is array: " . (is_array($licenses) ? 'yes' : 'no') . "\n";
|
||||
echo "Empty: " . (empty($licenses) ? 'yes' : 'no') . "\n";
|
||||
|
||||
if (!empty($licenses)) {
|
||||
echo "First: " . json_encode($licenses[0]) . "\n";
|
||||
echo "Last: " . json_encode(end($licenses)) . "\n";
|
||||
echo "<h2>Licenses (" . count($licenses) . " rows)</h2>\n";
|
||||
echo "<p>empty(): " . (empty($licenses) ? 'TRUE' : 'FALSE') . "</p>\n";
|
||||
|
||||
echo "<table border='1'><tr><th>ID</th><th>Domain</th><th>Key (8)</th><th>valid_to_version</th><th>beta</th></tr>\n";
|
||||
foreach ($licenses as $lic) {
|
||||
echo "<tr>";
|
||||
echo "<td>" . (int)$lic['id'] . "</td>";
|
||||
echo "<td>" . htmlspecialchars($lic['domain']) . "</td>";
|
||||
echo "<td>" . htmlspecialchars(substr($lic['key'], 0, 8)) . "</td>";
|
||||
echo "<td>" . htmlspecialchars($lic['valid_to_version'] ?? '') . "</td>";
|
||||
echo "<td>" . (int)$lic['beta'] . "</td>";
|
||||
echo "</tr>\n";
|
||||
}
|
||||
|
||||
echo "\nMedoo last query: " . $mdb->last() . "\n";
|
||||
echo "Medoo error: " . json_encode($mdb->error()) . "\n";
|
||||
echo "</pre>\n";
|
||||
echo "</table>\n";
|
||||
|
||||
Reference in New Issue
Block a user