Exemplo n.º 1
0
 /**
  * After save callback, called by afterInsert and afterUpdate.
  * Sets an `at` job that clears the Static Page cache at the exact moment of the Published date.
  * @param Garp_Model_Db $model
  * @param Array $data
  * @return Void
  */
 public function afterSave($model, $data)
 {
     // Check if the 'published column' is filled...
     if (empty($data[self::PUBLISHED_COLUMN])) {
         return;
     }
     // ...and that it's in the future
     $publishTime = strtotime($data[self::PUBLISHED_COLUMN]);
     if ($publishTime <= time()) {
         return;
     }
     $tags = array(get_class($model));
     $tags = array_merge($tags, $model->getBindableModels());
     $tags = array_unique($tags);
     Garp_Cache_Manager::scheduleClear($publishTime, $tags);
 }