Exemplo n.º 1
0
 /**
  * 登録日を更新する
  *
  * @return boolean
  */
 public function updateBlogEntryDate($dbConfig)
 {
     $this->connectDb($dbConfig, 'plugin');
     CakePlugin::load('Blog');
     App::uses('BlogPost', 'Blog.Model');
     $BlogPost = new BlogPost();
     $BlogPost->contentSaving = false;
     $datas = $BlogPost->find('all', array('recursive' => -1));
     if ($datas) {
         $ret = true;
         foreach ($datas as $data) {
             $data['BlogPost']['posts_date'] = date('Y-m-d H:i:s');
             unset($data['BlogPost']['eye_catch']);
             $BlogPost->set($data);
             if (!$BlogPost->save($data)) {
                 $ret = false;
             }
         }
         return $ret;
     } else {
         return false;
     }
 }