Jump to content

thomas

Members
  • Posts

    189
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by thomas

  1. Thanks for the info! I found the error, it was my cache clearing module that kept looking for not-yet-existing cache files to delete.
  2. Hello, I have a site that writes a lot of MarkupCache files. I use a hook after save() to delete only the ones for the changed ID. Since these are a lot of cache files (up to 20.000 right now) this process takes a long time so I need to make sure it only happens when neccessary. My idea was this: Whenever a page gets saved entirely ($page->save()) I clean the cache for it. When only parts are saved ($page->save(field)) I don't. So I'd like to know: - Is there a way to save several fields (have a $fields array) or do I have to $page->save($field) for every single one? - is there a way to find out in the hook if a field was given or the entire page is to be saved? Also on another note, has anyone got any great tips on how to delete (expire) seleted files from the MarkupCache directory? I use remove() from cacheFile which uses directoryIterator. This takes a long time! Thanks, thomas
  3. Hello, I noticed that creating new pages and saving them is getting really really slow on my production server. One parent has 1500 pages and when I add another one, it can take up to a minute for it to be created. For a different parent with only 300 pages it's fast as usual. I am using a frontend where users can register and create new pages so making them wait for over a minute isn't quite ideal. It can't be my codes fault though because it takes just as long in the admin ... Thanks for any hints, thomas
  4. You are probably right Martijn. I now default to german, since that's where the company is based. English speaking customers can easily change the language, that shouldn't be too much to ask. Still impressed by the multi-language capabilities of PW! It's the first time I used the module. Thanks, thomas
  5. Hello Ryan, thanks for your answer. I completely changed the code and now it works. The idea was, to automatically send the user to the appropriate language but HTTP_ACCEPT_LANGUAGE didn't even work consistently in my two browsers.
  6. Hello, I built a bilingual site with a little language switcher in a module. problem is, it works *most of the time* ... and the solution was to add a simple message line in the module. Here's the code: $this->addHookBefore('Page::render', $this, 'changeLanguage'); public function changeLanguage (HookEvent $event) { $lang = wire('session')->language; if(!$lang) { if(strstr($_SERVER['HTTP_ACCEPT_LANGUAGE'],'de')) $lang = 'de'; else $lang = "eng"; } $lang = wire('input')->get->lang?wire('input')->get->lang:$lang; if($lang != wire('session')->language) { $this->message(__('Sprache geändert zu')." ".$lang); # IMPORTANT!!! $l = ($lang == 'de') ? 'deutsch' : 'default'; wire('user')->language = wire('languages')->get($l); wire('user')->save('language'); wire('session')->language = $lang; wire('session')->redirect($event->object->url); } } if I leave the $this->message() bit out, i get everything from working, via "Trying to get property of a non-object in LanguageSupportFields line 131", to simply not working at all. Can anyone explain?? Thanks, thomas
  7. Hello, is there a way to sort pages by a computed value other than using raw MySQL? I have about 2000 pages which all have a "views" field. Now I'd like to sort them by "views per day", so calculate the age of the post in days and divide the views by the age. I thought about a LazyCron which computes this value every now and then and writes them into a field but this would mean the value is always outdated and I'm not sure how long the cron would take on a large number of pages ... Has anyone got any suggestions on how to do this? Thanks, thomas Solved. Sorry. Next time I think before I post I now update the "views per day" value every time the "views" value is updated. This is of course a bit inaccurate since the views might not get updated for a couple of days but I figured that's a small price to pay for not having a cron iterate over the pages every so often.
  8. Unfortunately no. I cleaned the image field before trying deleteAll()
  9. Hi Adrian, thanks for the tip but unfortunately it doesn't change anything. I ran $video->of(false); $video->teaserbild->deleteAll(); $video->save(); $video->teaserbild = 'http://new_image.jpg'; $video->save(); on a page with one image already uploaded and got this error: <b>Warning</b>: unlink(/www/htdocs/v133155/bigair2/site/assets/files/51666/img_20131001_110155.jpg) [<a href='function.unlink'>function.unlink</a>]: No such file or directory in <b>/www/htdocs/v133155/bigair2/wire/core/Pagefile.php</b> on line <b>304</b><br /> and the result remains the same: (with the second one being the new one and the first (upper) one being the one that supposedly couldn't be deleted ...) Any hints? Thanks, thomas
  10. Hello, I have an imagefield set to limit=1 and I try to replace this image via the API: $video->of(false); $video->teaserbild->removeAll(); $video->save(); $video->teaserbild = 'http://new_image.jpg'; $video->save(); The result in the admin is a broken image (missing file) as the first image (which was supposed to be removed) and the new one intact as second. I'm on PW 2.3.0. I've had this problem for a while and can't seem to solve it. Can someone help? Thanks, thomas
  11. I am used to simpy updating the /wire/ folder and maybe index.php so please excuse me, if I missed an update process here. I just tried 2.3.4 and got this: [Mon Sep 16 13:24:24 2013] [error] [client 127.0.0.1] PHP Fatal error: Uncaught exception 'PDOException' with message 'You cannot serialize or unserialize PDO instances' in [no active file]:0\nStack trace:\n#0 [internal function]: PDO->__sleep()\n#1 {main}\n thrown in [no active file] on line 0, referer: http://productspecial/ps-admin/ Thanks, thomas
  12. Hello Jasper, thanks for the answer. I'd like to build my own logging system so I can see exactly which messages a certain user gets. The errors and messages are already in place so I am looking for a way to hook my own logging system onto that. Any more ideas? Thanks, thomas
  13. Hello, I'd like to log all the messages and errors my site throws. Is there a way to hook into these methods? Thanks, thomas
  14. I haven't looked into translation at all so please excuse if this is obvious and/or stupid: Is there a way to translate the PW error messages for required fields? I use those for frontend editing on my website as well and it would be a nice touch to have them in german ... Danke! thomas
  15. thomas

    bigair.tv

    Hello jmart, thanks for the info. To be honest I wasn't too sure about the authorship, since very few of the people writing for the site or uploading videos are on G+. I'll probably try to include the info for those who are ... Thanks, thomas
  16. thomas

    bigair.tv

    Hi jmart, yeah I was focusing on microdata for the videos first because I was experimenting with G+ integration. I will include microdata on news and products as well (thanks for reminding me!) I'm glad you say it loads fast because that means my caching strategies seem to work!
  17. thomas

    bigair.tv

    The mobile menu (or sidebar on Desktop/wider displays) is really only useful when you're registered/logged in. It contains a category menu where you can enable and disable video categories, the search field and video channels. You are right, for the average visitor right now it's useless. That's one of the things we still need to think about ... Thanks, thomas Edit: I find it really hard to decide which features to offer to "everyone" and which are only for registered users ... One one hand we need to offer more for people that register, on the other hand I don't want the site to look empty or too simple for unregistered visitors .... decisions, decisions ...
  18. thomas

    bigair.tv

    Hello, we recently relaunched http://bigair.tv to the new Processwire version. The site used to be based on ViMP video CMS which itself is based on the Symphony framework. After almost two years of trying to make ViMP/Symphony work the way we needed it, I decided to rebuild the whole thing in PW. It was well worth it, even though it still contains a lot of bugs and a lot of features are still missing. With Symphony, I spend my time looking for files and classes, rebuilding classes, fighting my way through abstraction layers and trying to decipher Symphony Markup creation tags. With PW, my clients needs are easily implemented and I finally feel like I'm in charge of the site. The site offers user registration through Google and Facebook, video upload for registered users and video transcoding through Zencoder. It was remarkably easy to build in PW (even though I'll take a close look at Apeisa's "Fredi" to see if I can learn something about frontend editing) The main challenge was building an efficient caching mechanism for the video lists, which are customizable for registered users. I used MarkupCache for pretty much everything. So here is my second PW project and by far the biggest one I build so far. Thanks to PW, the community and Ryan for answering my (sometimes silly) questions! http://bigair.tv/ -thomas
  19. Hello Ryan, I think I found it. Whenever I forget the trailing slah, it redirects. So https://ssl-account.com/neu.bigair.tv/admin/ works (even though no stylesheets or anything is found) but https://ssl-account.com/neu.bigair.tv/admin redirects to https://ssl-account.com/admin which of course doesn't work at all. I'll try to get this to work with that. Thanks! thomas
  20. Hello, I want to build a facebook tab for my website, but FB requires SSL. So I have an option to use an ssl proxy for my domain which sounds like https://ssl-account.com/domain-name/ ... A quick check reveals my page but of course no links work or images appear since they are all absolutely linked to /. I can't seem to access any page but home (/) though. Every time I want to access say https://ssl-account.com/domain-name/news/ it redirects to https://ssl-account.com/news which obviously doesn't work. I only need one single page with one template to work with SSL. Has anyone got any experience with this? Thanks, thomas
  21. Yes I tried it and there are results! But here's the weird part: As soon as I do this, unpublished pages show up in the results. Sounds odd, but it's true! The resulting MySQL query is this: SELECT SQL_CALC_FOUND_ROWS pages.id,pages.status,pages.parent_id,pages.templates_id FROM `pages` LEFT JOIN field_is_private ON field_is_private.pages_id=pages.id LEFT JOIN pages_access ON (pages_access.pages_id=pages.id AND pages_access.templates_id IN(2,3)) WHERE (pages.templates_id=43) AND field_is_private.pages_id IS NULL OR field_is_private.data='0' AND (pages.status<1024) AND pages_access.pages_id IS NULL AND pages.templates_id NOT IN(2,3) GROUP BY pages.id ORDER BY pages.created DESC with the important part being this: [...]AND field_is_private.pages_id IS NULL OR field_is_private.data='0' AND (pages.status<1024)[...] NOw if I add a set of paranthesis like so: [...]AND (field_is_private.pages_id IS NULL OR field_is_private.data='0') AND (pages.status<1024)[...] it works perfect, at least for my case. Bug? Thanks, thomas
  22. Yes Nik, I'm on the latest dev (dl'd because of this) and I also tried on the latest stable. Thanks, thomas
  23. Hello Soma, not sure about your second sentence ... my checkbox field is called "is_private" ... the DB table field_is_private holds 3 entries with data "1", the ones I checked. Now I try to select the ones which aren't checked: $pages->find("template=video,is_private!=1") $pages->find("template=video,is_private=0") $pages->find("template=video,is_private<1") ... no results. The resulting MySQL query has no results either: SELECT pages.id,pages.parent_id,pages.templates_id FROM `pages` JOIN field_is_private AS field_is_private ON field_is_private.pages_id=pages.id AND (((field_is_private.data!='1' ) )) LEFT JOIN pages_access ON (pages_access.pages_id=pages.id AND pages_access.templates_id IN(2,3)) WHERE (pages.templates_id=43) AND (pages.status<1024) AND pages_access.pages_id IS NULL AND pages.templates_id NOT IN(2,3) GROUP BY pages.id ORDER BY pages.created DESC I'm not too good in MySQL but I guess that's because those entries simply don't exist. So they are neither "0" nor "not 1" nor "lower than 1" ... Hope that clarifies my problem. Thanks, thomas
  24. Hello, I have about 1000 articles and now added a checkbox to the template (I know it's a bit late but sometimes problems arise where you don't expect them ...) Now I can't seem to check for "not checked". Neither field=0 nor field<1 nor field!=1 yield any results. Only field=1 works but that's not really what I want. Maybe a DB expert can help? Thanks, thomas
×
×
  • Create New...