Skip to content

Commit

Permalink
2.11.20 Adding view account profile
Browse files Browse the repository at this point in the history
  • Loading branch information
webpwnized committed Oct 1, 2024
1 parent ffa5ee3 commit 09a7652
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions src/set-up-database.php
Original file line number Diff line number Diff line change
Expand Up @@ -1280,23 +1280,26 @@ function format($pMessage, $pLevel) {
try {
// Ensure the directories exist and are writable
if (!is_dir(pathinfo($lAccountXMLFilePath, PATHINFO_DIRNAME))) {
echo format("Oh no. Trying to create an XML version of the accounts file did not work out. The directory " . $lAccountXMLFilePath . " does not exist.","E");
echo format("Oh no. Trying to create an XML version of the accounts file did not work out. The directory " . $lAccountXMLFilePath . " does not exist.","F");
}
if (!is_dir(pathinfo($lPasswordFilePath, PATHINFO_DIRNAME))) {
echo format("Oh no. Trying to create a text version of the accounts file did not work out. The directory " . $lPasswordFilePath . " does not exist.","E");
echo format("Oh no. Trying to create a text version of the accounts file did not work out. The directory " . $lPasswordFilePath . " does not exist.","F");
}
if (!is_writable(pathinfo($lAccountXMLFilePath, PATHINFO_DIRNAME))) {
echo format("Oh no. Trying to create an XML version of the accounts file did not work out. The directory " . $lAccountXMLFilePath . " is not writable.","E");
echo format("Oh no. Trying to create an XML version of the accounts file did not work out. The directory " . $lAccountXMLFilePath . " is not writable.","F");
}
if (!is_writable(pathinfo($lPasswordFilePath, PATHINFO_DIRNAME))) {
echo format("Oh no. Trying to create a text version of the accounts file did not work out. The directory " . $lPasswordFilePath . " is not writable.","E");
echo format("Oh no. Trying to create a text version of the accounts file did not work out. The directory " . $lPasswordFilePath . " is not writable.","F");
}

// XML File Writing
try {
if (is_writable(pathinfo($lAccountXMLFilePath, PATHINFO_DIRNAME))) {
file_put_contents($lAccountXMLFilePath, $lAccountsXML);
echo format("Wrote accounts to " . $lAccountXMLFilePath, "S");
}else{
echo format("Could not write accounts XML to " . $lAccountXMLFilePath . " - Directory not writable", "W");
echo format("Using default version of accounts.xml", "W");
}
} catch (Exception $e) {
echo format("Could not write accounts XML to " . $lAccountXMLFilePath . " - " . $e->getMessage(), "W");
Expand All @@ -1308,6 +1311,9 @@ function format($pMessage, $pLevel) {
if (is_writable(pathinfo($lPasswordFilePath, PATHINFO_DIRNAME))) {
file_put_contents($lPasswordFilePath, $lAccountsText);
echo format("Wrote accounts to " . $lPasswordFilePath, "S");
}else{
echo format("Could not write accounts text to " . $lPasswordFilePath . " - Directory not writable", "W");
echo format("Using default version of accounts.txt", "W");
}
} catch (Exception $e) {
echo format("Could not write accounts text to " . $lPasswordFilePath . " - " . $e->getMessage(), "W");
Expand Down

0 comments on commit 09a7652

Please sign in to comment.