Просмотр исходного кода

minimum interval is now dynamic

master
patrick 6 лет назад
Родитель
Сommit
0a10c22a67
2 измененных файлов: 24 добавлений и 4 удалений
  1. +18
    -1
      Xero.php
  2. +6
    -3
      ts.php

+ 18
- 1
Xero.php Просмотреть файл

// //
//sync users to wordpress system //sync users to wordpress system
//does not work for too many users or employees //does not work for too many users or employees
public function sync_users(){
public function sync_users($mininterval){
$this->usage();
$this->minimum_sync_interval_in_seconds = $mininterval;
$msg="Sync users with minimum interval set to $mininterval \n";
$this->logConsole($msg);
try{ try{
$this->sync_clients(); $this->sync_clients();
$this->sync_employees(); $this->sync_employees();
echo $str; echo $str;
} }
} }
private function usage(){
$msg = "_____________________________________________\n";
$msg .= "run this command at public_html/, where wp-config.php exist \n";
$msg .= "wp sync_users --mininterval=6000 \n";
$msg .= "6000 means those users synced within 6000 seconds will be bypassed \n";
$msg .= "to sync everything \n";
$msg .= "wp sync_users --mininterval=0 \n";
$msg .= "but it may hit XERO rate limit, 60call/sec, 5000/day \n";
$msg .= "---------------------------------------------\n";
$this->logConsole($msg);
}
} }

+ 6
- 3
ts.php Просмотреть файл

$a=1; $a=1;
return; return;
} }
// Usage: `wp sync_users --mininterval=123
public function sync_user_cli($args = array(), $assoc_args = array()){ public function sync_user_cli($args = array(), $assoc_args = array()){
$this->cli = true;
echo "running sync user from command line;\n";
$this->xero->sync_users();
$arguments = wp_parse_args( $assoc_args, array(
'mininterval' => 600,
) );
$this->xero->sync_users($arguments['mininterval']);
return; return;
} }
} }

Загрузка…
Отмена
Сохранить