|
|
|
@@ -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); |
|
|
|
} |
|
|
|
} |