Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 04/19/2016 in all areas

  1. I'm in the process of getting wireshell PW3 ready. But I think it could use a bit more testing before I'll finally push it into the master branch. So I started a RC branch just for this purpose. If someone wanted to try and test it – which I would really appreciate: here you go (or: checkout branch feature/devns) !
    6 points
  2. Hi @delueg, I'm short in time ATM, but can answer a little part. The first only in addition of what @kiennguyen1101 already said. The primary part is to figure out and define the best data structure in PW for that project, so that the app can run fast and you can map / import the old data. There were case studies here in the forums and published sites in the site directory (or in the forums too) that were sites / apps on very large scales. Maybe to read a bit of that may give you valuable impressions. (National Geographic Case Study, CMSCritic Development Case Study, Villas-Rental, ... maybe other users can add some more links, - I remember threads and posts talking about 1 million pages in one PW installation and others, but have no bookmarks at hand) The second You are coming to Processwire at a point where the first PW 3 stable version will released not that far away. Also, that upgrade is the first one in the last 5 years or longer, that bring in a major change from no namespace to use namespace(s) in PHP. That normally would break existing code of templates and third party modules, but Ryan has built a rocksolid FileCompiler to handle both, (upgrading from 2.x to 3.x and the use of third party modules (developed for PW 2.x) in PW 3.x), automatically behind the scenes, without any manually interaction. But I personally have changed to start with PW 3 on every new site now. Upgrade guarantee for all ProModules is in. For third party modules, PW cannot guarantee, (but see: FileCompiler!). Also, for all third party modules that are used by many people, there ever was found a new maintainer here in the community, if the original owner / creator could not do it anymore. "Upgrade to a core change not fast enough" is a very vague formulation. I think, if you have a project like yours once online and running, you never will change from a (then stable PW3) version to a first PW4-alpha version. So, as the development cycle of such an major upgrade will take six (?) month or more, there is enough time for modules developer to upgrade too. (But once more: it isn't really necessary, seeFileCompiler) Also, core upgrades in PW are not necessary if you do not need newly introduced features. This is different here than with W*rdPr*ss or others. I have running sites on PW 2.3, 2.4, 2.5, 2.6, 2.7, 3.0 and don't need or want to change them. I only have updated sites core when I want to use a new feature there.
    4 points
  3. proud to share the release of a little handy sorting module for image and file fields (edit: some bugs in the screencast that are already solved) the autosort option can be set in the field-admin: Caution there is some work planned on the images field, so this may break the functionality of this module. have this in mind. github: https://github.com/BernhardBaumrock/InputfieldFileSort module directory: http://modules.processwire.com/modules/inputfield-file-sort/ changelog 1.0.0 initial release
    3 points
  4. Getting back to topic Third part in Maurizio Bonani's excellent series: http://blog.mauriziobonani.com/processwire-basic-website-workflow-part-3/
    3 points
  5. @slave: I didn't notice your produktkategorie pages are not direct children of Home. Try making a PageArray of your menu items and giving that to MSN as the root argument. <?php $nav = $modules->get("MarkupSimpleNavigation"); // load the module // make PageArray of your menu items $menu_pages = $pages->find("template=produktkategorie")->prepend($pages->get("/")); echo $nav->render(null, null, $menu_pages); // render the menu ?>
    3 points
  6. Hi guys, I'm learning Go since a few weeks and every now and then I stumble over some great tools for web development. This one I found yesterday is awesome if you work with large scale systems: https://github.com/buger/gor/ Under the hood it works with raw socket connections, like a sniffer, pcap or wireshark, but without using the well known libpcap. I guess the performance impact is the smallest possible. Take a look at the github page if you like, it has some very interesting features. Maybe a handy tool for some of you Cheers
    2 points
  7. Hi all! Just wanted to let you know that something wicked is coming your way: https://github.com/BlowbackDesign/TinyPNG It's still pretty much "work in progress" but currently module works and you're able to compress Pageimages by either manually with added tinify() method or automatically when image is resized using size() method. Croppable images can also be compressed by adding tinify() to the returned Pageimage object. On next stage I'll add support for (resized) embedded images at richtext editor and maybe some other features if needed. Time is little short right now but I'll try to make it happen sooner than later. This module creates compressed images as a variation of original (or resized) image so any of the source files aren't overwritten. This ensures good quality and tries to avoid pixelated over compressed images. Module uses Tinify PHP client to connect TinyPNG API (and thus is available to use as is as an autoload module). Please feel free to try out and tell me what you think!
    2 points
  8. Thank you, BitPoet and horst. It looks like some things have changed in ProcessWire 3.x. See "Improvements to the ~= operator in page finding operations" in the following post: https://processwire.com/blog/posts/merry-christmas-heres-processwire-3.0.3-and-2.7.3-and-some-more/ I'm going to upgrade the site and see if this helps with the results. If not, I'll try splitting each search term as mentioned above.
    2 points
  9. I believe this is the one: https://processwire.com/talk/topic/2038-distinct-selector-in-processwire/?p=43720
    2 points
  10. Hi delueg, I took a look at your questions and realized your statistics isn't really problematic but still, migrating 200GB of data is a hard work. You should double check your user visits using 3rd-party tools like google analytics or something like that. One of the websites I know using PW is cmscritic.com and they have around 30k visits monthly (checked using alexa rank). However, the only way to truely know if 1 framework is suitable for your requirements is to do stress testing. Have your homepage built with some data and send requests. Just remember, you can make some pages (like mine) finish loading after 30s with loading images on-demand to make sure user sees the whole page first. For me, the reason I chose PW is because I liked its API and the simplicity of how the templating work. Personally, I would stay with the stable version of any frameworks unless your site could change easily. However, the documentation doesn't cover everything so you need to do some code reading to be able to use all the provided API. I read about vuejs a year ago and I quite fond of it. But if you like new things, I would suggest Redux with React (backed-and-used by Facebook). Also, I think AngularJS 2.0 (backed-and-used by Google) is ready for production and you shouldn't really worry about it.
    2 points
  11. I have spent the entire day working with websites with this module. I am very impressed and thankful that @Kixe worked on this wonderful module. Additional thanks to @LostKobrakai who mentioned this module in another thread, which got my interest and finally resulted in me testing it out. I still don't know how I missed understanding the great usefulness of this module initially.
    2 points
  12. Media Manager Released 31 March 2016 https://processwireshop.pw/plugins/media-manager/ Documentation http://mediamanager.kongondo.com/ As of 10 May 2019 ProcessWire versions earlier than 3.x are not supported ******************************************************* ORIGINAL POST ******************************************************* API Example (frontend; will be added to documentation site) Accessing and outputting the contents of the MediaManager field(s) in your template is quite simple. The fields are accessed like many other ProcessWire fields. The fields return an array of type MediaManagerArray that need to be looped to output each media within. Assuming you created a field of type MediaManager named 'media', you can loop through it for a given page as shown below. @note: Each MediaManager object has the following 5 basic properties: DATABASE (saved properties) 1. id => pageID of the page where the media lives (hidden in admin and not important to know about) 2. type => integer denoting media type (1=audio; 2=document; 3=image [for variations this will be 3x, where x is the number of the variation of an original image]; 4=video) RUNTIME 3. typeLabel => user friendly string denoting media type (audio, document, image, video) 4. media => a ProcessWire Image/File Object including all their properties (ext, filesizeStr, height, width, description, tags, filename, basename, etc.) 5. title => title of media (@note: this is the title of the page where the media lives; may or may not be the same as the name of the media file itself). This can be used as a user-friendly name for your media $media = $page->media;// returns a MediaManagerArray. Needs to be looped through foreach ($media as $m) { echo $m->id;// e.g. 1234 (hidden page in /admin/media-manager/media-parent/) echo $m->type;// e.g. 3 (a media of type image) OR 1 (a media of type audio) echo $m->typeLabel;// e.g. 'document' (i.e. type would be 2) echo $m->title;// e.g. 'My Nice Trip' (whose media file could be my-nice-trip.mp4) /* @note: - $m->media returns an object; either a ProcessWire Image (for image media) or File object (for audio, document and video media) - This means you have access to all the properties of that object, e.g. ext, tags, description, url, filename, basename, width, height, modified, created, filesize, filesizeStr, etc as well as associated methods, e.g. size() */ echo $m->media->tags; } // only output images foreach ($media as $m) { if($m->typeLabel =='image') { echo "<img src='" . $m->media->size(100,75)->url . "'><br>"; } } // There's also a toString() method so you can do: echo $page->media; /* All your media will be output wrapped in appropriate HTML tags, i.e.: audio: <audio></audio>; document: <a></a>; image: <img>; video: <video></video>; */ ******************************************************* ORIGINAL POST ******************************************************* The topic of a central media manager feature for ProcessWire has come up several times: https://processwire.com/talk/topic/4330-get-image-from-other-pages-via-images-field/ https://processwire.com/talk/topic/4330-get-image-from-other-pages-via-images-field/?p=42578 https://processwire.com/talk/topic/4330-get-image-from-other-pages-via-images-field/?p=42582 https://processwire.com/talk/topic/425-file-manager/ https://processwire.com/talk/topic/425-file-manager/?p=13802 https://processwire.com/talk/topic/425-file-manager/?p=13861 https://processwire.com/talk/topic/10763-asset-manager-asset-selector/ More recently, regarding my Visual Page Selector module, I have been asked several times why the module does not have an in-built feature to upload images. There's two camps on the topic of a central media manager: those who like them (especially those coming in to PW from other CMSes) and those who don't like them (primarily because of the chaotic way some CMSes (dis)organise their media management) . I think that we can have our cake and eat it too! If done the right way, closely following the principles of and harnessing the power of ProcessWire, we can have a well-implemented, organised, feature-rich, site-wide media manager. Introducing Media Manager: (a commercial module) Alongside a number of modules I am currently working on (both free and commercial), I have been developing a centralised Media Manager for ProcessWire. Before you cast the first stone, no, this is not going to be a one-large-media-bucket as in other CMS where it gets very messy very quickly . In the backend things are neatly stored away, yes, in pages. However, those are pages you will not see (just like repeater pages). Before anyone has a go at pages, remember a page is not that thing you see on the ProcessWire Tree (that's just its visual representation); A page is a record/row in the database . For the end-user of Media Manager, all they will see is the 'familiar media bucket' to select their media from. As long as it works efficiently, I don't think they care about the wizardry behind the scenes . The module allows for the comprehensive management of several media types: Audio Video Images Documents Each media type will be handled by its own sub-module so the user can pick and install/choose the type of media management they want. Features include: Access controls Centralized uploads of media Bulk management of media: tag, delete, describe, replace, etc. Bulk upload: zip; scan, single Quick upload in page edit mode Usage stats across pages (maybe?) Etc.. Would love to hear your thoughts and any feature suggestions. I think there's enough demand for such a module. If not, please let me know so that I can instead focus on other things , thanks. How other CMS do it The more efficient (PW) way of doing it
    1 point
  13. ClearCacheAdmin Module Since there's so many asking how to clear cache. Here comes a helper module that let's you clear caches directly from the admin menu. Additionally it has its own admin page that's a collection of the various caches available in ProcessWire in one place. See some infos and clear them. WireCache (using $cache) caches in the DB and there no way to clear it from the admin. Now you can delete the entries individually or all in one go. Supports following cache types: - Template "Page" Cache (disk file cache) - MarkupCache module (file cache) - WireCache (DB) - Other files and directories found in assets/cache/ path Wanted to do this for a long time. It was also great fun to do it and give something to the community to also learn something. For now it's on github only. Requires ProcessWire 2.6+. https://github.com/somatonic/ClearCacheAdmin
    1 point
  14. I upgraded to ProcessWire 3.0.15 and it looks like the changes in that version have fixed the problem.
    1 point
  15. I tried almost every command, but haven't noticed any issues with PW3. Maybe some of the heavy users will notice something. Thank you for this awesome CLI.
    1 point
  16. Nothing exotic, just changing title|headline|heading|subhead|lead|body|profile|summary|meta_keywords~=van Meter to title|headline|heading|subhead|lead|body|profile|summary|meta_keywords%=van, title|headline|heading|subhead|lead|body|profile|summary|meta_keywords%=Meter In our PW based intranet, where I use OpenSearchServer to search pages, attachments and external files, I've had the same problem (with a few tweaks due to stemming and synonyms), and after a lot of testing this and that, I compromised on setting minimum word length to three and adding an "exact search" option for those cases where fulltext searching returned too many or too few results. Unfortunately, I haven't found the perfect, intuitive find-it-all solution yet
    1 point
  17. MySQL's fulltext search has a minimum word length, which is 4 by default. Shorter words are not included in the index (and neither are stopwords, i.e. common words like 'the', 'have' or 'some'). You can read a bit about it in PW's selector documentation, where you'll also find a link to MySQL's docs on changing minimum word length. Fulltext search is always a bit of double-edged sword, as the price for fast search for natural language is payed with omission of short and very common words (words present in more than 50% of the examined rows aren't taken into consideration), no matter if you use MySQL, Lucene or any other fulltext engine. Splitting search terms on whitespace and adding a % selector expression for each of them may be an option, though that puts more load on the server.
    1 point
  18. Ah, here is a very valuable post from within the case studio of the National Geographic Site: https://processwire.com/talk/topic/7494-case-study-the-triumph-of-national-geographic-traveller-india-in-processwire/page-2#entry72498 And, also it is that mainly new users ask here the community, I want ask one question too: What are the alternatives to PW?
    1 point
  19. Thanks for your answers! The first think i had to do, was enable the url segments. That was unclear for me. I asked a colleague for help. We looked at the example above and get it to work. $download = ($input->urlSegment1 == 'download'); $file = $page->bildarchiv_images; $thumb = $page->bildarchiv_thumb; if ($download) { $downloadFilename = '';// ($page->title).'.'.substr(strrchr($file->$filename, "."), 1); wireSendFile($file->filename(), array('forceDownload' => true, 'exit' => true, 'downloadFilename' => $downloadFilename)); } else { echo '<div id="basic-site-text" class="row content-box">'; echo '<div class="medium-9 columns content-box-column-left">'; echo "<h2>$page->title</h2>"; if($thumb) echo "<a href=\"./download/\"><img src='$thumb->url'></a>"; else echo "<a href=\"./download/\"><img src='$file->url'></a>"; echo "<p><strong>Stichwörter:</strong><br>$page->stichwoerter</p>"; echo "<p><strong>Copyright:</strong><br>$page->copyright</p>"; echo "</div>"; echo '<div class="medium-3 columns content-box-column-right">'; echo "<a id='search_submit' class=\"expanded button\" href=\"./download/\">Download</a>"; echo "</div>"; echo "</div>"; }
    1 point
  20. @slave <?php $nav = $modules->get("MarkupSimpleNavigation"); // load the module // set options $nav_options = array( 'show_root' => true, 'selector' => 'template=produktkategorie' ); echo $nav->render($nav_options); // render the menu ?>
    1 point
  21. Because it is maybe interesting for others I will answer a question I got in the personal messenger: Does the module have the capability to run from a standard cron job? Yes. The Backup is triggered by the hook function cronBackup() expecting a HookEvent as single argument, which is in fact not needed. If you want to trigger the backup from anywhere, just create a HookEvent object and call the cronBackup() function. Done. $event = new HookEvent; $modules->get('CronjobDatabaseBackup')->cronBackup($event);
    1 point
  22. ->add() does afaik only allow for a single item. Either use ->import() or just $task->task_person = $task_person;
    1 point
  23. May I ask why you're not using a PageField to reference users? *= does not support partial word matching and in this case there are no spaces, which is why it doesn't work. ~= would work, but only in db queries and not for runtime filtering.
    1 point
  24. What kixe said, but to add to this: It's not as simple as adding a button attribute or some different url processwire would provide. This would need you to have a url (or page, can be the page the button is on), which serves as wrapper for the image file. You then use the url of this page as the source for the download. You probably need some kind of trigger for the download, to differenciate it from normal requests, which is done either via a urlSegments or a GET variable in the url. In the template you can then check for the trigger / filename and run wireSendFile on the file the user does try to download.
    1 point
  25. /** * Send the contents of the given filename via http * * This function utilizes the $content->fileContentTypes to match file extension * to content type headers and force-download state. * * This function throws a WireException if the file can't be sent for some reason. * * @param string $filename Filename to send * @param array $options Options that you may pass in, see $_options in function for details. * @param array $headers Headers that are sent, see $_headers in function for details. * To remove a header completely, make its value NULL and it won't be sent. * @throws WireException * */ function wireSendFile($filename, array $options = array(), array $headers = array()) { $http = new WireHttp(); $http->sendFile($filename, $options, $headers); } Usage $file = $page->filefield->first()->filename(); // or $page->filefield->filename(); depending on your settings wireSendFile($file, array('forceDownload' => true, 'exit' => true)); Example Allow url segments in the template where your button and image exists. $img = $input->urlSegment1? (int) $input->urlSegment1:0; $download = $input->urlSegment2 == 'download'?true:false; $file = $page->filefield->eq($img); if ($download) { wireSendFile($file->filename(), array('forceDownload' => true, 'exit' => true)); } else { echo "<img alt='' src='{$file->url}'/>"; echo "<button><a href='$number/download/'>Download Picture</a></button>"; }
    1 point
  26. $tasks = $pages->find("task_person*=$user->name,parent=/tasks/,include=hidden,sort=-created");
    1 point
  27. $names = "ali,sradesign,nona"; $names = strtr($names, ',','|'); $users = $users->find("name=".$names); @LostKobrakai Always quick
    1 point
  28. If there are only 60 pages i find it strange that it would take more than 6 seconds to get a couple of random pages. It's also funny that your limit 100 is larger than the actual number of pages, but it is twelve times faster (500ms versus 6 seconds) when you put the limit the selector. I'm not sure what is going on here. Apart from that, as LostKobrakai said, when getting random pages from a large number of pages the sort=random is preferable. However, when you would get into a really big number of pages even that would probably become slow. (i've done some simple tests in the past: https://processwire.com/talk/topic/8626-multiple-random-ads/?p=83345 )
    1 point
  29. Fantastic. Been waiting very long for something that takes me back to the days of Rails migrations! I will be doing a screencast on this in my WP vs. PW series. Just in time!
    1 point
  30. Sure. I just wanted to get it out, but this can certainly being added. We're using Cronjob DB Backup on our project so it's not been so much a necessity for me. Also it wouldn't even need to check for anything as the backup functionality is part of the core. Only the admin UI must be installed.
    1 point
  31. Looks great, Benjamin, thank you! I have not tried this yet, but look forward to doing so. Could your module check if ProcessDatabaseBackups is installed? If it is perhaps it could take care of either backing up the DB or at least reminding the user to do so, before it performs a migration.
    1 point
  32. Hey guys. I'm submitting my latest project to the directory. http://www.sagatex.pt Sagatex represents fashion and sportswear brands in Portugal, such as Fred Perry, Diadora, Dr. Martens, etc. This site features a product catalogue and a store finder. I like keeping my ingredients to a minimum. Here, I used: Reno theme InputfieldRepeater InputfieldMapMarker MarkupSEO ImportPagesCSV Enjoy
    1 point
  33. At X-com we build and maintain ticketingsoftware, named Itix. About 20 Dutch Theatres run our software and since we've dropped maintentance on our own CMS, we're slightly migrating more and more of those theatres towards a ProcessWire powered website. Using various API's and synchronisation tools, all needed information and actions are provided to the ProcessWire frontend, resulting in a cool e-commerce solution which is flexible towards the client and scalable for us. Another one was released this week, go see the result at http://www.maaspoort.nl The design was done by http://www.dejongensvanboven.nl The technical implementation by us at http://www.x-com.nl Other Itix theatres running on ProcessWire include: http://www.schouwburgvenray.nl/ http://www.dnk.nl/ http://www.rabotheater.nl/ http://www.deleest.nl/ http://www.hof88.nl/ http://www.demeenthe.nl/ http://www.muziekgebouweindhoven.nl/
    1 point
  34. Media Manager Released 31 March 2016 https://processwireshop.pw/plugins/media-manager/
    1 point
  35. If you want to use this module with PW3.x (and only PW3.x), please pull branch feature/devns. It needs a bit more testing before I'll release it. first backup your installation after upgrading the module, go to module settings, have a look at the settings – you may have to adapt something Whats new: messages will be saved as pages instead of repeater items you have to define a parent page, all messages created will live under this parent the page name starts with the current timestamp, you could add additional fields which should be appended field selection: you can existing fields or fill in field names, after the module are saved, for each name a field will be created manage settings like field type, required, additional error checks for each field after the module settings are saved, all existing repeater items will be converted to pages no more template creation, ProcessWire API renders the form (you can adapt the markup) you may have to translate error and success messages Have a look at the latest readme to get more information. I would love to get some feedback
    1 point
  36. This is sweet. And sooo easy to add to any PW site. http://blog.watchandcode.com/2016/03/17/the-single-piece-of-javascript-on-hacker-news/
    1 point
  37. Should anybody need this: $pages->addHookAfter("ProcessPageEdit::buildForm", function(HookEvent $event) { $page = $event->object->getPage(); $form = $event->return; if ($page->template->id == 44 && $page->parent->id != 1020) { $fieldset = $form->find("id=Inputfield_fieldset_tab_2")->first(); $form->remove($fieldset); $event->object->removeTab("Inputfield_fieldset_tab_2"); } }); Just replace the $page->template->id with the id of your template, and the $page->parent->id to what you want (or something similar). Finally replace fieldset_tab_2 with the name of your field.
    1 point
  38. Haha, had to update this one. New baby (already 7 months old) and a new car...
    1 point
  39. Hi jsantari, Here's how I'd go about it: (1) Make the following templates: products.php product.php product-categories.php product-category.php options (no need for php file) option (no need for php file) (2) Make the following page structure: /products/ (uses products.php)/product-1/ (uses product.php) /product-2/ (uses product.php) (etc) /product-categories/ (uses product-categories.php)/product-category-1/ (uses product-category.php) /product-category-2/ (uses product-category.php) (etc) /options/ (uses options.php)/colors/ (uses option.php)/red/ (uses option.php) /green/ (uses option.php) /blue/ (uses option.php) /sizes/ (uses option.php)/small/ (uses option.php) /medium/ (uses option.php) /large/ (uses option.php) (3) create the following fields: color (Page field; single value; use /options/colors/ as parent; regular select box); assign it to product.php size (Page field; single value; use /options/sizes/ as parent; regular select box); assign it to product.php products (Page field, multi-value; use /products/ as parent; ASM select or even better, PageListSelectMultiple since you have over 2000 products); assign it to product-category.php Now we need to handle what you said: "The twist is that each product category will have attributes like color, size etc. but the values for color, size etc. will be different based on what category is selected." The way I'd approach is to create 2 more fields and assign them to the product-category.php template: filterable_colors (Page field; multi-value; use /options/colors/ as parent; ASM select preferably); assign it to product-category.php filterable_sizes (Page field; multi-value; use /options/sizes/ as parent; ASM select preferably); assign it to product-category.php So those two filter fields will pretty much allow your category to have specific filters. Ideally, you would then code your product-category.php template to loop through and output all the products assigned to the category, as well as loop through the filterable_colors and filterable_sizes which would act as filters to the list of the products on that page. If doing the filtering client-side, here's a cool library: https://mixitup.kunkalabs.com/ Hope this helps! Jonathan
    1 point
  40. ProcessWire LazyCron Module This core module provides hooks that are automatically executed at various intervals. It is called 'lazy' because it's triggered by a pageview, so the interval is guaranteed to be at least the time requested (and maybe more) rather than exactly the time requested. The more pageviews your site gets, the closer it is. This is fine for most cases, but if you need it to be fully accurate I'll describe how you can make it not-lazy a little further down. How to download and install This was built as a core module for ProcessWire 2.1 (development version), so you need to grab the latest commit of the development version and you will have the module. This module is not compatible with PW 2.0 (stable version). ProcessWire 2.1 is at: https://github.com/ryancramerdesign/P21 If you already have the latest commit of ProcessWire 2.1, go to your modules menu, click "check for new modules" at the bottom, and then click the "install" button for the LazyCron module. LazyCron is now installed and ready to be used by other modules or via the API. Hookable time intervals These are the function names you can hook from LazyCron. The function names describe the time intervals they provide. If you think I'm missing any important time intervals, please let me know and I can add more. every30Seconds everyMinute every2Minutes every3Minutes every4Minutes every5Minutes every10Minutes every15Minutes every30Minutes every45Minutes everyHour every2Hours every4Hours every6Hours every12Hours everyDay every2Days every4Days everyWeek every2Weeks every4Weeks How to use it This module is mainly of use inside the API and to other modules. You hook one of the named intervals mentioned in the list above, and the function you provide will be executed at approximately that time interval. Here's how you do it, both from a class (module) and outside of one: Usage in a class/module <?php // initialize the hook in your AutoLoad module public function init() { $this->addHook('LazyCron::every30Minutes', $this, 'myFunc'); } // the function you want executed every 30 minutes public function myFunc(HookEvent $e) { echo "30 Minutes have passed!"; } Procedural usage (like in a template or elsewhere in the API): <?php // create your hook function function myHook(HookEvent $e) { echo "30 Minutes have passed!"; } // add a hook to your function: wire()->addHook('LazyCron::every30Minutes', null, 'myFunc'); Arguments provided to the hooks If desired, you can retrieve the number of seconds that have actually elapsed since your hooked function was last called: <?php function myHook(HookEvent $e) { $seconds = $e->arguments[0]; echo "30 Minutes have passed! (actual seconds were: $seconds)"; } Note that in production usage, you probably wouldn't want to echo anything from these hooks because they are executed after the pageview was already delivered. So while you can directly echo output from these, it's probably not that useful (other than for demonstration purposes, like this). How it works When installed, LazyCron hooks into ProcessWire's ProcessPageView::finished() method. This ensures that the scheduled tasks are executed after the pageview has already been delivered rather than before or during it. This hopefully avoids any perceived slowdown if the scheduled tasks take time. LazyCron provides a bunch of hooks that anything else can hook into. These functions are outlined in the section above titled "Hookable time intervals." These functions are called at the interval specified in their name. LazyCron simply uses ProcessWire's existing hook system. So when you hook into any one of these functions, your hook will also be executed at that same time interval. LazyCron hooks are only executed during pageviews that are delivered by ProcessWire. They are not executed when using ProcessWire's API from other scripts. How to make it not-lazy In most cases, the way that LazyCron works out of the box is just fine. But if your need requires assurance that the module will always execute at exactly the interval you need (rather than possibly later), you need to setup a real cron job to trigger a pageview in your site. So if you needed accuracy to 1 minute, you'd setup a cron job to execute every one minute, and pull a page from the site. There are any number of ways you could pull a page from your site, but here is one using wget: wget --quiet --no-cache -O - http://www.your-site.com > /dev/null That command basically says to pull a page from the site, don't tell us anything, don't cache the request, and discard any output.
    1 point
  41. Pete, I reckon all what you have stated are the reasons why so many of us have gravitated to Processwire. I did a bit of scouting before we ended with Processwire. The search was for light, fast systems [coming from Joomla, WP, Drupal that was necessary] as we had enough problems building large sites with those CMS. And what I read and saw about PW here was promising. We started with one programmer who was briefed to experiment with it and within a week he was going ga ga over PW. We then took it forward to the entire team. Now, we have 10 of them working on Processwire, on various projects. PW is the choice CMS at Pigtail Pundits, replacing WordPress and the occasional Drupal project. It has given the team here new energy and fresh possibilities and that's remarkable in itself. May it continue in absolute abundance, for PW, and for the entire community behind this remarkable system.
    1 point
  42. Hi nghi, $image->removeVariations(); If you want to do that for a whole site you do it best way with a bootstrapped script and foreach page with image(s) fields. There are a lot of examples here in the forums. If you cannot find one or have a question please come back here and ask. PS: you cannot create two files with the same width/height. If you want to compare quality, just use size(500,0) and size(501,0).
    1 point
  43. Having passed to the specified address the user can replace the email address, in result of that, it can replace the address with the address of the existing user, such in a way having used possibility of change of the password, to change the password and to come on a site under account of other use https://github.com/ryancramerdesign/ProcessWire/pull/192
    1 point
×
×
  • Create New...