diff --git a/docs/changelog/8.x.x.txt b/docs/changelog/8.x.x.txt index 1016de841..1b9b247a3 100644 --- a/docs/changelog/8.x.x.txt +++ b/docs/changelog/8.x.x.txt @@ -2,4 +2,5 @@ - Replaced the existing caching mechanism with memcached, which results in a 400% improvement to cache speed. See migration.txt for API changes and gotcha.txt for prereq changes. - Added "hot sessions" so sessions interact with the database less. - Added Facebook Auth and FacebookLogin macro. + - Removed the WebGUI statistics program and code. diff --git a/etc/WebGUI.conf.original b/etc/WebGUI.conf.original index 3a59ffe96..a5ce107ca 100644 --- a/etc/WebGUI.conf.original +++ b/etc/WebGUI.conf.original @@ -278,13 +278,6 @@ "url" : "^PageUrl(\"\",func=manageClipboard);", "title" : "^International(948,WebGUI);" }, - "statistics" : { - "icon" : "statistics.gif", - "uiLevel" : 1, - "url" : "^PageUrl(\"\",op=viewStatistics);", - "title" : "^International(437,WebGUI);", - "groupSetting" : "groupIdAdminStatistics" - }, "users" : { "icon" : "users.gif", "uiLevel" : 5, diff --git a/lib/WebGUI/Operation/Statistics.pm b/lib/WebGUI/Operation/Statistics.pm deleted file mode 100644 index 96073da40..000000000 --- a/lib/WebGUI/Operation/Statistics.pm +++ /dev/null @@ -1,242 +0,0 @@ -package WebGUI::Operation::Statistics; - -#------------------------------------------------------------------- -# WebGUI is Copyright 2001-2012 Plain Black Corporation. -#------------------------------------------------------------------- -# Please read the legal notices (docs/legal.txt) and the license -# (docs/license.txt) that came with this distribution before using -# this software. -#------------------------------------------------------------------- -# http://www.plainblack.com info@plainblack.com -#------------------------------------------------------------------- - -use strict; -use WebGUI::AdminConsole; -use WebGUI::International; -use WebGUI::Workflow::Cron; -use WebGUI::DateTime; - -=head1 NAME - -Package WebGUI::Operation::Statistics - -=head1 DESCRIPTION - -Handles displaying statistics about WebGUI. This isn't page count, but rather information -about the number of assets, users, groups, etc. - -#------------------------------------------------------------------- - -=head2 _submenu ( $session, $workarea, $title, $help ) - -Utility routine for creating the AdminConsole for Statistics functions. - -=head3 $session - -The current WebGUI session object. - -=head3 $workarea - -The content to display to the user. - -=head3 $title - -The title of the Admin Console. This should be an entry in the i18n -table in the WebGUI namespace. - -=head3 $help - -An entry in the Help system in the WebGUI namespace. This will be shown -as a link to the user. - -=cut - -sub _submenu { - my $session = shift; - my $workarea = shift; - my $title = shift; - my $i18n = WebGUI::International->new($session); - $title = $i18n->get($title) if ($title); - my $ac = WebGUI::AdminConsole->new($session,"statistics"); - if ($session->setting->get("trackPageStatistics")) { - $ac->addSubmenuItem( $session->url->page('op=viewStatistics'), $i18n->get(144)); - } - return $ac->render($workarea, $title); -} - -#---------------------------------------------------------------------------- - -=head2 canView ( session [, user] ) - -Returns true if the user can administrate this operation. user defaults to -the current user. - -=cut - -sub canView { - my $session = shift; - my $user = shift || $session->user; - return $user->isInGroup( $session->setting->get("groupIdAdminStatistics") ); -} - - -#------------------------------------------------------------------- - -=head2 www_disableSendWebguiStats () - -Deletes the workflow schedule that sends WebGUI statistics to webgui.org. - -=cut - -sub www_disableSendWebguiStats { - my $session = shift; - return $session->privilege->adminOnly() unless canView($session); - my $task = WebGUI::Workflow::Cron->new($session, 'send_webgui_statistics'); - $task->delete; - my $workflow = WebGUI::Workflow->new($session, 'send_webgui_statistics'); - $workflow->set({enabled => 0}); - return www_viewStatistics($session); -} - - -#------------------------------------------------------------------- - -=head2 www_enableSendWebguiStats () - -Creates the workflow schedule that sends WebGUI statistics to webgui.org. - -=cut - -sub www_enableSendWebguiStats { - my $session = shift; - return $session->privilege->adminOnly() unless canView($session); - # we set the current hour, minute, and day of week to send in the stats so we don't DOS webgui.org - # by having everybody sending it at the same time - my $dt = WebGUI::DateTime->new($session, time()); - WebGUI::Workflow::Cron->create($session, { - enabled => 1, - workflowId => 'send_webgui_statistics', - minuteOfHour => $dt->minute, - hourOfDay => $dt->hour, - dayOfWeek => ($dt->dow % 7), - dayOfMonth => '*', - monthOfYear => '*', - priority => 3, - title => 'Send WebGUI Statistics', - }, 'send_webgui_statistics'); - my $workflow = WebGUI::Workflow->new($session, 'send_webgui_statistics'); - $workflow->set({enabled => 1}); - return www_viewStatistics($session); -} - - -#------------------------------------------------------------------- - -=head2 www_viewStatistics ( $session, $sent ) - -Displays information to the user about WebGUI statistics if they are -in group Admin (3). - -=head3 Displayed information - -=over 4 - -=item * - -Newest WebGUI version. - -=item * - -Current WebGUI version, if different from newest. - -=item * - -Number of published assets. - -=item * - -Number of assets set to be packages. - -=item * - -Number of templates - -=item * - -Number of sessions - -=item * - -Number of users. - -=item * - -Number of groups. - -=back - -=cut - -sub www_viewStatistics { - my $session = shift; - return $session->privilege->adminOnly() unless canView($session); - my ($output, $data); - my $i18n = WebGUI::International->new($session); - - # Get the latest WebGUI version - my $url = "http://update.webgui.org/latest-version.txt"; - my $cache = $session->cache; - my $version = $cache->compute( $url, sub { - my $ua = LWP::UserAgent->new( - env_proxy => 1, - agent => "WebGUI/" . $WebGUI::VERSION, - timeout => 30, - ); - - my $r = $ua->get( $url ); - if ( $r->is_error ) { - $session->log->warn( "Could not get latest WebGUI version from '$url': " . $r->status_line ); - } - else { - return $r->decoded_content; - } - } ); - - $output .= '
| '.$i18n->get(145).': | '.$WebGUI::VERSION.'-'.$WebGUI::STATUS.' |
| '.$i18n->get(349).': | '.$version.' |
| '.$i18n->get(147).': | '.$data.' |
| '.$i18n->get(794).': | '.$data.' |
| '.$i18n->get(792).': | '.$data.' |
| '.$i18n->get(146).': | '.$data.' |
| '.$i18n->get(149).': | '.$data.' |
| '.$i18n->get(89).': | '.$data.' |
|.$i18n->get('why to send','Activity_SendWebguiStats').q|
|; - - my $task = WebGUI::Workflow::Cron->new($session, 'send_webgui_statistics'); - if (defined $task) { - $output .= q||.$i18n->get('disable','Activity_SendWebguiStats').q|
|; - } - else { - $output .= q||.$i18n->get('enable','Activity_SendWebguiStats').q|
|; - } - $output .= q||; - return _submenu($session,$output); -} - - -1; - diff --git a/lib/WebGUI/Wizard/Setup.pm b/lib/WebGUI/Wizard/Setup.pm index b7625dda5..5a8f965cf 100644 --- a/lib/WebGUI/Wizard/Setup.pm +++ b/lib/WebGUI/Wizard/Setup.pm @@ -22,7 +22,6 @@ sub _get_steps { return [qw( adminAccount companyInformation - siteStats defaultStyle )]; } @@ -296,58 +295,6 @@ sub www_companyInformationSave { #---------------------------------------------------------------------------- -=head2 www_siteStats ( ) - -Opt-in to the global WebGUI statistics - -=cut - -sub www_siteStats { - my ( $self ) = @_; - my $session = $self->session; - my $form = $session->form; - $session->response->setCacheControl("none"); - my $i18n = WebGUI::International->new( $session, "WebGUI" ); - - my $enableForm = $self->getForm; - $enableForm->addField( "hidden", name => "enableStats", value => 1 ); - $enableForm->addField( "submit", name => 'send', value => $i18n->get( 'enable', 'Activity_SendWebguiStats' ) ); - - my $disableForm = $self->getForm; - $disableForm->addField( "hidden", name => "enableStats", value => 0 ); - $disableForm->addField( "submit", name => 'send', value => $i18n->get( 'disable', 'Activity_SendWebguiStats' ) ); - - my $output = '' . $i18n->get( 'why to send', 'Activity_SendWebguiStats' ) . '
-' . $i18n->get( 'would you participate', 'Activity_SendWebguiStats' ) . '
-