Textpattern CMS support forum

You are not logged in. Register | Login | Help

#51 2012-02-13 19:52:13

maniqui
Moderator
From: Buenos Aires, Argentina
Registered: 2004-10-10
Posts: 3,070
Website

Re: aks_cache: Partial caching web pages. SpeedUp your site!

Guillaume,
it’s not that the plugin doesn’t consider the status change as an update, as, in that sense, the plugin really doesn’t “know” anything about TXP contents.
The plugin just looks at the value of lastmod field, and then, it does its magic.
The “problem” is that switching an article’s status from “live” to “hidden” doesn’t update the value of lastmod field.

Workaround for this would need hacking the article_save function just a little.


La música ideas portará y siempre continuará

TXP Builders – finely-crafted code, design and txp

Offline

#52 2012-02-13 21:54:23

hablablow
Member
From: Paris
Registered: 2004-12-13
Posts: 309
Website

Re: aks_cache: Partial caching web pages. SpeedUp your site!

I see Juan.
Will digg the subject.
Gracias +


_
_I plant seeds for future visions. Farmer of your eyes. Subliminal engineer of your minds. eion founder__

Hablablow + Webdesignofficina

Offline

#53 2012-02-14 00:58:48

maniqui
Moderator
From: Buenos Aires, Argentina
Registered: 2004-10-10
Posts: 3,070
Website

Re: aks_cache: Partial caching web pages. SpeedUp your site!

Guillaume,
you could try this (not tested).
Replace lines 312-317 with:

         if($Status >= 4) {
              if ($oldArticle['Status'] < 4) {
                  do_pings();
              }
              update_lastmod();
          } else { 
            //New status is less than 4 (that is, it's not "live" nor "sticky")
              // Check if status for "old" article was "live" or "sticky"
              if ($oldArticle['Status'] >= 4) {  
                 // If so, update lastmod
                 update_lastmod(); 
              }
         }

PS: Juan? Quién es Juan?


La música ideas portará y siempre continuará

TXP Builders – finely-crafted code, design and txp

Offline

#54 2012-02-14 10:59:29

hablablow
Member
From: Paris
Registered: 2004-12-13
Posts: 309
Website

Re: aks_cache: Partial caching web pages. SpeedUp your site!

Barbaro !
Rollas + gracias.
Y perdon para tu nombre Julián !

Last edited by hablablow (2012-02-14 11:00:21)


_
_I plant seeds for future visions. Farmer of your eyes. Subliminal engineer of your minds. eion founder__

Hablablow + Webdesignofficina

Offline

#55 2012-02-14 11:59:14

Gocom
Plugin Author
From: Helsinki, Finland
Registered: 2006-07-14
Posts: 4,530
Website

Re: aks_cache: Partial caching web pages. SpeedUp your site!

I wouldn’t recommend modifying core. I would just simply hook update_lastmod() function to article, save event. All that should technically be just a single line of code. E.g.

register_callback('update_lastmod', 'article', 'save');

Which can be loaded via a modular plugin content (plugin, theme etc). Not tested, but should work just fine.

Offline

#56 2012-02-14 13:29:33

maniqui
Moderator
From: Buenos Aires, Argentina
Registered: 2004-10-10
Posts: 3,070
Website

Re: aks_cache: Partial caching web pages. SpeedUp your site!

Good to know, Gocom.
It’s not the first time that I suggest solving something by hacking the core, and then, you come to suggest not to do so, while also providing a better solution :)

I’ll test adding that line at the top of aks_header (meh, hacking a plugin this time), to see if it works as advertised.


La música ideas portará y siempre continuará

TXP Builders – finely-crafted code, design and txp

Offline

#57 2012-02-14 13:38:43

hablablow
Member
From: Paris
Registered: 2004-12-13
Posts: 309
Website

Re: aks_cache: Partial caching web pages. SpeedUp your site!

And I’ll do the same…
Thank you for your answers folks.


_
_I plant seeds for future visions. Farmer of your eyes. Subliminal engineer of your minds. eion founder__

Hablablow + Webdesignofficina

Offline

#58 2012-02-14 14:08:00

maniqui
Moderator
From: Buenos Aires, Argentina
Registered: 2004-10-10
Posts: 3,070
Website

Re: aks_cache: Partial caching web pages. SpeedUp your site!

I tried it, but didn’t work for me. I added the line as this (and also tried outside the if statement).

if(@txpinterface == 'admin') {
  add_privs('aks_cache_tab', '1,2');
  register_tab("extensions", "aks_cache_tab", "aks_cache");
  register_callback("aks_cache_tab", "aks_cache_tab");
  add_privs('plugin_prefs.aks_cache','1,2');
  register_callback('aks_cache_tab', 'plugin_prefs.aks_cache');

  // Here:
  register_callback('update_lastmod', 'article', 'save');
}

After hitting the save button on an article, the value for lastmod field doesn’t get updated. Am I do it wrong?

Last edited by maniqui (2012-02-14 14:58:50)


La música ideas portará y siempre continuará

TXP Builders – finely-crafted code, design and txp

Offline

#59 2012-02-14 14:47:07

Gocom
Plugin Author
From: Helsinki, Finland
Registered: 2006-07-14
Posts: 4,530
Website

Re: aks_cache: Partial caching web pages. SpeedUp your site!

maniqui wrote:

After hitting the save button on an article, the value for lastmod field doesn’t get updated. Am I do it wrong?

Ugh. Yeah, my bad. The step isn’t named save, but edit prior the editor panel. The pane step (for some obscure reason) is modified on the fly middle of the panel. So, hooking to the callback event executed after the panel should work. E.g.

register_callback('update_lastmod', 'article', 'save', 0);

That should do it. Probably. Most likely. Who am I to lie. I tested it. It works *wink*.

Last edited by Gocom (2012-02-14 14:50:46)

Offline

#60 2012-02-14 15:07:17

hablablow
Member
From: Paris
Registered: 2004-12-13
Posts: 309
Website

Re: aks_cache: Partial caching web pages. SpeedUp your site!

:)


_
_I plant seeds for future visions. Farmer of your eyes. Subliminal engineer of your minds. eion founder__

Hablablow + Webdesignofficina

Offline

Board footer

Powered by FluxBB