protected function initPost() { $class_name = SwatDBClassMap::get('BlorgPost'); $this->post = new $class_name(); $this->post->setDatabase($this->app->db); if ($this->id === null) { $this->post->enabled = false; } else { if (!$this->post->load($this->id, $this->app->getInstance())) { throw new AdminNotFoundException(sprintf(Blorg::_('Post with id ā%sā not found.'), $this->id)); } } // remember original publish_date and enabled so we can clear the // tags cache if they changed $this->original_publish_date = $this->post->publish_date; $this->original_enabled = $this->post->enabled; }
private function relocateReallyOldPost($id) { $post = new BlorgPost(); $post->setDatabase($this->app->db); $post->load($id, $this->app->getInstance()); if ($post->id === null) { return; } $path = $this->app->config->blorg->path . 'archive'; $date = clone $post->publish_date; $date->convertTZ($this->app->default_time_zone); $year = $date->getYear(); $month_name = BlorgPageFactory::$month_names[$date->getMonth()]; $url = sprintf('%s/%s/%s/%s', $path, $year, $month_name, $post->shortname); $this->relocate($url); }