/** * Imports posts from the current master branch. * * @return boolean */ public function import_master() { if (!$this->app->semaphore()->is_open()) { return $this->app->response()->error(new WP_Error('semaphore_locked', sprintf(__('%s : Semaphore is locked, import/export already in progress.', 'wordpress-github-sync'), 'Controller::import_master()'))); } $this->app->semaphore()->lock(); remove_action('save_post', array($this, 'export_post')); remove_action('save_post', array($this, 'delete_post')); $result = $this->app->import()->master(); $this->app->semaphore()->unlock(); if (is_wp_error($result)) { return $this->app->response()->error($result); } return $this->app->response()->success($result); }