Page 6 of 35

Re: [MOD] - VirtualQMod - Virtual Modification System

Posted: Fri Jan 14, 2011 12:34 am
by Qphoria
qahar wrote:(i don't like the sound of vQmod Mods :laugh: )
yea if I could go back and change the name I might :)
I usually call them "vQmod scripts"

Re: [MOD] - VirtualQMod - Virtual Modification System

Posted: Fri Jan 14, 2011 1:56 am
by marc_cole
Hey Q,

I'd like to see a way to organize all the files and directories associated with VQMod. Right now there are 5 items in my root directory; vqcache, vqmod, vqmod.log, vqmod.php, vqprotect.txt. Could these be put in their own directory, perhaps in 'system', so the root directory is kept as clean as possible?

BTW, I really like the new version, especially:
- New "all" position to replace entire file
- Protected file list
- Added divider lines to logging

Thanks,
Marc

Re: [MOD] - VirtualQMod - Virtual Modification System

Posted: Fri Jan 14, 2011 2:19 am
by Qphoria
Yea i thought about having a parent "vqmod" folder and then inside that have
/mods/*.xml
/cache/
/vqmod.log
/vqmod.php

inside that, but that will of course break the current setup so I've refrained from doing so, But you are right, vqmod is starting to take over more than its share

Re: [MOD] - VirtualQMod - Virtual Modification System

Posted: Fri Jan 14, 2011 2:30 am
by marc_cole
Qphoria wrote:but that will of course break the current setup so I've refrained from doing so
You're right, but it's early enough in it's existence that, if you're going to do it, now is the time. If you wait until everyone finds out about it, Oy! :choke:

Re: [MOD] - VirtualQMod - Virtual Modification System

Posted: Fri Jan 14, 2011 2:34 am
by Qphoria
Actually I could move it like this:

Code: Select all

/vqmod
    /vqcache/
    /vqlog/
    /*.xml
without breaking anything.

You could even do that now.

1. EDIT: vqmod.php

2. FIND:

Code: Select all

public $logFilePath = './vqmod.log';
3. REPLACE WITH:

Code: Select all

public $logFilePath = './vqmod/vqlog/vqmod.log';
4. FIND:

Code: Select all

private $vqCacheDir = 'vqcache';
5. REPLACE WITH

Code: Select all

private $vqCacheDir = 'vqmod/vqcache';
6. FIND:

Code: Select all

public $protectedFilelist = 'vqprotect.txt';
7. REPLACE WITH:

Code: Select all

public $protectedFilelist = 'vqmod/vqprotect.txt';

Re: [MOD] - VirtualQMod - Virtual Modification System

Posted: Fri Jan 14, 2011 2:48 am
by marc_cole
That works. I also put vqmod.php in the vqmod folder and changed the reference in index.php to require_once('./vqmod/vqmod.php'); and also in admin/index.php to require_once('../vqmod/vqmod.php');

So now I have:

Code: Select all

/vqmod
    /vqcache/
    /vqlog/vqmod.log
    /*.xml
    /vqmod.php
    /vqprotect.txt
Much cleaner!

Re: [MOD] - VirtualQMod - Virtual Modification System

Posted: Fri Jan 14, 2011 5:42 am
by Lao
I've done it too, I moved them all to a vqmod folder. One BIG question: how do you use "all" for replacing all content?

Re: [MOD] - VirtualQMod - Virtual Modification System

Posted: Fri Jan 14, 2011 5:46 am
by Qphoria
Lao wrote: One BIG question: how do you use "all" for replacing all content?
:rtfm: ;)

position="all"

Re: [MOD] - VirtualQMod - Virtual Modification System

Posted: Fri Jan 14, 2011 5:48 am
by Lao
Don't get mad, I know about <search position="all">, but do I put all contents that needs to be changed in the file between <![CDATA[ ]]> ?

I tried it this way with no luck.

Re: [MOD] - VirtualQMod - Virtual Modification System

Posted: Fri Jan 14, 2011 6:03 am
by Xsecrets
please we are already getting people trying to use it. PLEASE PLEASE PLEASE only use all as a last resort if you absolutely need to replace everything in a file. if everyone replaces the entire file everytime having more than one mod modifying the same file is going to become increasingly difficult, not to mention that if you are simply overwriting the file 10 times during load that can't be too good.

Re: [MOD] - VirtualQMod - Virtual Modification System

Posted: Fri Jan 14, 2011 6:06 am
by Qphoria
Xsecrets wrote:please we are already getting people trying to use it. PLEASE PLEASE PLEASE only use all as a last resort if you absolutely need to replace everything in a file. if everyone replaces the entire file everytime having more than one mod modifying the same file is going to become increasingly difficult, not to mention that if you are simply overwriting the file 10 times during load that can't be too good.
Yea.. it was actually a request from Lao that I added it. just leave the search tags empty and set position="all"
For top, bottom, and all positions, the search data is ignored

Re: [MOD] - VirtualQMod - Virtual Modification System

Posted: Fri Jan 14, 2011 6:23 am
by SapporoGuy
huh?

I thought this was a write once and then use that file from cache or whatever?

Re: [MOD] - VirtualQMod - Virtual Modification System

Posted: Fri Jan 14, 2011 6:35 am
by Xsecrets
SapporoGuy wrote:huh?

I thought this was a write once and then use that file from cache or whatever?
only if you turn caching on, but more than that if people just go erasing files and replacing them with whatever they feel like it then it is quite likely that any other mods will not work not to mention that if a mod that does it correctly gets applied first then someone comes along and does a replace all they will have just completely wiped out the other mod with no errors to show for it.

Re: [MOD] - VirtualQMod - Virtual Modification System

Posted: Fri Jan 14, 2011 7:52 am
by SapporoGuy
Thanks for the clarification.
That is awesome for modding! Now, I really am going to have to play with this!

However, I should have quoted X:
if you are simply overwriting the file 10 times during load that can't be too good.
So, I was wondering if vqm is being loaded per mod per page load ...

Re: [MOD] - VirtualQMod - Virtual Modification System

Posted: Fri Jan 14, 2011 8:54 am
by Qphoria
SapporoGuy wrote: So, I was wondering if vqm is being loaded per mod per page load ...
Looks like you gots some reading to do ;D

Re: [MOD] - VirtualQMod - Virtual Modification System

Posted: Fri Jan 14, 2011 4:19 pm
by qahar
Xsecrets wrote:but more than that if people just go erasing files and replacing them with whatever they feel like it then it is quite likely that any other mods will not work not to mention that if a mod that does it correctly gets applied first then someone comes along and does a replace all they will have just completely wiped out the other mod with no errors to show for it.
Is there any "sort order" for vQmod file that modificating the same file ?
And I think it will better if vQmod able to duplicate the file, make a new pseudo-file, search and replace. Rather than "replace all".
Qphoria wrote:
SapporoGuy wrote: So, I was wondering if vqm is being loaded per mod per page load ...
Looks like you gots some reading to do ;D
If SapporoGuy misunderstood these, what you think the other (i.e: me :laugh: ).
You need to make Quick Explanation and put it on first post. I will add it on file collection.

Re: [MOD] - VirtualQMod - Virtual Modification System

Posted: Fri Jan 14, 2011 9:00 pm
by Qphoria
qahar wrote: Is there any "sort order" for vQmod file that modificating the same file ?
TODO:
============
Add sortability based on filename (or master sort control list file)
qahar wrote: And I think it will better if vQmod able to duplicate the file, make a new pseudo-file, search and replace. Rather than "replace all".
It does normally. I just added the option to replace "all" for specific moments. I don't recommend using it unless you know what you are doing. In this case, the initial request was for the footer.tpl file. While he should have just replaced or overwrote that file, he wanted to try just swapping the contents on his own personal site. But I agree, this is not something developers who are pushing these out to others should ever use.

I had the idea to add the option to support eval() from the modfile so that depending on certain conditions, the <add> code could change. But I only see that as a major security hole and a nightmare so I'm going to leave it out.

Re: [MOD] - VirtualQMod - Virtual Modification System

Posted: Fri Jan 14, 2011 11:39 pm
by Xsecrets
Qphoria wrote:
qahar wrote: Is there any "sort order" for vQmod file that modificating the same file ?
TODO:
============
Add sortability based on filename (or master sort control list file)
qahar wrote: And I think it will better if vQmod able to duplicate the file, make a new pseudo-file, search and replace. Rather than "replace all".
It does normally. I just added the option to replace "all" for specific moments. I don't recommend using it unless you know what you are doing. In this case, the initial request was for the footer.tpl file. While he should have just replaced or overwrote that file, he wanted to try just swapping the contents on his own personal site. But I agree, this is not something developers who are pushing these out to others should ever use.

I had the idea to add the option to support eval() from the modfile so that depending on certain conditions, the <add> code could change. But I only see that as a major security hole and a nightmare so I'm going to leave it out.
thank you for leaving out eval() that certainly would have opened up all kinds of security issues.

as for the all I still really don't like that it's in there it's like in an fps game you have three weapons available the pistol the sniper rifle and the bfg. Lots of people are going to just grab the bfg because it's easier for them and they don't have to think about aiming.

Besides you can always say in the case of the footer.tpl put <!-- at the top and --> at the bottom then add your code, which still poses the same problems as the all, but at least the developer still has to think, so I would say there is a little bit better chance they will only change what they need to.

Though that does bring up another question what happens if you do two bottom or two top additions on the same file in the same mod? Say for instance you did a bottom with "-->" then another bottom with "my crap here" would it add them both in the order that you put them in?

Re: [MOD] - VirtualQMod - Virtual Modification System

Posted: Fri Jan 14, 2011 11:42 pm
by Qphoria
Xsecrets wrote: Though that does bring up another question what happens if you do two bottom or two top additions on the same file in the same mod? Say for instance you did a bottom with "-->" then another bottom with "my crap here" would it add them both in the order that you put them in?
Yes, it does each operation individually and passes the newly changed data into the subsequent operations
so if the first bottom adds "-->" to the code, it takes that change and passes it as the new "source" for the next operation.
so then the second bottom adds "my new code" to the previous changes of the first operation

So the result will be:

Code: Select all

...........
...existing stuff...

-->
my new code

Re: [MOD] - VirtualQMod - Virtual Modification System

Posted: Sat Jan 15, 2011 12:07 am
by Qphoria
qahar wrote: If SapporoGuy misunderstood these, what you think the other (i.e: me :laugh: ).
You need to make Quick Explanation and put it on first post. I will add it on file collection.
Ok I cleaned up the first post to make it easier to understand (i hope):
http://forum.opencart.com/viewtopic.php ... 15#p120715