executeWithoutParams("SELECT * FROM ams_querycache"); $rows = $statement->fetchAll(); foreach ($rows as $record) { $db = new DBLayer($record['db']); switch($record['type']) { case 'createPermissions': $decode = json_decode($record['query']); $values = array('username' => $decode[0]); //make connection with and put into shard db & delete from the lib $sth=$db->selectWithParameter("UId", "user", $values, "Login= :username" ); $result = $sth->fetchAll(); /*foreach ($result as $UId) { $ins_values = array('UId' => $UId['UId']); $ins_values['ClientApplication'] = "r2"; $ins_values['AccessPrivilege'] = "OPEN"; $db->insert("permission", $ins_values); $ins_values['ClientApplication'] = 'ryzom_open'; $db->insert("permission",$ins_values); }*/ // FIXME: GARBAGE break; case 'change_pass': $decode = json_decode($record['query']); $values = array('Password' => $decode[1]); //make connection with and put into shard db & delete from the lib $db->update("user", $values, "Login = '$decode[0]'"); break; case 'change_mail': $decode = json_decode($record['query']); $values = array('Email' => $decode[1]); //make connection with and put into shard db & delete from the lib $db->update("user", $values, "Login = '$decode[0]'"); break; case 'createUser': $decode = json_decode($record['query']); $values = array('Login' => $decode[0], 'Password' => $decode[1], 'Email' => $decode[2] ); //make connection with and put into shard db & delete from the lib $db->insert("user", $values); break; } $dbl->delete("ams_querycache", array('SID' => $record['SID']), "SID=:SID"); } if ($display == true) { print('Syncing completed'); } } catch (PDOException $e) { if ($display == true) { print('Something went wrong! The shard is probably still offline!'); print_r($e); } } unlink($pidfile); } } } public static function check_for_pid($pid){ $OS = Sync::getOS(); if ($OS == 2) { $processes = explode( "\n", shell_exec( "tasklist.exe" )); foreach( $processes as $key => $value ) { if( empty($value) != '1' && strpos( "Image Name", $value ) === 0 || empty($value) != '1' && strpos( "===", $value ) === 0 ) continue; $matches = false; preg_match( "/(.*?)\s+(\d+).*$/", $value, $matches ); if (isset($matches[ 2 ]) && $pid = $matches[ 2 ]) { return true; } } } else { return file_exists( "/proc/".$pid ); } } static public function getOS() { switch (true) { case stristr(PHP_OS, 'DAR'): return self::OS_OSX; case stristr(PHP_OS, 'WIN'): return self::OS_WIN; case stristr(PHP_OS, 'LINUX'): return self::OS_LINUX; default : return self::OS_UNKNOWN; } } }