This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm whether you accept or reject these cookies being set.

A cookie will be stored in your browser regardless of choice to prevent you being asked this question again. You will be able to change your cookie settings at any time using the link in the footer.

Webalizer Stats - Centos 7 - Working Fix
#11
[Not Solved] RE: Webalizer Stats - Centos 7 - Working Fix
(11-11-2018, 05:31 AM)worksmarter Wrote: I have always had this issue. Changing the code listed above did nothing for webalizer properly labeling the domain rather than the panel domain on the page.

Any ideas?

You will have to give us more of a clue than that... which code did you change, exactly?

Paste the contents of this file into your reply (if you're on Debian/Ubuntu you may need to change the path as I'm not sure where the file will be):


Code:
/etc/sentora/panel/modules/webalizer_stats/hooks/OnDaemonHour.hook.php


Also, after you've made the change, allow 5-10 minutes for the 5-minute Daemon to run (or more if you have changed it to run less frequently), and close your browser then open it again before checking. If you've already visited the Webalizer Stats pages, I found my browser was caching them and not letting me see them correctly until I restarted it.

Keith
Reply
Thanks given by:
#12
[Not Solved] RE: Webalizer Stats - Centos 7 - Working Fix
(11-11-2018, 10:17 AM)fearworks Wrote: You will have to give us more of a clue than that... which code did you change, exactly?

Paste the contents of this file into your reply (if you're on Debian/Ubuntu you may need to change the path as I'm not sure where the file will be):


Code:
/etc/sentora/panel/modules/webalizer_stats/hooks/OnDaemonHour.hook.php


Also, after you've made the change, allow 5-10 minutes for the 5-minute Daemon to run (or more if you have changed it to run less frequently), and close your browser then open it again before checking. If you've already visited the Webalizer Stats pages, I found my browser was caching them and not letting me see them correctly until I restarted it.

Keith

The code below - (@ /etc/sentora/panel/modules/webalizer_stats/hooks/OnDaemonHour.hook.php) and I ran the daemon. Nothing has changed, webalyzer when selecting a domain still shows the URL of the Sentora control panel.

Code:
<?php

/**
* @copyright 2014-2015 Sentora Project (http://www.sentora.org/)
* Sentora is a GPL fork of the ZPanel Project whose original header follows:
*
* ZPanel - Visitor Stats zpanel plugin, written by RusTus: www.zpanelcp.com.
*
* changes P;Peyremorte : reduced duplicate strings constructions
*/
echo fs_filehandler::NewLine() . "BEGIN Webalizer Stats" . fs_filehandler::NewLine();
if ( ui_module::CheckModuleEnabled( 'Webalizer Stats' ) ) {
   GenerateWebalizerStats();
}
else {
   echo "Webalizer Stats Module DISABLED." . fs_filehandler::NewLine();
}
echo "END Webalizer Stats" . fs_filehandler::NewLine();

function GenerateWebalizerStats()
{
   global $zdbh;
   $sql      = $zdbh->prepare( "SELECT * FROM x_vhosts LEFT JOIN x_accounts ON x_vhosts.vh_acc_fk=x_accounts.ac_id_pk WHERE vh_deleted_ts IS NULL" );
   $sql->execute();
   echo "Generating webalizer stats html..." . fs_filehandler::NewLine();
   while ( $rowvhost = $sql->fetch() ) {
     $basedir = ctrl_options::GetSystemOption( 'sentora_root' ) . "modules/webalizer_stats/stats/" . $rowvhost[ 'ac_user_vc' ] . "/" . $rowvhost[ 'vh_name_vc' ];
     if ( !file_exists( $basedir ) ) {
         @mkdir( $basedir, 0755, TRUE );
       }

       /** set webalizer command dependant on OS */
       if ( sys_versions::ShowOSPlatformVersion() == "Windows" ) {
           $command = ctrl_options::GetSystemOption( 'sentora_root' ) .
               'modules/webalizer_stats/bin/webalizer.exe';
       }
       else {
           chmod( ctrl_options::GetSystemOption( 'sentora_root' ) . "modules/webalizer_stats/bin/webalizer", 4777 );
           $command = "webalizer";
       }

       /** all other args and flags are the same so keep them outsite to avoid duplication */
       $flag        = '-o';

       $secondFlags = '-d -F clf';

       $domain = '-n' . $rowvhost[ 'vh_name_vc' ];

       $logFile = realpath( ctrl_options::GetSystemOption( 'log_dir' ) .
           'domains/' .
           $rowvhost[ 'ac_user_vc' ] .
           '/' .
           $rowvhost[ 'vh_name_vc' ] .
           '-access.log' );

       $statsPath = ctrl_options::GetSystemOption( 'sentora_root' ) .
           "modules/webalizer_stats/stats/" .
           $rowvhost[ 'ac_user_vc' ] .
           '/' .
           $rowvhost[ 'vh_name_vc' ];

       /** build arg array, this is in the required order! do not just change the order of this array */
       $args = array(
           $logFile,
           $domain,
           $flag,
           $statsPath,
           $secondFlags,
       );

       echo "Generating stats for: " . $rowvhost[ 'ac_user_vc' ] . "/" . $rowvhost[ 'vh_name_vc' ] . fs_filehandler::NewLine();
       $returnValue = ctrl_system::systemCommand( $command, $args );
       echo (0 === $returnValue ? 'Succeeded' : 'Failed') . fs_filehandler::NewLine();
   }
}

?>

This simply does not help the problem. All that I did not do was install webalyzer as it is already installed.

The following procedure is unnecessary as the file does not exist (because I didn't install webalyzer from scratch...)

Code:
rm -rf /etc/webalizer.conf
Everyone makes mistakes, but to truly screw up it takes the root password!
Reply
Thanks given by:
#13
[Not Solved] RE: Webalizer Stats - Centos 7 - Working Fix
(12-02-2018, 11:17 AM)worksmarter Wrote: The code below - (@ /etc/sentora/panel/modules/webalizer_stats/hooks/OnDaemonHour.hook.php) and I ran the daemon. Nothing has changed, webalyzer when selecting a domain still shows the URL of the Sentora control panel.

Code:
<?php

/**
* @copyright 2014-2015 Sentora Project (http://www.sentora.org/)
* Sentora is a GPL fork of the ZPanel Project whose original header follows:
*
* ZPanel - Visitor Stats zpanel plugin, written by RusTus: www.zpanelcp.com.
*
* changes P;Peyremorte : reduced duplicate strings constructions
*/
echo fs_filehandler::NewLine() . "BEGIN Webalizer Stats" . fs_filehandler::NewLine();
if ( ui_module::CheckModuleEnabled( 'Webalizer Stats' ) ) {
   GenerateWebalizerStats();
}
else {
   echo "Webalizer Stats Module DISABLED." . fs_filehandler::NewLine();
}
echo "END Webalizer Stats" . fs_filehandler::NewLine();

function GenerateWebalizerStats()
{
   global $zdbh;
   $sql      = $zdbh->prepare( "SELECT * FROM x_vhosts LEFT JOIN x_accounts ON x_vhosts.vh_acc_fk=x_accounts.ac_id_pk WHERE vh_deleted_ts IS NULL" );
   $sql->execute();
   echo "Generating webalizer stats html..." . fs_filehandler::NewLine();
   while ( $rowvhost = $sql->fetch() ) {
     $basedir = ctrl_options::GetSystemOption( 'sentora_root' ) . "modules/webalizer_stats/stats/" . $rowvhost[ 'ac_user_vc' ] . "/" . $rowvhost[ 'vh_name_vc' ];
     if ( !file_exists( $basedir ) ) {
         @mkdir( $basedir, 0755, TRUE );
       }

       /** set webalizer command dependant on OS */
       if ( sys_versions::ShowOSPlatformVersion() == "Windows" ) {
           $command = ctrl_options::GetSystemOption( 'sentora_root' ) .
               'modules/webalizer_stats/bin/webalizer.exe';
       }
       else {
           chmod( ctrl_options::GetSystemOption( 'sentora_root' ) . "modules/webalizer_stats/bin/webalizer", 4777 );
           $command = "webalizer";
       }

       /** all other args and flags are the same so keep them outsite to avoid duplication */
       $flag        = '-o';

       $secondFlags = '-d -F clf';

       $domain = '-n' . $rowvhost[ 'vh_name_vc' ];

       $logFile = realpath( ctrl_options::GetSystemOption( 'log_dir' ) .
           'domains/' .
           $rowvhost[ 'ac_user_vc' ] .
           '/' .
           $rowvhost[ 'vh_name_vc' ] .
           '-access.log' );

       $statsPath = ctrl_options::GetSystemOption( 'sentora_root' ) .
           "modules/webalizer_stats/stats/" .
           $rowvhost[ 'ac_user_vc' ] .
           '/' .
           $rowvhost[ 'vh_name_vc' ];

       /** build arg array, this is in the required order! do not just change the order of this array */
       $args = array(
           $logFile,
           $domain,
           $flag,
           $statsPath,
           $secondFlags,
       );

       echo "Generating stats for: " . $rowvhost[ 'ac_user_vc' ] . "/" . $rowvhost[ 'vh_name_vc' ] . fs_filehandler::NewLine();
       $returnValue = ctrl_system::systemCommand( $command, $args );
       echo (0 === $returnValue ? 'Succeeded' : 'Failed') . fs_filehandler::NewLine();
   }
}

?>

This simply does not help the problem. All that I did not do was install webalyzer as it is already installed.

The following procedure is unnecessary as the file does not exist (because I didn't install webalyzer from scratch...)

Code:
rm -rf /etc/webalizer.conf

Please manually run the daemon:


Code:
php -q /etc/sentora/panel/bin/daemon.php


and copy/paste the output (send in a PM if you don't want your domains to be public, but please don't censor anything).

Keith.
Reply
Thanks given by:
#14
[Not Solved] RE: Webalizer Stats - Centos 7 - Working Fix
(12-02-2018, 08:31 PM)fearworks Wrote: Please manually run the daemon:


Code:
php -q /etc/sentora/panel/bin/daemon.php


and copy/paste the output (send in a PM if you don't want your domains to be public, but please don't censor anything).

Keith.

PM sent.
Everyone makes mistakes, but to truly screw up it takes the root password!
Reply
Thanks given by:
#15
[Not Solved] RE: Webalizer Stats - Centos 7 - Working Fix
(12-03-2018, 06:32 AM)worksmarter Wrote: PM sent.

I have replied.

Keith.
Reply
Thanks given by:
#16
[Not Solved] RE: Webalizer Stats - Centos 7 - Working Fix
Thanks, derailed by an errant ":" and I can't believe I did not notice it!  Angry

Thanks.
Everyone makes mistakes, but to truly screw up it takes the root password!
Reply
Thanks given by:
#17
[Not Solved] RE: Webalizer Stats - Centos 7 - Working Fix
(12-03-2018, 10:38 AM)worksmarter Wrote: Thanks, derailed by an errant ":" and I can't believe I did not notice it!  Angry

Thanks.

So, just to clarify - the code fix does work, so long as you copy and paste it correctly Big Grin

Keith
Reply
Thanks given by:
#18
[Not Solved] RE: Webalizer Stats - Centos 7 - Working Fix
(12-03-2018, 04:37 PM)fearworks Wrote: So, just to clarify - the code fix does work, so long as you copy and paste it correctly Big Grin

Keith

Yes Keith, the patch works fine providing you don't copy and paste it incorrectly.

Douglas
Everyone makes mistakes, but to truly screw up it takes the root password!
Reply
Thanks given by:


Possibly Related Threads...
Thread Author Replies Views Last Post
DNS Stopped Working hthiers 3 137 05-10-2019, 06:00 AM
Last Post: hthiers
Port 80 Redirect to 443 Not working condell 1 310 03-04-2019, 07:51 PM
Last Post: fearworks
Install ionCube on CentOS-7-x86_64-minimal 123highland 1 1,187 10-20-2018, 05:43 AM
Last Post: james30263

Forum Jump:


Users browsing this thread: 1 Guest(s)