do not require PDO if we're using mocha-dotnet

This commit is contained in:
Michael Becker 2025-01-12 23:28:39 -05:00
parent 162cbff537
commit f20fa1f393

View File

@ -26,7 +26,7 @@
catch (\Exception $ex) catch (\Exception $ex)
{ {
$pdoex = $ex; $pdoex = $ex;
echo($pdoex); die(); // echo($pdoex); die();
} }
$basepath = $_SERVER["SERVER_NAME"]; $basepath = $_SERVER["SERVER_NAME"];
@ -34,13 +34,14 @@
{ {
protected function OnPreRender(CancelEventArgs $e) protected function OnPreRender(CancelEventArgs $e)
{ {
global $pdo;
global $basepath; global $basepath;
$e->Cancel = true; $e->Cancel = true;
if ($_POST["reset"] == "1") if ($_POST["reset"] == "1")
{ {
global $pdo;
if ($pdo !== null) {
$stmt = $pdo->prepare("DELETE FROM mocha_attributes WHERE tenant_id > 2"); $stmt = $pdo->prepare("DELETE FROM mocha_attributes WHERE tenant_id > 2");
$stmt->execute(); $stmt->execute();
@ -60,6 +61,7 @@
header("Location: /suv/suvinfo.html"); header("Location: /suv/suvinfo.html");
exit(); exit();
} }
}
$path = System::GetVirtualPath(); $path = System::GetVirtualPath();
if ($path[1] == "phpinfo.html") if ($path[1] == "phpinfo.html")
@ -328,18 +330,16 @@ EOF
else else
{ {
global $pdo; global $pdo;
if ($pdo !== null) {
global $basepath; global $basepath;
$query = "SELECT * FROM mocha_tenants"; $query = "SELECT * FROM mocha_tenants";
$stmt = $pdo->prepare($query); $stmt = $pdo->prepare($query);
try try {
{
$result = $stmt->execute(); $result = $stmt->execute();
$rows = $stmt->fetchAll(); $rows = $stmt->fetchAll();
foreach ($rows as $values) foreach ($rows as $values) {
{ if ($values["is_library"] != 0) {
if ($values["is_library"] != 0)
{
continue; continue;
} }
?> ?>
@ -357,12 +357,15 @@ EOF
</tr> </tr>
<?php <?php
} }
} } catch (\Exception $ex) {
catch (\Exception $ex)
{
echo ("<tr><td colspan=\"10\">" . $ex . "</td></tr>"); echo ("<tr><td colspan=\"10\">" . $ex . "</td></tr>");
} }
} }
else
{
// FIXME : use mocha-dotnet
}
}
?> ?>
</tbody> </tbody>
</table> </table>