Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // restart all syncs
- $org = 12345 // insert your ORG ID
- global $conn = "connection-name" // insert your mysql connection name as per the integrations page
- global $refreshed = 0
- doOrg($org)
- print "Refreshed "+$refreshed+" syncs"
- end
- function doOrg($org) {
- $spaces = podio_org_get_spaces($org)
- foreach ( $spaces as $space ) {
- if ( $space.type == "emp_network" ) continue
- ini_set("max_execution_time", 30)
- doSpace($space)
- }
- }
- function doSpace($space) {
- print "Space: "+$space.space_id+": "+$space.name
- $apps = podio_space_get_apps($space.space_id)
- foreach ( $apps as $app ) {
- ini_set("max_execution_time", 30)
- checkApp($app)
- }
- }
- function checkApp($app) {
- $appid = $app.app_id
- $sync = pf_sync_get_for_app("p", $appid)
- if ( $sync == false ) {
- return
- }
- print "Restart sync "+$sync.sync_id+" for app "+$appid+": "+$app.config.name
- $refreshed = $refreshed + 1
- pf_sync_restart($sync.sync_id)
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement