mirror of
https://port.numenaute.org/aleajactaest/khanat-opennel-code.git
synced 2024-11-10 09:19:01 +00:00
fix sync
This commit is contained in:
parent
220d0edd3e
commit
6b37539963
9 changed files with 17 additions and 16 deletions
|
@ -201,6 +201,7 @@ class DBLayer {
|
|||
$field_option_values = ltrim($field_option_values, ',');
|
||||
try {
|
||||
$sth = $this->PDO->prepare("UPDATE $tb_name SET $field_option_values WHERE $where ");
|
||||
error_log("UPDATE $tb_name SET $field_option_values WHERE $where ");
|
||||
|
||||
foreach ($data as $key => $value) {
|
||||
$sth->bindValue(":$key", $value);
|
||||
|
|
|
@ -18,14 +18,15 @@ class Sync{
|
|||
if (function_exists('pcntl_fork')) {
|
||||
$pid = pcntl_fork();
|
||||
}
|
||||
$pidfile = '/tmp/ams_cron_pid';
|
||||
global $AMS_TMPDIR;
|
||||
$pidfile = $AMS_TMPDIR.'/ams_cron_pid';
|
||||
|
||||
if(isset($pid)) {
|
||||
if(isset($pid) and function_exists('pcntl_fork') ) {
|
||||
// We're the main process.
|
||||
} else {
|
||||
if(!file_exists($pidfile)) {
|
||||
$pid = getmypid();
|
||||
$file = fopen($pidfile, 'w');
|
||||
$file = fopen($pidfile, 'w+');
|
||||
|
||||
fwrite($file, $pid);
|
||||
fclose($file);
|
||||
|
@ -57,13 +58,13 @@ class Sync{
|
|||
$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]");
|
||||
$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]");
|
||||
$db->update("user", $values, "Login = '$decode[0]'");
|
||||
break;
|
||||
case 'createUser':
|
||||
$decode = json_decode($record['query']);
|
||||
|
|
|
@ -436,7 +436,7 @@ class Users{
|
|||
try {
|
||||
//make connection with and put into shard db
|
||||
$dbs = new DBLayer("shard");
|
||||
$dbs->update("user", $values, "Login = $user");
|
||||
$dbs->update("user", $values, "Login = '$user'");
|
||||
return "ok";
|
||||
}
|
||||
catch (PDOException $e) {
|
||||
|
|
0
code/web/private_php/ams/tmp/placeholder
Normal file
0
code/web/private_php/ams/tmp/placeholder
Normal file
|
@ -234,11 +234,11 @@ class WebUsers extends Users{
|
|||
|
||||
$hashpass = crypt($pass, WebUsers::generateSALT());
|
||||
$reply = WebUsers::setAmsPassword($user, $hashpass);
|
||||
$values = Array('pass' => $hashpass);
|
||||
$values = Array('Password' => $hashpass);
|
||||
try {
|
||||
//make connection with and put into shard db
|
||||
$dbw = new DBLayer("web");
|
||||
$dbw->update("ams_user", $values,"Login = $user");
|
||||
$dbw->update("ams_user", $values,"Login = '$user'");
|
||||
}
|
||||
catch (PDOException $e) {
|
||||
//ERROR: the web DB is offline
|
||||
|
|
|
@ -5,8 +5,8 @@
|
|||
* @author Daan Janssens, mentored by Matthew Lagoe
|
||||
*/
|
||||
|
||||
require( '../libinclude.php' );
|
||||
require( '../../www/config.php' );
|
||||
require( '../../config.php' );
|
||||
require_once( $AMS_LIB . '/libinclude.php' );;
|
||||
|
||||
$mail_handler = new Mail_Handler();
|
||||
$mail_handler->cron();
|
|
@ -4,8 +4,7 @@
|
|||
* This small piece of php code calls the syncdata() function of Sync class.
|
||||
* @author Daan Janssens, mentored by Matthew Lagoe
|
||||
*/
|
||||
|
||||
require( '../libinclude.php' );
|
||||
require( '../../www/config.php' );
|
||||
|
||||
error_log('test2');
|
||||
require( '../../config.php' );
|
||||
require_once( $AMS_LIB . '/libinclude.php' );
|
||||
Sync::syncdata();
|
|
@ -37,7 +37,7 @@ if ( isset( $_GET["cron"] ) ) {
|
|||
}
|
||||
|
||||
// Always try to sync on page load, ie "lazy" cron
|
||||
Sync :: syncdata( false );
|
||||
Sync :: syncdata( true );
|
||||
|
||||
// Decide what page to load
|
||||
if ( ! isset( $_GET["page"] ) ) {
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
<script>
|
||||
function sync(){
|
||||
xmlhttp=new XMLHttpRequest();
|
||||
xmlhttp.open("POST","../../../ams_lib/cron/sync_cron.php",true);
|
||||
xmlhttp.open("POST","cron/sync_cron.php",true);
|
||||
xmlhttp.send();
|
||||
}
|
||||
</script>
|
||||
|
|
Loading…
Reference in a new issue