The Arcive of vBulletin Modifications Site. |
|
|
#1
|
|||
|
|||
|
ok i made a script the delete info from some table,
now i added it to corn in admin cp to run every 1st of month its apper like that Code:
30 0 1 * * ![]() when i click on run now its works like a charm but its dosent work alone also in next time it says : 02-28-2005 11:30 PM but date now is 06/03 and script didnt runned yet any idea what might be the problem thanks MiZ |
|
#2
|
|||
|
|||
|
bump
please help... not supuse to be that hard |
|
#3
|
|||
|
|||
|
Try posting the script. The scheduled tasks can be a bit tricky sometimes, had to learn that the hard way myself. Sometimes things run ok with Run Now, but fail when run scheduled.
|
|
#4
|
|||
|
|||
|
ok
here is the info of the file scoreboardupdate.php ================= Code:
error_reporting(E_ALL & ~E_NOTICE);
if (!is_object($DB_site))
{
exit;
}
// Score board , Award system , Ratio system
// looking for a winner
$scorewinner =$DB_site->query("SELECT * FROM ".TABLE_PREFIX."user order by tmsecs Desc limit 1");
while ($scorewins = $DB_site->fetch_array($scorewinner)) {
$totaltmsecs = $scorewins['tmsecs'];
$winnername = $scorewins['username'];
$winnerid = $scorewins['userid'];
$lastmonth = $scorewins['tmsecs'];;
}
// clear last month modes
$DB_site->query("UPDATE ".TABLE_PREFIX."useraward SET award1 = '0'");
// set new award winner
$DB_site->query("UPDATE ".TABLE_PREFIX."useraward SET award1 = '1' where userid='$winnerid'");
// upadte user ratio
$DB_site->query("UPDATE ".TABLE_PREFIX."user SET credit =credit+50 where userid='$winnerid' ");
// update winner last month secs
$DB_site->query("UPDATE ".TABLE_PREFIX."user SET lmsecs ='$lastmonth' where userid='$winnerid'");
// clear all tmsecs of users
$DB_site->query("UPDATE ".TABLE_PREFIX."user SET tmsecs = 0");
$DB_site->query("TRUNCATE TABLE ".TABLE_PREFIX."`scoreboard`");
log_cron_action('Scoreboard Updated', $nextitem);
|
|
#5
|
|||
|
|||
|
I don't see a good reason why it should not run in cron. Did you check if you maybe got a SQL-error mail?
A few remarks though: - The table useraward, does it contain all users? If not the new winner might fail if it is the first time someone wins. - No need to use quotes around numeric values in queries, only cast the value to an INT if it is a dirty value (user inputed). - Not sure if that truncate statement will work correct when a table prefix is used, because of the back-tics. - Does the run get logged in the cron-log? |
|
#6
|
|||
|
|||
|
when i run the script with run now button its work perfect
and when i click on run now its get logged but else its just not working. script working great as script but on corn its not get executed |
|
#7
|
|||
|
|||
|
Well if it gets logged, then it is executed without a SQL-error.
Will try to look at it tomorrow (hmm why this sentence sounds familiar, hmmm think i forgot to do some things i promosed to do today )What about the table being populated with all userids before the script is run? |
|
#8
|
|||
|
|||
|
what about it >
|
|
#9
|
|||
|
|||
|
Does the useraward table already have an entry for every existing userid in it?
PHP Code:
|
|
#10
|
|||
|
|||
|
well then it shows as
USERID : 54 AWARD1 : 0 same for all users |
![]() |
|
|
| X vBulletin 3.8.12 by vBS Debug Information | |
|---|---|
|
|
More Information |
|
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|