PHP Web Host - Quality Web Hosting For All PHP Applications Free RavenNuke(tm) Add Ons
  Login or Register
 • Home • Downloads • Your Account • Forums • 

View next topic
View previous topic


Google
 
Web RavenPHPScripts (This Site)
Post new topic   Reply to topic
Author Message
spasticdonkey
RavenNuke(tm) Development Team


Joined: Dec 02, 2006
Posts: 1251
Location: Texas, USA

PostPosted: Tue Feb 10, 2009 3:20 pm Reply with quote Back to top

This Ms-Analysis Cron Job script broke under RN2.3, was working under RN until then. Probably something simple with the include path but after a few attempts no luck, so here I am Smile

modules/MS_Analysis/include/cronmaintenance.php
Code:
global $prefix, $db;

// Set time limit and ignore user abort
if( !get_cfg_var('safe_mode') )
{
   @set_time_limit( 300 );
   @ignore_user_abort( 1 );
}

// Next setting ($forum_admin) is needed so that PHP-Nuke finds the required files in the correct path
define('FORUM_ADMIN', true);
require_once("../../../config.php");
require_once("../../../db/db.php");
// END: Next setting ($forum_admin) is needed so that PHP-Nuke finds the required files in the correct path

// Load Admin Settings
$result = $db->sql_query( "select curdate, staticupdate, GMT_offset, allow_pruning from $prefix"._msanalysis_admin." where id='1'" );
$MSArow = $db->sql_fetchrow( $result );

// Compose LOCAL Timestamp   
$MSAdata[current] = -1 * ( date( "Z" ) / 3600 );
$MSAdata[zonedate] = mktime(date('H'), date('i'), date('s'), date('n'), date('j'), date('Y'), -1) + ( ( $MSAdata[current] + $MSArow[GMT_offset] ) * 3600 );
$MSAdata[logdate] = date( "Y-m-d H:i:s", $MSAdata[zonedate] );
$MSAdata[slogdate] = date( "Y-m-d", $MSAdata[zonedate] );

// Set last update time
$db->sql_query( "update $prefix"._msanalysis_admin." set lastupdate = '$MSAdata[logdate]' where id='1'" );

// Carry out maintenance every hour (by cron deamon)
if( $MSArow[staticupdate] ) {
   require_once( "class.maintenance.php" );    // Routine Classes for tracker
   $msamainteneance = new msa_maintenance();
   $msamainteneance->hourly_maintenance( $MSAdata[slogdate] );
}
   
// Every day default clear the hits for this day. If set, also prune MS-Tables
if( $MSAdata[slogdate] != $MSArow[curdate] ) {
   if( $MSArow[staticupdate] ) {
      // Set new logdate in Admin Table
      $db->sql_query( "update $prefix"._msanalysis_admin." set curdate='$MSAdata[slogdate]' where id = '1'" );
      require_once( "class.maintenance.php" );    // Routine Classes for tracker
      $msamainteneance = new msa_maintenance( );
      $msamainteneance->daily_maintenance( );
      if( $MSArow[allow_pruning] ) $msamainteneance->pruning_maintenance( );
   }
}

unset( $MSAdata );

Heres the full download if needed
Only registered users can see links on this board!
Get registered or login to the forums!
View user's profile Send private message
kguske
Site Admin


Joined: Jun 04, 2004
Posts: 5997

PostPosted: Tue Feb 10, 2009 9:58 pm Reply with quote Back to top

Forum files moved, and your error log will most likely tell you the exact problem, which might be outside this script.
View user's profile Send private message
spasticdonkey
RavenNuke(tm) Development Team


Joined: Dec 02, 2006
Posts: 1251
Location: Texas, USA

PostPosted: Tue Feb 10, 2009 11:58 pm Reply with quote Back to top

thanks, that gives me a place to start Smile
View user's profile Send private message
spasticdonkey
RavenNuke(tm) Development Team


Joined: Dec 02, 2006
Posts: 1251
Location: Texas, USA

PostPosted: Thu Feb 12, 2009 7:23 am Reply with quote Back to top

well it ended up being that the script is calling config.php directly without calling mainfile, so it wasnt loading rnconfig, as per this post:
Only registered users can see links on this board!
Get registered or login to the forums!


changing line 95 in config.php to
if(!defined('INCLUDE_PATH')) define('INCLUDE_PATH', '');
got it working again
View user's profile Send private message
kguske
Site Admin


Joined: Jun 04, 2004
Posts: 5997

PostPosted: Thu Feb 12, 2009 7:41 am Reply with quote Back to top

I'm wondering if that might affect your other functions. Maybe you could add that line to the msanalysis script before it includes config.php?
View user's profile Send private message
spasticdonkey
RavenNuke(tm) Development Team


Joined: Dec 02, 2006
Posts: 1251
Location: Texas, USA

PostPosted: Thu Feb 12, 2009 8:30 am Reply with quote Back to top

yes that worked and is a much better solution Smile
View user's profile Send private message
draxx
Worker
Worker


Joined: Nov 19, 2003
Posts: 186

PostPosted: Mon Apr 13, 2009 5:08 pm Reply with quote Back to top

I loved it but MS Analysis is soooooooo insecure you do know that right?
View user's profile Send private message
Display posts from previous:       
Post new topic   Reply to topic

View next topic
View previous topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Forums ©
 

All logos and trademarks in this site are property of their respective owner.
The comments are property of their posters, all the rest © 2002-2011 by Raven

You can syndicate our news using the file xml

CSE HTML Validator Helped Clean up This Page! [Valid RSS] valid RSS 2.0 Valid robots.txt Stop Spam Harvesters, Join Project Honey Pot

Website engines core code is © copyright by PHP-Nuke but has been heavily patched and modified by myself and others.
PHP-Nuke is a free software released under the GNU/GPL.


:: fisubice phpbb2 style by Daz :: PHP-Nuke theme by www.nukemods.com ::
:: fisubice Theme Modified by the RavenNuke™ Team ::

:: W3C CSS Compliance Validation :: W3C HTML 4.01 Transitional Compliance Validation ::

zerosum