示例#1
0
 public function editAction()
 {
     $form_config = $this->current_module_config->forms->source;
     $form = new \DF\Form($form_config);
     if ($this->hasParam('id')) {
         $record = PodcastSource::getRepository()->findOneBy(array('id' => $this->getParam('id'), 'podcast_id' => $this->podcast->id));
         $form->setDefaults($record->toArray());
     }
     if (!empty($_POST) && $form->isValid($_POST)) {
         $data = $form->getValues();
         if (!$record instanceof PodcastSource) {
             $record = new PodcastSource();
             $record->podcast = $this->podcast;
         }
         $record->fromArray($data);
         $record->save();
         // Clear cache.
         \DF\Cache::remove('podcasts');
         // Immediately re-process this podcast.
         \PVL\PodcastManager::processPodcast($this->podcast);
         $this->alert('<b>Podcast source updated.</b>', 'green');
         $this->redirectFromHere(array('action' => 'index', 'id' => NULL));
         return;
     }
     $title = ($this->hasParam('id') ? 'Edit' : 'Add') . ' Podcast Source';
     $this->renderForm($form, 'edit', $title);
 }
示例#2
0
 public static function syncMedium($force = false)
 {
     self::initSync(300);
     // Sync schedules (highest priority).
     Debug::runTimer('Run schedule manager', function () {
         ScheduleManager::run(!DF_IS_COMMAND_LINE);
     });
     // Sync show episodes and artist news (high priority).
     Debug::runTimer('Run podcast manager', function () {
         PodcastManager::run();
     });
     // Pull the homepage news.
     Debug::runTimer('Run network news manager', function () {
         NewsManager::run();
     });
     // Sync CentovaCast song data.
     Debug::runTimer('Run CentovaCast track sync', function () {
         CentovaCast::sync();
     });
     Settings::setSetting('sync_last_run', time());
 }