Skip to content

Commit

Permalink
updated binary
Browse files Browse the repository at this point in the history
updated script for update of v0.2.0-beta to v0.2.0
adjusted initial sql
  • Loading branch information
s3inlc committed Mar 8, 2017
1 parent b217884 commit 19385f9
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 71 deletions.
28 changes: 28 additions & 0 deletions src/inc/Util.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -563,6 +563,34 @@ public static function getStaticArray($val, $id) {
return "";
}

/**
* @param $version1
* @param $version2
* @return int 1 if version2 is newer, 0 if equal and -1 if version1 is newer
*/
public static function versionComparison($version1, $version2){
$version1 = explode(".", $version1);
$version2 = explode(".", $version2);

for($i=0;$i<sizeof($version1)&&$i<sizeof($version2);$i++){
$num1 = (int)$version1[$i];
$num2 = (int)$version2[$i];
if($num1 > $num2){
return -1;
}
else if($num1 < $num2){
return 1;
}
}
if(sizeof($version1) > sizeof($version2)){
return -1;
}
else if(sizeof($version1) < sizeof($version2)){
return 1;
}
return 0;
}

/**
* Shows big numbers with the right suffixes (k, M, G)
* @param $num int integer you want formatted
Expand Down
2 changes: 1 addition & 1 deletion src/install/hashtopussy.sql
Original file line number Diff line number Diff line change
Expand Up @@ -461,7 +461,7 @@ INSERT INTO `RightGroup` (`rightGroupId`, `groupName`, `level`) VALUES
(5, 'Administrator', 50);

INSERT INTO `AgentBinary` (`agentBinaryId`, `type`, `operatingSystems`, `filename`, `version`)
VALUES (1, 'csharp', 'Windows', 'hashtopussy.exe', '0.38');
VALUES (1, 'csharp', 'Windows', 'hashtopussy.exe', '0.40');

CREATE TABLE `Session` (
`sessionId` INT(11) NOT NULL,
Expand Down
68 changes: 0 additions & 68 deletions src/install/migrate.sql

This file was deleted.

4 changes: 2 additions & 2 deletions src/install/updates/update_v0.2.0-beta_v0.2.0.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@
$qF = new QueryFilter(AgentBinary::TYPE, "csharp", "=");
$binary = $FACTORIES::getAgentBinaryFactory()->filter(array($FACTORIES::FILTER => $qF), true);
if($binary != null){
if($binary->getVersion() < "0.38"){
if(Util::versionComparison($binary->getVersion(), "0.40") == 1){
echo "update version... ";
$binary->setVersion("0.38");
$binary->setVersion("0.40");
$FACTORIES::getAgentBinaryFactory()->update($binary);
echo "OK";
}
Expand Down
Binary file modified src/static/hashtopussy.exe
Binary file not shown.

0 comments on commit 19385f9

Please sign in to comment.