/** * @see Console\Command\Command */ protected function execute(Console\Input\InputInterface $input, Console\Output\OutputInterface $output) { $supportSend = \SystemPref::get('support_send'); if ($supportSend) { $stats = $this->getHelper('container')->getService('stat')->getAll(); $statsUrl = 'http://stat.sourcefabric.org'; $parameters = array('p' => 'newscoop'); $parameters['installation_id'] = $stats['installationId']; $parameters['server'] = \SystemPref::get('support_stats_server'); $parameters['ip_address'] = \SystemPref::get('support_stats_ip_address'); $parameters['ram_used'] = $stats['ramUsed']; $parameters['ram_total'] = \SystemPref::get('support_stats_ram_total'); $parameters['version'] = $stats['version']; $parameters['install_method'] = $stats['installMethod']; $parameters['publications'] = $stats['publications']; $parameters['issues'] = $stats['issues']; $parameters['sections'] = $stats['sections']; $parameters['articles'] = $stats['articles']; $parameters['articles_published'] = $stats['articlesPublished']; $parameters['languages'] = $stats['languages']; $parameters['authors'] = $stats['authors']; $parameters['subscribers'] = $stats['subscribers']; $parameters['backend_users'] = $stats['backendUsers']; $parameters['images'] = $stats['images']; $parameters['attachments'] = $stats['attachments']; $parameters['topics'] = $stats['topics']; $parameters['comments'] = $stats['comments']; $parameters['hits'] = $stats['hits']; $client = new \Zend_Http_Client(); $client->setUri($statsUrl); $client->setParameterPost($parameters); $response = $client->request('POST'); } }
public function indexAction() { $this->view->stats = $this->_helper->service('stat')->getAll(); // saving them here to retrieve later, because these are not available when run in cli SystemPref::set('support_stats_server', $this->view->stats['server']); SystemPref::set('support_stats_ip_address', $this->view->stats['ipAddress']); SystemPref::set('support_stats_ram_total', $this->view->stats['ramTotal']); if ($this->getRequest()->isPost() && $this->_getParam('support_send') !== null) { $values = $this->getRequest()->getPost(); try { $askTime = new DateTime($values['stat_ask_time']); } catch (Exception $e) { $askTime = new DateTime('7 days'); } SystemPref::set('stat_ask_time', $askTime->getTimestamp()); SystemPref::set('support_send', $values['support_send']); $this->_helper->flashMessenger(getGS('Support settings saved.')); if ($this->_getParam('action') === 'popup') { $this->_helper->redirector('index', ''); } else { $this->_helper->redirector('index'); } } $this->view->support_send = SystemPref::get('support_send'); }
camp_load_translation_strings('api'); camp_load_translation_strings('extensions'); camp_load_translation_strings('globals'); // install default widgets for admin WidgetManager::SetDefaultWidgetsAll(); // add title echo camp_html_breadcrumbs(array(array(getGS('Dashboard'), ''))); if (!SystemPref::get('stat_ask_time')) { SystemPref::set('stat_ask_time', 0); } if (!SystemPref::get('installation_id')) { $installationId = sha1($_SERVER['SERVER_ADDR'] . $_SERVER['SERVER_NAME'] . mt_rand()); SystemPref::set('installation_id', $installationId); } $request_only = false; if (!SystemPref::get('support_send') && SystemPref::get('stat_ask_time') <= time() && empty($_SESSION['statDisplayed'])) { $statUrl = $Campsite['WEBSITE_URL'] . '/admin/support/popup'; $request_only = true; ?> <a style="display: none;" id="dummy_stat_link" href="<?php echo $statUrl; ?> "></a><?php } // clear cache $clearCache = Input::Get('clear_cache', 'string', 'no', true); if ((CampCache::IsEnabled() || CampTemplateCache::factory()) && $clearCache == 'yes' && $g_user->hasPermission('ClearCache')) { // Clear cache engine's cache CampCache::singleton()->clear('user'); CampCache::singleton()->clear(); SystemPref::DeleteSystemPrefsFromCache();
public function getInstallationId() { return \SystemPref::get('installation_id'); }