[pmwiki-devel] Updating PTVs

adam overton a at plus1plus1plus.org
Wed Feb 3 13:36:31 CST 2010


hi there
is this at all related to the problem i was experiencing here (my  
problem is announced in blue after the intial pits claim): http:// 
pmwiki.org/wiki/PITS/01098 ?
we discovered it wasn't fox, but a pmwiki problem - but i'm using  
fox, so maybe now fox will do the internal maintenance that pmwiki  
should be doing?
just checking
thx
adam



> Message: 1
> Date: Wed, 3 Feb 2010 09:21:52 +0000
> From: Hans <design5 at softflow.co.uk>
> Subject: [pmwiki-devel] Updating PTVs
> To: pmwiki-devel at pmichaud.com
> Message-ID: <1225971627.20100203092152 at softflow.co.uk>
> Content-Type: text/plain; charset=iso-8859-15
>
>
> When a PTV 'var' gets updated and the page redisplayed with
> HandleBrowse() instead of Redirect(), although the new value
> is saved to file the old value still displays with {$:var}
>
> This made it necessary to reload the page, or use Redirect(),
> in order to see the new value.
>
> To circumvent this I have modified Fox now so that the PTVs in
> the page cache get cleared at the end of Fox's processes.
> Now PTVs show with the updated values, and redirect is not needed.
> This has also the benefit that Fox can show relevant messages.
>
> Are there any disadvantages doing it this way?
>
> I think the subjec thas been discussed before, but I do not recall it.
> So apologies if I missed something vital.
>
> Hans
>
>
>
>
> ------------------------------
>
> Message: 2
> Date: Wed, 3 Feb 2010 11:51:44 +0100
> From: Peter Bowers <pbowers at pobox.com>
> Subject: Re: [pmwiki-devel] Updating PTVs
> To: Hans <design5 at softflow.co.uk>
> Cc: pmwiki-devel at pmichaud.com
> Message-ID:
> 	<784f80491002030251x1b325872q9073d7b100ebe374 at mail.gmail.com>
> Content-Type: text/plain; charset=ISO-8859-1
>
> On Wed, Feb 3, 2010 at 10:21 AM, Hans <design5 at softflow.co.uk> wrote:
>>
>> When a PTV 'var' gets updated and the page redisplayed with
>> HandleBrowse() instead of Redirect(), although the new value
>> is saved to file the old value still displays with {$:var}
>>
>> To circumvent this I have modified Fox now so that the PTVs in
>> the page cache get cleared at the end of Fox's processes.
>> Now PTVs show with the updated values, and redirect is not needed.
>> This has also the benefit that Fox can show relevant messages.
>>
>> Are there any disadvantages doing it this way?
>
> There is a static definition of $status in PageTextVar() but as long
> as you aren't accessing a given PTV more than 500 times (configurable)
> then it shouldn't be a problem...  Did you just clear
> $PCache[$page]['=pagetextvars'] and $PCache[$page]['=p_*']?  I
> remember struggling with this once before and being very frustrated --
> right now it looks like a great solution...
>
> -Peter
>
>
>
> ------------------------------
>
> Message: 3
> Date: Wed, 3 Feb 2010 10:55:24 +0000
> From: Hans <design5 at softflow.co.uk>
> Subject: Re: [pmwiki-devel] Updating PTVs
> To: Peter Bowers <pbowers at pobox.com>
> Cc: pmwiki-devel at pmichaud.com
> Message-ID: <1918305901.20100203105524 at softflow.co.uk>
> Content-Type: text/plain; charset=iso-8859-1
>
> Wednesday, February 3, 2010, 10:51:44 AM, Peter wrote:
>
>> There is a static definition of $status in PageTextVar() but as long
>> as you aren't accessing a given PTV more than 500 times  
>> (configurable)
>> then it shouldn't be a problem...  Did you just clear
>> $PCache[$page]['=pagetextvars'] and $PCache[$page]['=p_*']?  I
>> remember struggling with this once before and being very  
>> frustrated --
>> right now it looks like a great solution...
>
> so far I've only unset  $PCache[$page]['=pagetextvars']
> maybe I should do the same for $PCache[$page]['=p_*'] ?
>
>
> Hans
>
>
>
>
> ------------------------------
>
> Message: 4
> Date: Wed, 3 Feb 2010 12:16:21 +0100
> From: Peter Bowers <pbowers at pobox.com>
> Subject: Re: [pmwiki-devel] Updating PTVs
> To: Hans <design5 at softflow.co.uk>
> Cc: pmwiki-devel at pmichaud.com
> Message-ID:
> 	<784f80491002030316l17e39077ya0fa2a439e3192c6 at mail.gmail.com>
> Content-Type: text/plain; charset=ISO-8859-1
>
> On Wed, Feb 3, 2010 at 11:55 AM, Hans <design5 at softflow.co.uk> wrote:
>> so far I've only unset ?$PCache[$page]['=pagetextvars']
>> maybe I should do the same for $PCache[$page]['=p_*'] ?
>
> I think the only danger you would run into was if a PTV definition
> were deleted from a page.  As long as it was modified or added then
> any old definitions would be over-written.  But if the definition is
> deleted (I could be wrong here) then I believe the $:oldPTV definition
>  would continue to remain in $PCache[$page]['=p_oldPTV'].
>
> (I should clarify, although it's hopefully obvious, that my '=p_*' was
> actually shorthand for a loop thru the array looking for keys that
> matched that initial 3-char string...) (or array_filter() or some
> similar function...)
>
> -Peter
>
>
>
> ------------------------------
>
> Message: 5
> Date: Wed, 3 Feb 2010 12:34:20 +0000
> From: Hans <design5 at softflow.co.uk>
> Subject: Re: [pmwiki-devel] Updating PTVs
> To: Peter Bowers <pbowers at pobox.com>
> Cc: pmwiki-devel at pmichaud.com
> Message-ID: <67712709.20100203123420 at softflow.co.uk>
> Content-Type: text/plain; charset=iso-8859-1
>
> Wednesday, February 3, 2010, 11:16:21 AM, Peter wrote:
>
>> I think the only danger you would run into was if a PTV definition
>> were deleted from a page.  As long as it was modified or added then
>> any old definitions would be over-written.  But if the definition is
>> deleted (I could be wrong here) then I believe the $:oldPTV  
>> definition
>>  would continue to remain in $PCache[$page]['=p_oldPTV'].
>
>> (I should clarify, although it's hopefully obvious, that my '=p_*'  
>> was
>> actually shorthand for a loop thru the array looking for keys that
>> matched that initial 3-char string...) (or array_filter() or some
>> similar function...)
>
> thankls Peter!
> Yes, you are right about old PTV remaining when the PTV definition is
> removed.
>
> I've got this code now, and it will force the PTV refresh
> for all cases I believe (I added a config variable just in case):
>
>  if ($FoxEnablePTVRefresh==1 && is_array($PCache[$pagename])) {
>    foreach(array_keys($PCache[$pagename]) as $key)
>      if (substr($key,0,3)=='=p_' || $key=='=pagetextvars')
>        unset($PCache[$pagename][$key]);
>  }
>
>
>
> Hans
>
>
>
>
> ------------------------------
>
> _______________________________________________
> pmwiki-devel mailing list
> pmwiki-devel at pmichaud.com
> http://www.pmichaud.com/mailman/listinfo/pmwiki-devel
>
>
> End of pmwiki-devel Digest, Vol 40, Issue 3
> *******************************************




More information about the pmwiki-devel mailing list