updated the sync and added some new db tabels in the install
This commit is contained in:
parent
add130d21e
commit
1931f0f46f
5 changed files with 52 additions and 5 deletions
|
@ -25,13 +25,27 @@ class Sync{
|
|||
|
||||
switch($record['type']) {
|
||||
case 'createPermissions':
|
||||
case 'user_edit':
|
||||
case 'change_pass':
|
||||
$decode = json_decode($record['query']);
|
||||
$values = array('user' => $decode[0], 'pass' => $decode[1]);
|
||||
//make connection with and put into shard db & delete from the lib
|
||||
$dbs->execute("SET Password = :pass WHERE Login = :user",$values);
|
||||
$dbl->execute("DELETE FROM ams_querycache WHERE SID=:SID",array('SID' => $record['SID']));
|
||||
break;
|
||||
case 'change_mail':
|
||||
$decode = json_decode($record['query']);
|
||||
$values = array('user' => $decode[0], 'mail' => $decode[1]);
|
||||
//make connection with and put into shard db & delete from the lib
|
||||
$dbs->execute("SET Email = :mail WHERE Login = :user",$values);
|
||||
$dbl->execute("DELETE FROM ams_querycache WHERE SID=:SID",array('SID' => $record['SID']));
|
||||
break;
|
||||
case 'createUser':
|
||||
$decode = json_decode($record['query']);
|
||||
$query = array('login' => $decode[0], 'pass' => $decode[1], 'mail' => $decode[2] );
|
||||
$values = array('login' => $decode[0], 'pass' => $decode[1], 'mail' => $decode[2] );
|
||||
//make connection with and put into shard db & delete from the lib
|
||||
$dbs->execute("INSERT INTO user (Login, Password, Email) VALUES (:login, :pass, :mail)",$query);
|
||||
$dbs->execute("INSERT INTO user (Login, Password, Email) VALUES (:login, :pass, :mail)",$values);
|
||||
$dbl->execute("DELETE FROM ams_querycache WHERE SID=:SID",array('SID' => $record['SID']));
|
||||
break;
|
||||
}
|
||||
}
|
||||
print('Syncing completed');
|
||||
|
|
|
@ -380,7 +380,7 @@ class Users{
|
|||
//oh noooz, the shard is offline! Put in query queue at ams_lib db!
|
||||
try {
|
||||
$dbl = new DBLayer($cfg['db']['lib']);
|
||||
$dbl->execute("INSERT INTO ams_querycache (type, query) VALUES (:type, :query)",array("type" => "changepass",
|
||||
$dbl->execute("INSERT INTO ams_querycache (type, query) VALUES (:type, :query)",array("type" => "change_pass",
|
||||
"query" => json_encode(array($values["user"],$values["pass"]))));
|
||||
return "shardoffline";
|
||||
}catch (PDOException $e) {
|
||||
|
@ -404,7 +404,7 @@ class Users{
|
|||
//oh noooz, the shard is offline! Put in query queue at ams_lib db!
|
||||
try {
|
||||
$dbl = new DBLayer($cfg['db']['lib']);
|
||||
$dbl->execute("INSERT INTO ams_querycache (type, query) VALUES (:type, :query)",array("type" => "changemail",
|
||||
$dbl->execute("INSERT INTO ams_querycache (type, query) VALUES (:type, :query)",array("type" => "change_mail",
|
||||
"query" => json_encode(array($values["user"],$values["mail"]))));
|
||||
return "shardoffline";
|
||||
}catch (PDOException $e) {
|
||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 110 KiB After Width: | Height: | Size: 112 KiB |
|
@ -45,6 +45,39 @@
|
|||
`query` VARCHAR( 512 ) NOT NULL
|
||||
);
|
||||
|
||||
DROP TABLE IF EXISTS `" . $cfg['db']['lib']['name'] ."`.`ticket_category` ;
|
||||
CREATE TABLE IF NOT EXISTS `" . $cfg['db']['lib']['name'] ."`.`ticket_category` (
|
||||
`TCategoryId` INT NOT NULL AUTO_INCREMENT ,
|
||||
`Name` VARCHAR(45) NOT NULL ,
|
||||
PRIMARY KEY (`TCategoryId`) ,
|
||||
UNIQUE INDEX `Name_UNIQUE` (`Name` ASC) )
|
||||
ENGINE = InnoDB;
|
||||
|
||||
DROP TABLE IF EXISTS `" . $cfg['db']['lib']['name'] ."`.`ticket` ;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `" . $cfg['db']['lib']['name'] ."`.`ticket` (
|
||||
`TId` INT NOT NULL AUTO_INCREMENT ,
|
||||
`Timestamp` TIMESTAMP NOT NULL ,
|
||||
`Title` VARCHAR(120) NOT NULL ,
|
||||
`Status` INT NULL DEFAULT 0 ,
|
||||
`Queue` INT NULL DEFAULT 0 ,
|
||||
`Ticket_Category` INT NOT NULL ,
|
||||
`Author` INT NOT NULL ,
|
||||
PRIMARY KEY (`TId`) ,
|
||||
INDEX `fk_ticket_ticket_category_idx` (`Ticket_Category` ASC) ,
|
||||
INDEX `fk_ticket_ams_user_idx` (`Author` ASC) ,
|
||||
CONSTRAINT `fk_ticket_ticket_category`
|
||||
FOREIGN KEY (`Ticket_Category` )
|
||||
REFERENCES `" . $cfg['db']['lib']['name'] ."`.`ticket_category` (`TCategoryId` )
|
||||
ON DELETE NO ACTION
|
||||
ON UPDATE NO ACTION,
|
||||
CONSTRAINT `fk_ticket_ams_user`
|
||||
FOREIGN KEY (`Author` )
|
||||
REFERENCES `" . $cfg['db']['lib']['name'] ."`.`ams_user` (`UId` )
|
||||
ON DELETE NO ACTION
|
||||
ON UPDATE NO ACTION)
|
||||
ENGINE = InnoDB;
|
||||
|
||||
|
||||
";
|
||||
$dbl->executeWithoutParams($sql);
|
||||
|
|
Binary file not shown.
Loading…
Reference in a new issue