Ejemplo n.º 1
0
 protected function run()
 {
     $forum = new PwForumBo($this->fid, true);
     if (!$forum->isForum(true)) {
         return new PwError('BBS:forum.unite.error.fid.exists.not');
     }
     if ($forum->foruminfo['type'] == 'category') {
         return new PwError('BBS:forum.unite.error.fid.category');
     }
     if ($forum->getSubForums()) {
         return new PwError('BBS:forum.unite.error.hassub');
     }
     $toforum = new PwForumBo($this->tofid);
     if (!$toforum->isForum(true)) {
         return new PwError('BBS:forum.unite.error.tofid.exists.not');
     }
     if ($toforum->foruminfo['type'] == 'category') {
         return new PwError('BBS:forum.unite.error.tofid.category');
     }
     if ($this->fid == $this->tofid) {
         return new PwError('BBS:forum.unite.error.same');
     }
     Wekit::load('forum.PwForum')->deleteForum($this->fid);
     Wind::import('SRV:forum.dm.PwForumDm');
     $dm = new PwForumDm($this->tofid);
     $dm->addThreads($forum->foruminfo['threads'])->addPosts($forum->foruminfo['posts']);
     Wekit::load('forum.PwForum')->updateForum($dm, PwForum::FETCH_STATISTICS);
     Wekit::load('forum.srv.PwForumService')->updateForumStatistics($forum->foruminfo['parentid']);
     Wekit::load('forum.srv.PwForumService')->updateForumStatistics($this->tofid);
     return true;
 }