/**
  * Feed Importer uninstall procedure
  *
  * @param vivvo_site 	$site_manager
  * @param int			$step
  */
 public function uninstall($site_manager, $step = 1)
 {
     parent::uninstall($site_manager, $step);
     if ($step == 2) {
         $sqlRunner = new SQLRunner(array('db' => $site_manager->get_db(), 'filename' => VIVVO_FS_PLUGIN_ROOT . ($plugin_dir = $this->get_root_dir()) . 'db/uninstall.sql'));
         try {
             $sqlRunner->load() and $sqlRunner->run();
         } catch (SQLRunnerException $e) {
             $this->set_error_code(14, $e->getMessage());
             // error executing sql script file
             $this->uninstall($site_manager, 1);
             return;
         }
         $conf = $site_manager->get_configuration();
         $conf->remove_global('VIVVO_PLUGIN_FEED_IMPORTER_AUTHOR');
         $conf->remove_global('VIVVO_PLUGIN_FEED_IMPORTER_AUTO_ARCHIVE');
         $conf->remove_global('VIVVO_PLUGIN_FEED_IMPORTER_AUTO_DELETE');
         $conf->remove_global('VIVVO_PLUGIN_FEED_IMPORTER_PERIOD');
         $conf->remove_global('VIVVO_PLUGIN_FEED_IMPORTER_STATUS');
         $conf->remove_global('VIVVO_PLUGIN_FEED_IMPORTER_SHOW_COMMENT');
         $conf->remove_global('VIVVO_PLUGIN_FEED_IMPORTER_UPDATE_ARTICLES');
         $conf->remove_global('VIVVO_PLUGIN_FEED_IMPORTER_USE_LOGO');
         $conf->remove_global('VIVVO_PLUGIN_FEED_IMPORTER_TRASH');
         $conf->remove_global('VIVVO_PLUGIN_FEED_IMPORTER_USER_ID');
         $site_manager->unregister_action('feed');
         require_once VIVVO_FS_INSTALL_ROOT . 'lib/vivvo/framework/vivvo_cron.php';
         $cm = new vivvo_cron_manager($site_manager);
         $cm->delete_cron_job($plugin_dir . 'tasks/auto_import_feeds.php', null, 'auto_import_feeds');
         $site_manager->get_plugin_manager()->unregister($this->plugin_name);
     }
     $output = $site_manager->get_output();
     echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">' . "\n";
     echo $output;
 }
Пример #2
0
 function edit_cron_task($in_task)
 {
     if (!$this->check_token()) {
         return false;
     }
     if (!vivvo_hooks_manager::call('vivvoCore_cronTask', array(&$in_task))) {
         return vivvo_hooks_manager::get_status();
     }
     if ($this->_user && $this->_user->is_admin()) {
         if (isset($in_task['name'])) {
             $sm = vivvo_lite_site::get_instance();
             $_config = $sm->get_configuration();
             $cron_tasks = $_config->get_configuration_property_list('cron_task');
             if (array_key_exists($in_task['name'], $cron_tasks)) {
                 require_once VIVVO_FS_INSTALL_ROOT . 'lib/vivvo/framework/vivvo_cron.php';
                 $cm = new vivvo_cron_manager();
                 if (trim($in_task['time_mask']) != '') {
                     //edit
                     $cm->cron_job($in_task['time_mask'], $cron_tasks[$in_task['name']]['file'], $cron_tasks[$in_task['name']]['class'], $cron_tasks[$in_task['name']]['method'], unserialize($cron_tasks[$in_task['name']]['arguments']));
                     admin_log($sm->user->get_username(), 'Edited cron #' . $in_task['name']);
                 } else {
                     //delete
                     $cm->delete_cron_job($cron_tasks[$in_task['name']]['file'], $cron_tasks[$in_task['name']]['class'], $cron_tasks[$in_task['name']]['method'], unserialize($cron_tasks[$in_task['name']]['arguments']));
                     admin_log($sm->user->get_username(), 'Deleted cron #' . $in_task['name']);
                 }
                 return true;
             } else {
                 $this->set_error_code(5104);
                 return false;
             }
         } else {
             $this->set_error_code(5105);
             return false;
         }
     } else {
         $this->set_error_code(5106);
         return false;
     }
 }
 /**
  * Newsletter uninstall procedure
  *
  * @param vivvo_site 	$site_manager
  * @param int			$step
  */
 public function uninstall($site_manager, $step = 1)
 {
     parent::uninstall($site_manager, $step);
     if ($step == 2) {
         $sqlRunner = new SQLRunner(array('db' => $site_manager->get_db(), 'filename' => VIVVO_FS_PLUGIN_ROOT . ($plugin_dir = $this->get_root_dir()) . 'db/uninstall.sql'));
         try {
             $sqlRunner->load() and $sqlRunner->run();
         } catch (SQLRunnerException $e) {
             $this->set_error_code(14, $e->getMessage());
             // error executing sql script file
             $this->uninstall($site_manager, 1);
             return;
         }
         $conf = $site_manager->get_configuration();
         $conf->remove_global('VIVVO_PLUGIN_NEWSLETTER_SUBSCRIBE_BODY');
         $conf->remove_global('VIVVO_PLUGIN_NEWSLETTER_SUBSCRIBE_SUBJECT');
         $conf->remove_global('VIVVO_PLUGIN_NEWSLETTER_UNSUBSCRIBE_TEXT');
         $conf->remove_global('VIVVO_PLUGIN_NEWSLETTER_PERIOD');
         $conf->remove_global('VIVVO_PLUGIN_NEWSLETTER_NUMBER_OF_MAILS');
         $site_manager->unregister_action('newsletter');
         $site_manager->unregister_module('box_newsletter');
         $site_manager->unregister_module('box_maillist');
         $site_manager->get_url_manager()->unregister_url('newsletter');
         require_once VIVVO_FS_INSTALL_ROOT . 'lib/vivvo/framework/vivvo_cron.php';
         $cm = new vivvo_cron_manager($site_manager);
         $cm->delete_cron_job($plugin_dir . 'tasks/mail_queue.php', null, 'mail_queue');
         $site_manager->get_plugin_manager()->unregister($this->plugin_name);
     }
     $output = $site_manager->get_output();
     echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">' . "\n";
     echo $output;
 }