Przeglądaj źródła

minimum interval is now dynamic

master
patrick 6 lat temu
rodzic
commit
0a10c22a67
2 zmienionych plików z 24 dodań i 4 usunięć
  1. +18
    -1
      Xero.php
  2. +6
    -3
      ts.php

+ 18
- 1
Xero.php Wyświetl plik

@@ -71,7 +71,12 @@ class Xero {
//
//sync users to wordpress system
//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{
$this->sync_clients();
$this->sync_employees();
@@ -199,4 +204,16 @@ class Xero {
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 Wyświetl plik

@@ -96,10 +96,13 @@ class AcareOffice{
$a=1;
return;
}
// Usage: `wp sync_users --mininterval=123
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;
}
}

Ładowanie…
Anuluj
Zapisz