Skip to content
Permalink
Browse files

show methods ever run on umpleonline and log.php

  • Loading branch information...
fjtheknight committed Jul 11, 2019
1 parent c687cb4 commit 46b465dea7a0c940ef5bfc94f4959dc09061cbf5
Showing with 19 additions and 7 deletions.
  1. +1 −1 .gitignore
  2. +7 −6 cruise.umple/src/Main_Code.ump
  3. +11 −0 umpleonline/counter.php
@@ -10,7 +10,7 @@ umpleonline/ump/tmp*
build/UserManualAndExampleTests_output.txt
umpleonline/manual
umpleonline/countlog.txt
umpleonline/commandcount.txt
umpleonline/scripts/commandcount.txt
umpleonline/scripts/specialPort.txt

# generated Umple code that is not saved
@@ -703,6 +703,9 @@ class PlaygroundMain
+" JsonMixed: " +generateJsonMixedCommandsRun
+"\n\n", client);

returnCommandResult("Number of commands run since July 2019: "
+commandsEverRun+"\n\n", client);

returnCommandResult("Number of clients queued: "
+getClientConnections().length+"\n\n", client);

@@ -910,13 +913,12 @@ class PlaygroundMain
returnCommandResult(answer, client);
}


protected boolean saveCommandsCount(){
private boolean saveCommandsCount(){
boolean saved = false;

try {
FileWriter writer = new FileWriter("commandcount.txt", true);
writer.write(commandsEverRun);
FileWriter writer = new FileWriter("commandcount.txt", false);
writer.write(Integer.toString(commandsEverRun));
writer.close();
saved = true;
} catch (IOException e) {
@@ -926,7 +928,7 @@ class PlaygroundMain
return saved;
}

protected boolean loadCommandsCount(){
private boolean loadCommandsCount(){
boolean loaded = false;
try {
BufferedReader myReader = new BufferedReader(new FileReader("commandcount.txt"));
@@ -963,7 +965,6 @@ class PlaygroundMain
protected void serverStopped() {
// Uncomment the following to debug
// System.err.println("Umple server stopped accepting connections "+getPort());
saveCommandsCount();
}

protected void serverClosed() {
@@ -9,6 +9,7 @@
//opens countlog.txt to read the number of hits
$dir = dirname(__FILE__);
$logpath = $dir."/countlog.txt";
$commandlogpath = $dir."/scripts/commandcount.txt";
if(file_exists($logpath)){
if(!is_writable($logpath)||!is_readable($logpath)) {
chmod($logpath, 0755);
@@ -26,5 +27,15 @@
fclose($log);
}
if(file_exists($commandlogpath)){
if(!is_writable($commandlogpath)||!is_readable($commandlogpath)) {
chmod($commandlogpath, 0755);
}
$log = fopen($commandlogpath, "r");
$count = fgets($log,1000);
fclose($log);
echo " | $count commands run since July 2019" ;
}
?>

0 comments on commit 46b465d

Please sign in to comment.
You can’t perform that action at this time.