Jump to content

Hari KT

Members
  • Posts

    131
  • Joined

  • Last visited

Everything posted by Hari KT

  1. Hey, I am working on a hook, and when a page is viewed I would like to trigger an event and save something. This is my hook public function init() { $this->addHook('Page::loaded', $this, 'pageViewed'); } public function pageViewed($event) { $page = $event->object; if ($page->template == 'my-template') { // $field = $page->get("article_meta_score"); // $page->save($field); $page->myfieldname = 'Something'; $page->setOutputFormatting(false); $page->save(); exit; } } Now I am getting ( ! ) Fatal error: Exception: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '76021' for key 'PRIMARY' (in /var/www/ProcessWire/wire/core/Pages.php line 794) #0 /var/www/ProcessWire/wire/core/Pages.php(794): PDOStatement->execute() #1 /var/www/ProcessWire/wire/core/Pages.php(716): Pages->savePageQuery(Object(Page), Array) #2 [internal function]: Pages->___save(Object(Page), Array) #3 /var/www/ProcessWire/wire/core/Wire.php(359): call_user_func_array(Array, Array) #4 /var/www/ProcessWire/wire/core/Wire.php(317): Wire->runHooks('save', Array) #5 /var/www/ProcessWire/wire/core/Page.php(1121): Wire->__call('save', Array) #6 /var/www/ProcessWire/wire/core/Page.php(1121): Pages->save(Object(Page), Array) #7 /var/www/ProcessWire/site/modules/SomeModule/SomeModule.module(45): Page->save() #8 /var/www/ProcessWire/wire/core/Wire.php(381): SomeModule->pageViewed(Object(HookEvent)) #9 /var/www/ProcessWire/wire/core/Wire.php(317): Wire->runHooks('loaded', Array) #10 /var/www/ProcessWire/wire/core/Page.php(1490) in /var/www/ProcessWire/index.php on line 218 The page is editable and all. But I am not sure why so.
  2. Congrats @narendramodi for your victory. Bring something good for the people of India.

  3. RT @laracasts: If you couldn't make it out to #laracon, I pre-recorded mine! Watch it here: https://t.co/HCdI9KNXKh

  4. RT @dhrrgn: WIP: ActionResponder - Action and Responder implementations for the ADR Pattern. https://t.co/TTi7V6JKWC /cc @pmjones

  5. $ssh ip-address ; doing something ; power failure ; #asianet #broadband down. Kerala's leading ISP :P. Time for mosh again.

  6. Does the #php built in server loads twice? Testing with a if counter shows like that.

  7. Understanding of virtphp was wrong. I thought multiple versions of php is supported.

  8. RT @lsmith: anyone have experience using #dynatrace by @CompuwareAPM for PHP/ElasticSearch/MySQL/Redis application?

  9. Hi guys, I am experiencing a bit of trouble with the MarkupCache not cached properly. This is the code, $cache = wire()->modules->get("MarkupCache"); if(! $someoperation = $cache->get("someoperation", 60 * 15)) { $someoperation = " I am some operation "; if(! $expensive_operation = $cache->get("expensive_operation", 60 * 60 * 24)) { $expensive_operation = " Some expensive operation "; $cache->save($expensive_operation); } $someoperation .= $expensive_operation; // I am forced to use the get operation again for I have seen if you are not calling the get the value saved is something else $cache->get("someoperation", 0); $cache->save($someoperation); } Do you guys know what may be the reason the cache could not load ? I have tried setting the permission from 766 , 777 etc to the folder site/assets/cache/MarkupCache/ . Not saying this doesn't works always but some times espeically before the time expires or when I do a deploy via Jenkins it could not load the data. I can see the file being created, but it is not loading the data. What is the use of lastgood file ?
  10. RT @GeeH: It’s cheating I know, but I blogged none the less: http://t.co/TGDaRHXjmU

  11. I have submitted the package mvc-refinement to packagist https://t.co/Ineapf4T9l / cc @pmjones

  12. RT @pmjones: Wow -- Aura.View v2 scores a "10" from @scrutinizerci https://t.co/Xu0QINueP0 /me does happy dance

  13. Extending Plates With Aura Html Helpers http://t.co/D11oCqwMkn / cc @reinink @auraphp #plates #php

  14. RT @lornajane: In case you missed it earlier: I want stories! What brought you to open source? http://t.co/iiaL2WfmjS Please RT/share #comm

  15. Action-Domain-Responder https://t.co/SJHKRdkdZ2 now trending in weekly and daily on #github #php #mvc #adr . Awesome :) .

  16. A fresh designed ( from Nashville ) live now http://t.co/5d7JuNBBvN / cc Thank you @n33co

  17. Is there a way in PW to make use of mysql views?
  18. I am here with another issue noticed when running seige to benchmark stuffs. There is a bottle neck for SQL_CALC_FOUND_ROWS . I was going through this blog post http://www.mysqlperformanceblog.com/2007/08/28/to-sql_calc_found_rows-or-not-to-sql_calc_found_rows/ and some of my own tests. I am running and testing on ~ 606267 pages. SELECT SQL_CALC_FOUND_ROWS * FROM `pages` LIMIT 5 you will get the result in between ~ 0.42 s to ~ 0.572 s When you are running it in two queries, say SELECT * FROM `pages` LIMIT 5 and SELECT COUNT(*) FROM `pages` you will get the result in ~ 0.014 s and 0.189 s respectively. So a total of ~ 0.203 s. So I feel it will be nice not to have the SQL_CALC_FOUND_ROWS always been used when running any queries. Some of the additional problems to be taken are the queries will be using joins and those will take more seconds. In my case it has been taking ~22 seconds and more when running. Thank you.
  19. An attempt to refine MVC for a web-specific environment trending today . https://t.co/SEZL0WZkMT / cc @pmjones #php #mvc #adr

  20. @WillyC I just want to try out whether that will bring any performance improvement when dealing with 1000's of pages. I am not sure whether the PW is using an active record or some what similar methodology for saving / updating. We will see
  21. RT @Sylius: Decoupling of Sylius UI, BowerPHP usage and various tweaks to backend interface. https://t.co/SUWFahiOzz #Sylius #Symfony2 #eco

×
×
  • Create New...