DragonPrime - LoGD Resource Community

Game Administration, Installation and Configuration => Game Administration Chat => Topic started by: Aeolus on March 09, 2014, 10:29:04 AM



Title: LoGD v1.1.2 Core Code - BUGS FIXED
Post by: Aeolus on March 09, 2014, 10:29:04 AM
Since this thread (http://dragonprime.net/index.php?topic=8677.msg104876;topicseen#new) ended up being locked, here's the version of 1.1.2 with all (or all that were found) bugs fixed, so it's basically just plug-and-play, with no hassles! ;D

http://dragonprime.net/index.php?module=Downloads;sa=dlview;id=1457 (http://dragonprime.net/index.php?module=Downloads;sa=dlview;id=1457)

EDIT: Two more modified files added, as well as a change log of all bug fixes in the file "BUG FIXES.txt". Same link. I may have missed some, let me know if I have.


Title: Re: LoGD v1.1.2 Download - BUGS FIXED
Post by: Nder' on March 09, 2014, 02:57:12 PM
Nice work. I missed a few of these  :-X


Title: Re: LoGD v1.1.2 Core Code - BUGS FIXED
Post by: Stephen.Kise on March 20, 2014, 06:19:09 AM
Did you fix that module pref bug?


Title: Re: LoGD v1.1.2 Core Code - BUGS FIXED
Post by: MarcTheSlayer on March 20, 2014, 08:22:37 AM
Which one, got a link?


Title: Re: LoGD v1.1.2 Core Code - BUGS FIXED
Post by: Aeolus on March 20, 2014, 08:27:48 AM
Which one, got a link?

This one (http://dragonprime.net/index.php?topic=12520.0), I believe. I think I did. I'll make sure I did, before it gets uploaded to DP.

EDIT: Affirmative, I did.


Title: Re: LoGD v1.1.2 Core Code - BUGS FIXED
Post by: Stephen.Kise on March 21, 2014, 01:57:01 AM
Which one, got a link?

This one (http://dragonprime.net/index.php?topic=12520.0), I believe. I think I did. I'll make sure I did, before it gets uploaded to DP.

EDIT: Affirmative, I did.

Lol not that one.


Title: Re: LoGD v1.1.2 Core Code - BUGS FIXED
Post by: Aeolus on March 21, 2014, 02:33:47 AM
Lol not that one.

I'm not a mind-reader; a link to the bug report would be nice, thanks


Title: Re: LoGD v1.1.2 Core Code - BUGS FIXED
Post by: Aeolus on March 26, 2014, 06:25:36 PM
No link?


Title: Re: LoGD v1.1.2 Core Code - BUGS FIXED
Post by: Stephen.Kise on March 26, 2014, 09:56:09 PM
No link?
Not required to provide one.


Title: Re: LoGD v1.1.2 Core Code - BUGS FIXED
Post by: Aeolus on March 26, 2014, 10:33:38 PM
No link?
Not required to provide one.

That's because Stephen thinks he's so clever and cryptic by hiding what others may need to know, he doesn't care about others.

As I said. ;D Don't mention it in the first place if you're not going to explain. However, since you have stated elsewhere that you've fixed it in your own version of the code, as per the license, I would like a copy of the fixed code. :D


Title: Re: LoGD v1.1.2 Core Code - BUGS FIXED
Post by: Stephen.Kise on March 27, 2014, 03:16:49 PM
No link?
Not required to provide one.

That's because Stephen thinks he's so clever and cryptic by hiding what others may need to know, he doesn't care about others.

As I said. ;D Don't mention it in the first place if you're not going to explain. However, since you have stated elsewhere that you've fixed it in your own version of the code, as per the license, I would like a copy of the fixed code. :D
No can do. Lost it :P


Title: Re: LoGD v1.1.2 Core Code - BUGS FIXED
Post by: Aeolus on March 27, 2014, 04:41:44 PM
No can do. Lost it :P

And you can't duplicate it? ;)


Title: Re: LoGD v1.1.2 Core Code - BUGS FIXED
Post by: Stephen.Kise on March 27, 2014, 04:49:04 PM
No can do. Lost it :P

And you can't duplicate it? ;)

cba


Title: Re: LoGD v1.1.2 Core Code - BUGS FIXED
Post by: Aeolus on March 27, 2014, 04:54:33 PM
Did you fix that module pref bug?

I assume you've mentioned it on DP before today, then? (Assuming by the content of the above quote.)


Title: Re: LoGD v1.1.2 Core Code - BUGS FIXED
Post by: Stephen.Kise on March 27, 2014, 05:56:34 PM
Did you fix that module pref bug?

I assume you've mentioned it on DP before today, then? (Assuming by the content of the above quote.)

Yeah. Compare install states of modules.


Title: Re: LoGD v1.1.2 Core Code - BUGS FIXED
Post by: Talisman on March 28, 2014, 05:58:07 PM
No link?
Not required to provide one.

That's because Stephen thinks he's so clever and cryptic by hiding what others may need to know, he doesn't care about others.

As I said. ;D Don't mention it in the first place if you're not going to explain. However, since you have stated elsewhere that you've fixed it in your own version of the code, as per the license, I would like a copy of the fixed code. :D
No can do. Lost it :P

Now that is hardly the spirit of this site, or it's purpose.

This isn't the place to be an ass about something like this.  If you know of something that should be fixed share it.  Otherwise go troll somewhere else because it isn't welcome here.


Title: Re: LoGD v1.1.2 Core Code - BUGS FIXED
Post by: Aeolus on March 29, 2014, 09:28:35 AM
Quote
"DragonPrime nerd: Compare the *_getmoduleinfo() of modules to the module_userprefs when a pref is removed."

So I'm assuming that when a pref is removed, it's not removed from the module_userprefs table... Not much of a bug, but something to look into.


Title: Re: LoGD v1.1.2 Core Code - BUGS FIXED
Post by: Stephen.Kise on March 29, 2014, 10:01:32 AM
Quote
"DragonPrime nerd: Compare the *_getmoduleinfo() of modules to the module_userprefs when a pref is removed."

So I'm assuming that when a pref is removed, it's not removed from the module_userprefs table... Not much of a bug, but something to look into.

"Not much of a bug" when there are 400-500 players that have a couple of prefs set which are non-existent as a module is updated. Those couple of prefs turn into 1,000-2,000 entries in what should be the second biggest table for your core.


Title: Re: LoGD v1.1.2 Core Code - BUGS FIXED
Post by: Aeolus on March 29, 2014, 12:52:10 PM
"Not much of a bug" when there are 400-500 players that have a couple of prefs set which are non-existent as a module is updated. Those couple of prefs turn into 1,000-2,000 entries in what should be the second biggest table for your core.

Perhaps you should be testing your modules on a dev server first, before moving it to your live server where you'll be removing the pref. ;)

Code:
<?php
function module_delete_oldvalues($table,$key) {
    require_once 
'lib/gamelog.php';
    
$total 0;
    
$res db_query("SELECT modulename FROM ".db_prefix('modules')." WHERE infokeys LIKE '%|$key|%'");
    while (
$row db_fetch_assoc($res)) {
        
$mod $row['modulename'];
        require_once 
"modules/{$mod}.php";
        
$func $mod."_getmoduleinfo";
        
$info $func();
        
$keys array_filter(array_keys($info[$key]), "module_pref_filter");
$keys array_map("addslashes"$keys);
        
$keys implode("','"$keys);
        if (
$keysdb_query("DELETE FROM ".db_prefix($table)." WHERE modulename='$mod' AND setting NOT IN ('$keys')");
        
$total += db_affected_rows();
    }
    
gamelog("Cleaned up $total old values in $table that don't exist anymore"'maintenance');
}

function 
module_pref_filter($a){ 
    return !
is_numeric($a);
}
?>

Code:
<?php
$tables 
= array('module_userprefs'=>'prefs','module_settings'=>'settings');
foreach (
$tables as $table=>$keymodule_delete_oldvalues($table,$key);
?>

Then toss the second block of code into newday_runonce.php (or somewhere similar).

Edit: This would also apply to the module_settings and module_objprefs tables, modified the code. (Not sure how to apply it to module_objprefs, but if anyone works it out, let me know.)


Title: Re: LoGD v1.1.2 Core Code - BUGS FIXED
Post by: Rohen on April 16, 2014, 03:13:33 AM
first of all thanks to TheDoctor for sharing this 1.1.2 Version.

following the licence i publish all stable changes of core files with the mentioned changes as you can see on this list.
The file can be found on http://www.lotgd.de/downloads/upgrade%201.1.2.7z (http://www.lotgd.de/downloads/upgrade%201.1.2.7z).

Changes in the lotgd.de files

As nightborn stated and when testing on our server loops with foreach are faster than while (list).
This may depent on the server self and the installed php version.

changes:
armor.php             - allow % to be a color tag
bank.php              - shorten the transfer-option if the user entered the correct target name
bio.php               - foreach change and superusers with edit_user flag gets no checkday (if you're only viewing a user you shouldn't get one)
create.php            - minlength of a name is a gamesetting, not fixed to a value of 3
creatures.php         - AI Script Entry only available for users with SQL rights (important for bigger admin teams) + foreach changes + bugs mentioned here http://dragonprime.net/index.php?topic=10381.0
dragon.php            - Changes from http://dragonprime.net/index.php?topic=12574.0 and foreach
healer.php            - Removed duplicated output row
lodge.php            - Entry allowed even if you've 0 dp's. Some lodge modules offers changes for free and cannot be accessed
logdnet.php            - foreach + added 1.2.0 Alpha as a valid version, since it's the last official version from dragonprime
mail.php            - width changes
motd.php            - Comments only available for loggedin users
payment.php            - Corrects the 1.1 header for paypal queries
prefs.php            - Replace split by explode, since 5.3 DEPRECATED
rawsql.php            - Changed the hook to allow altering the sql statement. This was done to prevent younger team members with sql rights to use delete or drop statements.
                  - Changes from http://dragonprime.net/index.php?topic=12510.0 to catch sql errors
stables.php            - Extent the $shemas-array like the $basetext array
lib\battle-buffs.php   - support for additional bufffields compatkmod, comdmgkmod,...
lib\charcleanup.php      - module changed to abort delete procedure
lib\creatures.php      - Support for level > 18
lib\events.php         - using explode instead of split (DEPRECATED since 5.3.0)
lib\expire_chars.php   - Userdelete ist limited to max. 250, hook for validating the user-delete is added
lib\forest.php         - Modified like a city to allow modules to change to texts. Needed for defining deserts and co.
lib\motd.php         - foreach and the feature edits by The Doctor http://dragonprime.net/index.php?topic=12289.0
lib\output.php         - added 2 functions to place a nav AFTER another
lib\pvplist.php         - clanrank-array replaced by function
lib\pvpsupport.php      - max. values for looseexp filtered
lib\systemmail.php      - added hook to handle systemmails within modules
lib\clan\clan_motd.php   - motd ability for all above clan_officer (nessessary for additional ranks by modules)
lib\clan\detail.php      - added rank "founder"
lib\clan\func.php      - Clanrank-color as function, not a fixed array
lib\graveyard\case_question.php - Show the inactive resurrection
lib\mail\case_default.php User can select the sorting of mails in old style or per sender
lib\mail\case_read.php   - Translate subject
lib\mail\case_write.php   - Added a Linkfield above the Textarea so users can add colors by click

modules\sethsong.php   - Color corrections in output text
modules\drinks\dohook.php-added a httpget option named 'caller' to support multiple drinks like season-depending ale/xmas-ale and so on
modules\drinks\run.php   - Caller-Changes like the line above.
modules\clannews.php   - Fixed args bug http://dragonprime.net/index.php?topic=12303.0


foreach instead of while list:
badnav.php
badword.php
companions.php
configuration.php
modules.php
mounts.php
newday.php
news.php
train.php
viewpetition.php
modules\dag\dohook.php
modules\drinks\install.php
lib\battle-skills.php
lib\bell_rand.php
lib\buffs.php
lib\censor.php
lib\dump_item.php
lib\errorhandler.php
lib\errorhandling.php
lib\experience.php
lib\http.php
lib\output_array.php
lib\php_generic_environment.php
lib\register_global.php
lib\saveuser.php
lib\show_backtrace.php
lib\showform.php
lib\spell.php
lib\stripslashes_deep.php
lib\tabledescriptor.php
lib\template.php
lib\tempstat.php
lib\user\user_edit.php
lib\user\user_save.php

modules with new functions:
modules\outhouse.php   - Extented to allow people write poems to the door. Texts partly in german
modules\raceelf.php      - Text changes on tradein - option. Source unknown
lib\case_haunt2.php      - Additional hook insered to prevent player a from haunting player b by changing the victimlist


Title: Re: LoGD v1.1.2 Core Code - BUGS FIXED
Post by: Aeolus on April 16, 2014, 04:53:01 AM
foreach instead of while list:
badnav.php
badword.php
companions.php
configuration.php
modules.php
mounts.php
newday.php
news.php
train.php
viewpetition.php
modules\dag\dohook.php
modules\drinks\install.php
lib\battle-skills.php
lib\bell_rand.php
lib\buffs.php
lib\censor.php
lib\dump_item.php
lib\errorhandler.php
lib\errorhandling.php
lib\experience.php
lib\http.php
lib\output_array.php
lib\php_generic_environment.php
lib\register_global.php
lib\saveuser.php
lib\show_backtrace.php
lib\showform.php
lib\spell.php
lib\stripslashes_deep.php
lib\tabledescriptor.php
lib\template.php
lib\tempstat.php
lib\user\user_edit.php
lib\user\user_save.php   - Additional hook insered to prevent player a from haunting player b by changing the victimlist

I would have sworn we PM'ed about a month ago, and I showed you how while list is actually faster than foreach.

Here's the test, in case you forgot. (http://www.timelordsonline.net/test.php) (Be sure to read the Total times foreach() is faster than while(list()) out of 10,000 times was: x note at the bottom - I've never seen it go above 10.)


Title: Re: LoGD v1.1.2 Core Code - BUGS FIXED
Post by: Rohen on April 16, 2014, 04:56:34 AM
You're right and i've done the test twice on other systems.
For that the warning, that this may depent on the server / software.
All i can see is that the game is running some times faster with foreach.
Nobody is forced to use the files i provide.

Edit:
it depends on the testcondition.

while(list($key,$val) = each($array)) ... is faster than foreach if you do a write operation on the array / values.
Otherwise foreach is significant faster if you only reads the data. Thats the most used on lotgd.


Title: Re: LoGD v1.1.2 Core Code - BUGS FIXED
Post by: Aeolus on April 16, 2014, 05:03:12 AM
while(list($key,$val) = each($array)) ... is faster than foreach if you do a write operation on the array / values.
Otherwise foreach is significant faster if you only reads the data. Thats the most used on lotgd.

Not necessarily. The test I used simply sums the values of an array with values from 1 to 1,000 to an external variable, no writing to the array or values, just reading each value. And strange. x10Hosting and WAMP both give the same results as HostGator (my own site's host).

You've done well, that's quite a few fixes. I'm confused about this, though:

rawsql.php            - Changed the hook to allow altering the sql statement. This was done to prevent younger team members with sql rights to use delete or drop statements.

Why would younger team members even have RawSQL if they don't know what they're doing? o.o If the owner gave such a flag to them without them having considerable knowledge, then I'm not sure that they should even be running a site. (Since you can do a lot of damage even without delete or drop statements.)


Title: Re: LoGD v1.1.2 Core Code - BUGS FIXED
Post by: Rohen on April 16, 2014, 05:06:33 AM
*points to the post above about the loop*

at rawsql:
the hook was already there and the people who have the flag knows what to do, but every one can make a mistake and killing the live-db makes only a lot of work...
So they asked for a posibility to prevent these type of error and i saw no performance issues on extending this.


Title: Re: LoGD v1.1.2 Core Code - BUGS FIXED
Post by: Aeolus on April 16, 2014, 05:09:54 AM
*points to the post above about the loop*

at rawsql:
the hook was already there and the people who have the flag knows what to do, but every one can make a mistake and killing the live-db makes only a lot of work...
So they asked for a posibility to prevent these type of error and i saw no performance issues on extending this.

*points to his post above that he edited about the loop*

Fair enough. xD I'm still confused about how someone can mistakenly type out "delete from modules" or "drop accounts", but we all have our bad days, I guess. ;D


Title: Re: LoGD v1.1.2 Core Code - BUGS FIXED
Post by: Nightborn on April 17, 2014, 10:46:53 AM
My benchmarks worked like that:

foreach($stack as $value) <-- best if you *only* need the $value, not $key - which is true in 95% of all lotgd while loops.

while is ok, but I would prefer foreach still.



Title: Re: LoGD v1.1.2 Core Code - BUGS FIXED
Post by: Rockie on May 13, 2014, 10:31:41 AM
Too bad I did not find this sooner, it would have saved a lot of headaches!  I do believe I will save a copy somewhere just in case. As always, great work Doc.


Title: Re: LoGD v1.1.2 Core Code - BUGS FIXED
Post by: Aeolus on May 13, 2014, 06:47:12 PM
Too bad I did not find this sooner, it would have saved a lot of headaches!  I do believe I will save a copy somewhere just in case. As always, great work Doc.

Glad to help. ;D Maybe it'll get an upload to the main download area in time, so it's easier to find.


Title: Re: LoGD v1.1.2 Core Code - BUGS FIXED
Post by: Cece on May 20, 2014, 11:21:36 AM
Doctor,
Did you remove some of the files when you edited the bugs. One of the ones that didn't make it over was multiple cities. I don't know if it was something you did OR an error between the chair in the keyboard. I managed to get it plugged in and all is great. I totally wish I would have found these edits before playing the with original one I downloaded. Thanks again to all of you who have worked to improve the core and general game-play.


Title: Re: LoGD v1.1.2 Core Code - BUGS FIXED
Post by: Aeolus on May 20, 2014, 04:12:16 PM
Doctor,
Did you remove some of the files when you edited the bugs. One of the ones that didn't make it over was multiple cities. I don't know if it was something you did OR an error between the chair in the keyboard. I managed to get it plugged in and all is great. I totally wish I would have found these edits before playing the with original one I downloaded. Thanks again to all of you who have worked to improve the core and general game-play.

No, I didn't. The cities module isn't in the core download - it's found in the recommended modules, meaning I can't delete something that wasn't there.


Title: Re: LoGD v1.1.2 Core Code - BUGS FIXED
Post by: Cece on May 20, 2014, 04:38:37 PM
Whelp, mystery solved, Scooby Doo! The error was indeed between the chair and the keyboard.


Title: Re: LoGD v1.1.2 Core Code - BUGS FIXED
Post by: Aeolus on January 07, 2015, 08:54:49 PM
Modified the first block of code to clear old prefs and settings (http://dragonprime.net/index.php?topic=12595.msg104971#msg104971) - updated for those who have yet to come across it, added to the download link for the bug-free core, and the edits for those who have already implented it are:

Replace:
Code:
<?php
$keys 
implode("','"array_filter(array_keys($info[$key]), "module_pref_filter"));

With:
Code:
<?php
$keys 
array_filter(array_keys($info[$key]), "module_pref_filter");
$keys array_map("addslashes"$keys);
$keys implode("','"$keys);

This is for settings and prefs with apostrophes.


Title: Re: LoGD v1.1.2 Core Code - BUGS FIXED
Post by: WereMagi on April 26, 2016, 06:57:37 PM
Coming back into playing Game Master with this, thanks Doctor for being MVP!


Title: Re: LoGD v1.1.2 Core Code - BUGS FIXED
Post by: Aeolus on April 29, 2016, 07:19:26 AM
Coming back into playing Game Master with this, thanks Doctor for being MVP!

No problems; welcome back!


Title: Re: LoGD v1.1.2 Core Code - BUGS FIXED
Post by: Aeolus on March 16, 2017, 07:13:54 AM
Dropbox has disabled direct links from the Public folder to people without a Dropbox account, so the link provided (a copy of the code originally uploaded to my Dropbox's Public folder) will no longer be working.

A quick fix to this, however, would be if the files were uploaded to the Downloads section of DragonPrime, as was requested three years ago.

Update: Disregard the first paragraph, found a hack to get the link working again. Second paragraph still applies, though.


Title: Re: LoGD v1.1.2 Core Code - BUGS FIXED
Post by: Talisman on March 17, 2017, 08:28:39 PM
http://dragonprime.net/index.php?module=Downloads;sa=dlview;id=1457

Thanks for making this available, Aeolus.  It can now be downloaded through DragonPrime as well. (yes, finally)


Title: Re: LoGD v1.1.2 Core Code - BUGS FIXED
Post by: Aeolus on March 18, 2017, 03:10:12 AM
http://dragonprime.net/index.php?module=Downloads;sa=dlview;id=1457

Thanks for making this available, Aeolus.  It can now be downloaded through DragonPrime as well. (yes, finally)

Amazing, thank you! ;D

© 2017 DragonPrime - LoGD Resource Community
Email Talisman: talisman -at- gmail.com
&oeXs)2U7=V BmܲV.U e=;p\}eG )Jj} C5EH7ˤH=j } mo|*Ŋw{drV_@IV>/- TFQJ׀̀Ve}l1,V O iNYx͘$e$;
Forums: Powered by SMF 1.1.21 | SMF © 2006-2007, Simple Machines