/** * Duplicate all content items to create a new revision * * @return void * @author Drew McLellan */ public function create_new_revision($copy_resources = true) { $old_rev = (int) $this->regionLatestRev(); $new_rev = $old_rev + 1; $Items = new PerchContent_Items(); $Items->create_new_revision($this->id(), $old_rev, $new_rev, $copy_resources); $data = array(); $data['regionLatestRev'] = $new_rev; // if this is a new region if ($new_rev == 1) { $data['regionRev'] = $new_rev; } $this->update($data); $Items->delete_old_revisions($this->id(), $this->history_items); $Perch = Perch::fetch(); $Perch->event('region.create_revision', $this); return $new_rev; }