Post by drivenbyweb » Thu Aug 25, 2011 9:50 pm

My log file has a bunch of lines in it that say ---DELAYED WRITE---. Searched google and the forum but can seem to find what it means. Does anyone know?

Newbie

Posts

Joined
Mon Jul 25, 2011 3:25 am

Post by Qphoria » Thu Aug 25, 2011 10:17 pm

drivenbyweb wrote:My log file has a bunch of lines in it that say ---DELAYED WRITE---. Searched google and the forum but can seem to find what it means. Does anyone know?
That was a feature I added to avoid write locking. It means the vqcache file couldn't be written to in a timely manner and took up to 1 sec to be written. It typically means your host is slow. But does it still work?

Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by madimar » Thu Aug 25, 2011 11:50 pm

Qphoria wrote:
madimar wrote:
Qphoria wrote:Yes it is true, inline after/before would be good. But it can be done in a pseudo-way like I showed above.. by using replace and finding the line and replacing the same line with code after it. Since if that line changed anyway, it wouldn't match anyway so the same effect still happens.
I'm not sure I understood correctly. If you replace the line, you will have a different code in your file.
Adding directly in the file those str_replace operations (as in my example), mantains the original line unchanged in the file.
If all the other mods work in the same way, I think the conflict risk is minor even if not completely avoided.
Well no.. Think about it
You have to search "abc123"
and replace with "abc123-XYZ"

You are replacing the exact same code with the original code plus your new code.
And you are actually bound to rule since your search would have to match in the first place
So another script could use that same search tag without breaking anything

So If you had search "abc123"
and inline-after "-XYZ"
still resulting in "abc123-XYZ"
You'd still end up with all the same pieces of the puzzle
And another script could still search on the tag the same way.

It is 6 vs half-dozen.
Hmm, you convinced me... inline-after and replace (properly used) are equivalent.
What about my "experiment" of "str_replace or string concatenation - after" ? In this way, mainly for modified sql queries, if another mod applies a "not restricted" vqmod replace on the original text, maybe things can work without conflicts. Example

A) "standard vqmod"
1) First mod:
code:

Code: Select all

$sql = "abc123-XYZ";
vqmod search: 123 - replace 123-ABCD
result:

Code: Select all

$sql = "abc123-ABCD-XYZ";
2) Second mod:
code:

Code: Select all

$sql = "abc123-ABCD-XYZ";
(but supposed to be $sql = "abc123-XYZ";)
vqmod search: 123-XYZ - replace 123-XYZ-9999
result:
not match!

B) "madimar trick with str-replace"
1) First mod:
code:

Code: Select all

$sql = "abc123-XYZ";
vqmod search: $sql = "abc123-XYZ"; - after $sql = str-replace('123','123-ABCD' ,$sql);
result:

Code: Select all

$sql = "abc123-XYZ";
$sql = str-replace('123','123-ABCD' ,$sql);
equivalent to:
$sql = "abc123-ABCD-XYZ";

2) Second mod:
code:

Code: Select all

$sql = "abc123-XYZ";
$sql = str-replace('123','123-ABCD' ,$sql);
(but supposed to be $sql = "abc123-XYZ";)
vqmod search: 123-XYZ - replace 123-XYZ-9999
result:

Code: Select all

$sql = "abc123-XYZ-9999";
$sql = str-replace('123','123-ABCD' ,$sql);
equivalent to:
$sql = "abc123-ABCD-XYZ-9999";

Hmm... let me say, the modification conflict is avoided, even if the risk of mulfunction is still high, but maybe you are lucky and things work...

Any opinion about it?

-----------------------------------------------------------------------
My last mods: Partita IVA e CF | Pro EU VAT Number | Sales Agents | Pricelist Pro
-----------------------------------------------------------------------


User avatar
Active Member

Posts

Joined
Thu Sep 24, 2009 6:27 pm


Post by JAY6390 » Thu Aug 25, 2011 11:57 pm

Personally I try to have as little effect on the original code as I possibly can but sometimes it's inevitable that you are going to make changes that have the potential to screw up another mod/a mod will screw up your matches
In these situations, you just have to leave it be. You can't be held responsible for your mod not working with every other mod out there (take PC applications for example, they conflict on occasion - it just happens)

Image


User avatar
Guru Member

Posts

Joined
Wed May 26, 2010 11:47 pm
Location - United Kingdom

Post by madimar » Fri Aug 26, 2011 12:03 am

JAY6390 wrote:Personally I try to have as little effect on the original code as I possibly can but sometimes it's inevitable that you are going to make changes that have the potential to screw up another mod/a mod will screw up your matches
In these situations, you just have to leave it be. You can't be held responsible for your mod not working with every other mod out there (take PC applications for example, they conflict on occasion - it just happens)
Jay, you are perfectly right... but I'm incidentally personally work on some (3-4) indipendent vqmod mods. In same cases, with "standard" coding my mods conflict each other... :crazy:
So I tried to code these mods in order to not conflicting each other and the only way I currently found was that "complicate" one I was showing you...

Ok, you can't avoid conflict with the world of mods out there... but at least your own mods should be compatible!!! This is my situation!

-----------------------------------------------------------------------
My last mods: Partita IVA e CF | Pro EU VAT Number | Sales Agents | Pricelist Pro
-----------------------------------------------------------------------


User avatar
Active Member

Posts

Joined
Thu Sep 24, 2009 6:27 pm


Post by JAY6390 » Fri Aug 26, 2011 12:07 am

If your mods can't use the same code, then clearly there's a better way of doing what you are doing. It's hard to give an example without seeing the code, but there's always a way around conflicts

Image


User avatar
Guru Member

Posts

Joined
Wed May 26, 2010 11:47 pm
Location - United Kingdom

Post by JAY6390 » Fri Aug 26, 2011 12:10 am

Actually what you're suggesting you could in fact use the regex method to figure out I guess. regular expressions are flexible if you do them right, so you shouldn't have a problem using that

Image


User avatar
Guru Member

Posts

Joined
Wed May 26, 2010 11:47 pm
Location - United Kingdom

Post by Qphoria » Fri Aug 26, 2011 12:26 am

I think I see what you mean madimar,
But I think what Jay says kinda negates it...

It looks like your example is 2 mods that want to edit the same exact line in the same exact way, yeilding different results. But then the mods will have logical conflicts anyway.

if mod 1 says:
search: blue
replace: red

and mod 2 says
search: blue
replace: green

even if you tried some passive
str_replace(blue, red, $line)
str_replace(blue, gree, $line)

The end result is that those 2 mods do diff things to the same line are not compatible anyway.

Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by madimar » Fri Aug 26, 2011 1:39 am

Qphoria wrote:I think I see what you mean madimar,
But I think what Jay says kinda negates it...

It looks like your example is 2 mods that want to edit the same exact line in the same exact way, yeilding different results. But then the mods will have logical conflicts anyway.

if mod 1 says:
search: blue
replace: red

and mod 2 says
search: blue
replace: green

even if you tried some passive
str_replace(blue, red, $line)
str_replace(blue, gree, $line)

The end result is that those 2 mods do diff things to the same line are not compatible anyway.
hmm... ;-) hope not annoying... if yes, please tell me... I will stop! Actually I'm saying :
str_replace(blue, blue red, $line)
str_replace(blue, blue green, $line)
result: blue green red

My typical case is in some mysql query, where I could typically need to add some fields to be select.

See please me original example (slightly modified):

Code: Select all

<operation>
            <search position="after"><![CDATA[
      $sql = "SELECT o.order_id, CONCAT(o.firstname, ' ', o.lastname) AS customer, (SELECT os.name FROM " . DB_PREFIX . "order_status os WHERE os.order_status_id = o.order_status_id AND os.language_id = '" . (int)$this->config->get('config_language_id') . "') AS status, o.total, o.currency_code, o.currency_value, o.date_added, o.date_modified FROM `" . DB_PREFIX . "order` o";
         ]]></search>
            <add><![CDATA[
      // madimar mod   
      $sql = str_replace (' FROM `', ', sr.name AS sales_rep FROM `', $sql);
      // madimar mod end      
         ]]></add>
        </operation>
Other mod:

Code: Select all

<operation>
            <search position="after"><![CDATA[
      $sql = "SELECT o.order_id, CONCAT(o.firstname, ' ', o.lastname) AS customer, (SELECT os.name FROM " . DB_PREFIX . "order_status os WHERE os.order_status_id = o.order_status_id AND os.language_id = '" . (int)$this->config->get('config_language_id') . "') AS status, o.total, o.currency_code, o.currency_value, o.date_added, o.date_modified FROM `" . DB_PREFIX . "order` o";
         ]]></search>
            <add><![CDATA[
      // madimar mod   
      $sql = str_replace (' FROM `', ', newfield AS newfield FROM `', $sql);
      // madimar mod end      
         ]]></add>
        </operation>
Final result is equivalent to:

$sql = "SELECT o.order_id, CONCAT(o.firstname, ' ', o.lastname) AS customer, (SELECT os.name FROM " . DB_PREFIX . "order_status os WHERE os.order_status_id = o.order_status_id AND os.language_id = '" . (int)$this->config->get('config_language_id') . "') AS status, o.total, o.currency_code, o.currency_value, o.date_added, o.date_modified, sr.name AS sales_rep, newfield AS newfield FROM `" . DB_PREFIX . "order` o";

.... for my own mods maybe I could do the same also with vqmod replace... :drunk: but a 3rd pty mod could try to search for that entire original line without matching it. :drunk: :drunk: :drunk:

-----------------------------------------------------------------------
My last mods: Partita IVA e CF | Pro EU VAT Number | Sales Agents | Pricelist Pro
-----------------------------------------------------------------------


User avatar
Active Member

Posts

Joined
Thu Sep 24, 2009 6:27 pm


Post by JAY6390 » Fri Aug 26, 2011 1:47 am

The point is however that you shouldn't be searching for the entire line, and that's also why I suggested regex integration earlier on in the development. You could probably find a string a lot smaller than that that's still unique to that file, and add both in. This is why indexes are used too, so you can generalise the search, and home in on the right one using the index value

Image


User avatar
Guru Member

Posts

Joined
Wed May 26, 2010 11:47 pm
Location - United Kingdom

Post by drivenbyweb » Fri Aug 26, 2011 1:52 am

Qphoria wrote:
drivenbyweb wrote:My log file has a bunch of lines in it that say ---DELAYED WRITE---. Searched google and the forum but can seem to find what it means. Does anyone know?
That was a feature I added to avoid write locking. It means the vqcache file couldn't be written to in a timely manner and took up to 1 sec to be written. It typically means your host is slow. But does it still work?
It works great. I'm working locally as the only user and this machine is plenty fast enough. Is there anything in the formatting of the XML files that causes this to happen or is it just PHP and the OS?

Newbie

Posts

Joined
Mon Jul 25, 2011 3:25 am

Post by JAY6390 » Fri Aug 26, 2011 1:56 am

This also happens as a result of ajax calls running while your script is still running, and can cause an issue

Image


User avatar
Guru Member

Posts

Joined
Wed May 26, 2010 11:47 pm
Location - United Kingdom

Post by affect » Fri Aug 26, 2011 10:08 pm

Trying to install latest vQmod via autoinstaller per opencart_install.txt.

All I'm getting is the "VQMOD HAS BEEN INSTALLED ON YOUR SYSTEM!" every time I run the installer, nothing more. Nothing in server error logs, no new files in vqmod folder, nothing in vqcache either. Example mods don't seem to work, at least I'm not getting anything at all neither by using helloworld example nor other xml files from examples folder.

Tried both 775 and 777 to vqmod and vqcache, also tried both recursively.

Can't read 32 pages of discussion here at the moment, what could be the problem?

MultiMerch Marketplace for OpenCart

Image


User avatar
Active Member

Posts

Joined
Sat Aug 13, 2011 5:04 pm


Post by JAY6390 » Fri Aug 26, 2011 10:14 pm

Have you checked the index.php files to see if they have been overwritten? Just look for vQmod in the first 20 lines of the file. If its not there, then the problem lies with their permissions. Try setting them to 644 while you install it

Image


User avatar
Guru Member

Posts

Joined
Wed May 26, 2010 11:47 pm
Location - United Kingdom

Post by affect » Fri Aug 26, 2011 10:43 pm

Actually it looks like the problem was in permissions indeed, but not in vqmod's permissions rather than in index.php which wasn't writable. Somehow I haven't thought about it from the beginning. Would be nice if there was a line about it in the opencart_install.txt.

UPD:
Just noticed admin/index.php needs to be writable too and since it wasn't it didn't get changed. Actually it would be cool if there was an is_writable check or something and an error message about permissions in the installer.

MultiMerch Marketplace for OpenCart

Image


User avatar
Active Member

Posts

Joined
Sat Aug 13, 2011 5:04 pm


Post by JAY6390 » Fri Aug 26, 2011 10:47 pm

Yeah, there does need to be that added to it. For vQmod 2.0 it will be done

Image


User avatar
Guru Member

Posts

Joined
Wed May 26, 2010 11:47 pm
Location - United Kingdom

Post by Qphoria » Sat Aug 27, 2011 12:11 am

Yea the installer doesn't check file permission on the index.php file. Jay. fix it!

Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by JAY6390 » Sat Aug 27, 2011 12:18 am

I'd rather not use expletives to reply to that comment, so I'll simply say "do one, guvna"

Image


User avatar
Guru Member

Posts

Joined
Wed May 26, 2010 11:47 pm
Location - United Kingdom

Post by Johnathan » Sat Aug 27, 2011 8:01 am

Qphoria wrote:Yea the installer doesn't check file permission on the index.php file. Jay. fix it!
JAY6390 wrote:I'd rather not use expletives to reply to that comment, so I'll simply say "do one, guvna"
You two sound like a (slightly odd) married couple. :laugh:

Image Image Image Image Image


User avatar
Administrator

Posts

Joined
Fri Dec 18, 2009 3:08 am


Post by JAY6390 » Sat Aug 27, 2011 8:32 am

He asked, but I couldn't bring myself to say "I do" so we're just odd I'm afraid :)

Image


User avatar
Guru Member

Posts

Joined
Wed May 26, 2010 11:47 pm
Location - United Kingdom
Who is online

Users browsing this forum: No registered users and 5 guests