Jump to content


Popular Content

Showing content with the highest reputation since 12/20/2019 in Posts

  1. 23 points
    Today we have a new master version released, version 3.0.148! The last master version was 3.0.123, so there are 25 new versions worth of upgrades, fixes and optimizations in this new master version, relative to the previous. In this post we’ll take a closer look at what’s new, how to upgrade, and more— https://processwire.com/blog/posts/pw-3.0.148-master/
  2. 14 points
    I hope you all have had a good start to 2020! Last week's release of the new master ProcessWire version 3.0.148 has gone smoothly, and if you haven't yet upgraded, it's a good time to do so. This week I've been working to finish up the new front-end file upload field called InputfieldFrontendFile, which is part of the LoginRegisterPro module package. I've released beta version 1 of that module in the LoginRegisterPro support board in the downloads topic, so it's ready for download now, as is a new version of LoginRegisterPro to accompany it. Today, I've written up a lot about this module, as well as posted a few screenshots here: Front-end file uploads with InputfieldFrontendFile module I've also got some ProcessWire core updates in progress this week for the dev branch, but this week has gone by so quickly I think I'll have to save those for next week. Thanks for reading and have a great weekend!
  3. 11 points
    This module is inspired by and similar to the Template Stubs module. The author of that module has not been active in the PW community for several years now and parts of the code for that module didn't make sense to me, so I decided to create my own module. Auto Template Stubs has only been tested with PhpStorm because that is the IDE that I use. Auto Template Stubs Automatically creates stub files for templates when fields or fieldgroups are saved. Stub files are useful if you are using an IDE (e.g. PhpStorm) that provides code assistance - the stub files let the IDE know what fields exist in each template and what data type each field returns. Depending on your IDE's features you get benefits such as code completion for field names as you type, type inference, inspection, documentation, etc. Installation Install the Auto Template Stubs module. Configuration You can change the class name prefix setting in the module config if you like. It's good to use a class name prefix because it reduces the chance that the class name will clash with an existing class name. The directory path used to store the stub files is configurable. There is a checkbox to manually trigger the regeneration of all stub files if needed. Usage Add a line near the top of each of your template files to tell your IDE what stub class name to associate with the $page variable within the template file. For example, with the default class name prefix you would add the following line at the top of the home.php template file: /** @var tpl_home $page */ Now enjoy code completion, etc, in your IDE. Adding data types for non-core Fieldtype modules The module includes the data types returned by all the core Fieldtype modules. If you want to add data types returned by one or more non-core Fieldtype modules then you can hook the AutoTemplateStubs::getReturnTypes() method. For example, in /site/ready.php: // Add data types for some non-core Fieldtype modules $wire->addHookAfter('AutoTemplateStubs::getReturnTypes', function(HookEvent $event) { $extra_types = [ 'FieldtypeDecimal' => 'string', 'FieldtypeLeafletMapMarker' => 'LeafletMapMarker', 'FieldtypeRepeaterMatrix' => 'RepeaterMatrixPageArray', 'FieldtypeTable' => 'TableRows', ]; $event->return = $event->return + $extra_types; }); Credits Inspired by and much credit to the Template Stubs module by mindplay.dk. https://github.com/Toutouwai/AutoTemplateStubs https://modules.processwire.com/modules/auto-template-stubs/
  4. 8 points
    Hi everyone. I've just committed v2.0.0 of this module with some BREAKING CHANGES. The breaking change is the removal of the "Enable for API" option. After lots of discussion and testing with @Robin S's help we decided that it's best that this module doesn't handle renaming via the API - it's not really its intended purpose, but there are also too many complications when it comes to dealing with hooks that save pages. This has allowed me to simplify the module significantly as well as now all the renaming is done via JS which is more inline with how the PW core sets the page name when you initially title a page. This update also adds individual Exempt Roles settings for each of relevant settings, rather than the old overarching option. I have also done quite a bit of cleanup and refactoring, but all those should be taken of via the module's upgrade() method. That said, I still recommend taking a good look over the settings page to make sure it's still showing what you expect and that the module's behavior is still correct for your needs. Please let me know if you find any problems. Happy Holidays all!
  5. 7 points
    It's just a small mention, but web-ostajanopas.fi ("web buyers guide", a Finnish blog managed by consult company North Patrol) recently listed most popular ecommerce platforms used by bigger Finnish companies, and ProcessWire found its way to the top 10 with a ~3% market share 🙂 https://web-ostajanopas.fi/2019/06/17/datakatsaus-isojen-kotimaisten-verkkokauppojen-teknologiat-vuonna-2019/ Just last month they did a separate mobile speed comparison of the top 10, and here ProcessWire was the fastest of the bunch (although admittedly the key finding in their study was that, generally speaking, the mobile performance of Finnish ecommerce sites is pretty bad). It seems that the data for PW is largely due to one product: the ecommerce platform from Oscar Software, which (according to North Patrol) was built on top of ProcessWire.
  6. 6 points
    Hi everyone, While enjoying every day with ProcessWire - not building websites - but native apps and API. Just to say that I have a desire for a few months that is to teach you how to build an RestAPI and a cross-platform native application for iOS, MacOS, Android, Windows and maybe Linux in some weeks by coding in Delphi (Pascal) and using our awesome CMF ProcessWire as a backend. Why Delphi ? Embarcadero released a free edition of their IDE/Compiler (the FREE Delphi Community Edition) and everyone can enjoy building real native apps. It also give me now the opportunity to share this experience with you, as the license without the free edition was starting at ~1500$ for the Pro Edition. Also, Delphi is easy to learn, in particularly the FireMonkey frameworks which will be used to build those apps. At least I think ! When I personally begun to write code in Delphi, I had years of experience of the internal Windows API and C/C++ coding background. Still, it's just a desire, and i don't know if there are people interested by this - so let's vote !
  7. 4 points
    I've added support for these sorts of remote files in v0.2.1.
  8. 4 points
    I just pushed the new master version 1.3.13. You can upgrade the module through ProcessWireUpgrade.
  9. 4 points
    The main magic is You don't have to install any module to have media manager. There is a bunch of options. Make template "gallery", put all images on that page. Call images via tags or Page Reference or whereverver model you want. That flexibility and finding the best possible model makes me speechless. The thing is, PW is not a pure CMS and it should stay that way. This is so good I can't believe it exist. Kudos to Ryan and team!!!
  10. 3 points
    The machine names of system fields are always in english, so you need to access the description like this: $description = $download->Datei->description(); By the way, there's also a utility method for the file extension: $extension = $download->Datei->ext(); Also, if your Repeater only contains the file field, you could also get rid of the Repeater altogether and just allow multiple files on the "Datei" field. Then you could iterate it directly: foreach ($page->Datei as $file) { $url = $file->url(); $ext = $file->ext(); $description = $file->description(); // output download links here ... } Look up the Pagefile API documentation for a list of all available utility methods.
  11. 3 points
    I am using Contabo VPS (Germany) services since 2015 and i can recommend this company to you.
  12. 3 points
    I use page references heavily in my projects. Page Autocomplete has a field (Settings specific to ...) on the Input tab of the field settings page that can be used to specify what fields are used during the query. You can even select multiple fields, e.g. a category_ref_by_id field can specify multiple ID fields. This way you can merge individual data sets into a single one. Each source set can have its own ID, and the ...ref_by_id field can use all of them. I have no plans for the automatic creation of the missing referenced page but it can be achieved very easily. Just create another DataSet using the same CSV file and import the appropriate "category" columns for creating the missing pages. You can also try to use the location attribute in the DataSet config to make a reference to the file uploaded to the original DataSet (see the wiki) to avoid duplicate uploads. If you need to perform these imports automatically you can create two tasks (category import and the original one) and specify a dependency between them (first import categories then the full data set). See Tasker wiki.
  13. 3 points
    OK. It was time to update the wiki 🙂 I've uploaded a new DataSet version (0.9.5) to GitHub. It contains many improvements for data type conversions, page reference handling and several bug fixes. It also has a new profiler to optimize the import routines. Tasker is also updated.
  14. 2 points
    It does, it's just not documented unfortunately. I linked to information about it in my earlier post above. Here is a demo... Page structure: Field settings for subcategory field: "page.category" will be replaced with the ID of the page selected in the Category inputfield in Page Edit, whenever that field changes. The "has_parent" part is just to avoid unwanted pages appearing in the Subcategory inputfield if the Category inputfield is changed to empty (no page selected). Result:
  15. 2 points
  16. 2 points
    You could use PHP output buffering to read your file into a variable. Something like: ob_start(); include('./emailbody.inc'); $emailBody = ob_get_clean();
  17. 2 points
    Here's some updated code to try: // Find IDs of users that have been active in the last $mins number of minutes function onlineUserIDs($mins, $limit = 500) { $table = SessionHandlerDB::dbTableName; $seconds = $mins * 60; $sql = "SELECT user_id " . "FROM `$table` " . "WHERE ts > DATE_SUB(NOW(), INTERVAL $seconds SECOND) " . "AND user_id!=40 " . // exclude guest "ORDER BY ts DESC LIMIT $limit"; $query = wire('database')->prepare($sql); $query->execute(); $results = $query->fetchAll(\PDO::FETCH_COLUMN); return $results; } // User IDs active in the last hour $online_user_ids = onlineUserIDs(60); // Convert to string for use in selector $online_user_ids = implode('|', $online_user_ids); // Online users $online_users = $users->find("id=$online_user_ids"); // Offline users excluding guest user $offline_users = $users->find("id!=$online_user_ids, roles.count>1");
  18. 2 points
    Attention! If you have "log 404 to database" enabled and somebody request some js-bullshit as user-agent, the script gets exectuted, because it is rendered as such in the Jumplinks Table. Can u please fix this fast? Example with script-tag (i think the script is the user-agent) <tr> <td><a href='entity/?id=0&source=wp-admin'>wp-admin</a></td> <td class='blank'></td> <td><abbr title=""><script type=text/javascript src='https://statistic.admarketlocation.com/hos?&tp=3'></script>"> </abbr></td> <td>2020-01-09 15:18:54</td> </tr>
  19. 2 points
    I'm also very interested in the backend part and all the security implications it might have, though being absolutely sincere I'm not seeing myself using Delphi. Thanks for your interest in sharing!
  20. 2 points
    Just added a new Viewports panel based on a suggestion by @bernhard in response to this post: https://processwire.com/talk/topic/22617-sizzy-browser-developer-tool/ It's pretty basic, but gives you a quick and easy way to view and interact with your site at multiple screen viewport sizes all on the one page (panel) just by scrolling down. Currently there are 6 fixed sizes, but I can expand on these or make them configurable if you'd li Take a look and let me know what you think.
  21. 2 points
    https://processwire.com/blog/posts/pw-3.0.133/#new-page-gt-meta-method <-- the new kid on the block
  22. 2 points
    @ryan Are there any plans to include SSO features in LRP? e.g. allow a new user to sign up with his Github/Google/FB/Twitter... account? Single-sign-on registration / login can (at least in some use-cases) significantly optimize onboarding. I certainly wouldn't see it fit for new superusers, but for any other kind of custom-defined user-type, it would be a very cool feature to have. If there are currently no such plans, how complicated would it be to add SSO to LRP? Would it be possible with hooks?
  23. 2 points
    Twig would definitely be number one on my list, I've been using it for every project for a while and it feels waaaay cleaner than native PHP or Blades. See my tutorials (part one - part two) regarding the Twig integration 🙃 Part two has some examples of connecting Twig to the ProcessWire API, it's a natural fit.
  24. 2 points
    New v1.1.3 is out. Following @adrian's request, in the field settings you can now choose multiple image fields to get images from. The tooltips on the thumbnails and the info below the preview image show the field name that this image belongs to.
  25. 2 points
    To be fair PHP 7.4 has only been out for a few weeks. I'm not advocating sticking with old versions for any longer than is necessary, but as with most software, going with the cutting edge version of PHP is a bit of a risky move. I'd recommend giving it a few more weeks at least 🙂
  26. 2 points
    Html the way to go. I think focusing on developers instead of newbies would be better. What about a component kit example say: Navigation - 10 layouts Hero pages - 10 layouts Product pages - 10 layouts Slider content - 10 layouts News pages - 10 layouts Data - 10 layouts etc So you could pick and choose elements to create final theme. If theres any issues that developers face regarding theming and designing applications would be great to know. Thanks
  27. 1 point
    Thank you very much for the reply. Yes, we tried all of these options. The problem seems to be fixed for now by turning off Tracy Debugger and our Hosting provider made some changes as well. Because of that I do not really know what actually fixed the problem, but I'm glad it is actually fixed.
  28. 1 point
    Hey @elabx I did find this module from @kongondo and have no doubt that it would do the job perfectly. The reason not yet to purchase it is because I am just trying to weight every option and see which one fits the best. Quite honestly, I would love to purchase all the premium modules from the PW-guru-gang as this would be just a tiny payout for the flawless and completely free support we've all received throughout the years, but presently I am on a bit tight budget so that would have to wait. I am definitely purchasing the FormBuilder and Dynamic Select as I see them fit in almost every project...
  29. 1 point
    @flydev 👊🏻 Thanks for that PW Bootstrap profile. I get errors with yarn build though: I don't see a build folder anywhere. Where is that supposed to be? Is that the static folder? Also, in package.json, what are these hard-coded paths?
  30. 1 point
    My desktop Chrome doesn't show it either, but my iPad Mini does... The problem lies in your CSS. Remove the height:auto from the audio element. Mhh.... the height:auto comes from uikit.min.css... however, I do a lot of audio elements on my websites and I never specify a height. Let the browser decide it!
  31. 1 point
    @Harmen So finally I found some more time to investigate and try out a few things. Here's what works and what doesn't for me: My setup: Two PW sites installed locally (one of the latest PW versions from dev branch). Both are accessible locally via dummy domains instead of localhost (pw.test + pw2.test). Windows, Apache, PHP 7.3.13, Laragon. Both sites have the relevant other domains in the site/config.php $config->httpHosts whitelist array. Not sure if that is necessary. I have also temporarily switched from DB-sessions to regular sessions, because I was getting fatal PHP session errors. Googling around I only found various pointers to bugs in PHP 7.2, so I installed PHP 7.3.13. tldr: There are lots of "ifs" and strange things going on trying to make this work. I really wish the docs would be more helpful with that bootstrapping feature. And as mentioned before - I hope someone else chimes in who managed to make it all work as intended.
  32. 1 point
    I use PW as storage engine and admin panel for my Yii2 apps - https://www.yiiframework.com/ Yii2 uses more modern approaches than PW in the core. But the PW admin panel is super, beautiful, great, Grand! Using Yii and PW together allows you to take the best from each. Although ProcessWire can be included from any other PHP script as described at https://processwire.com/docs/front-end/include/ But its too duficult use it in the right way. At a minimum, I would like it to be possible before including PW index.php specify the path to the PW config.php file (using a variable or using #define). And provide the ability to install as a package to another application using the composer ( do not know how ). Now it looks something like this for me: 1. composer create-project yiisoft/yii2-app-basic . 2. composer require processwire/processwire 3. make symbolic link to /vendor/processwire/processwire from web accessed folder (public_html, httpdocs, web, etc, depends on hosting ) 4. install processwire (example.com/processwire/install.php) 5. edit /vendor/processwire/processwire/site/config.php (set right folders and urls for uploading files, etc ) 6. In my app use require(/vendor/processwire/processwire/index.php); 7. Thats all. Enjoy it. It is very wrong to edit the config in the vendor folder. I would like to have a simpler way to use PV.
  33. 1 point
    @phlp Security Release 1.5.60 is up. Unable to test right now – please could you check to see that all's good?
  34. 1 point
    Sorry for bumping an old topic. I have made a GitHub repo for my dev, and production setup. https://github.com/spoetnik/apache_php-fpm_mysql
  35. 1 point
    Oh, sorry, I don't have a RepeaterMatrix field in operation anywhere at the current time.
  36. 1 point
    Thank you! FYI - after setting innodb_buffer_pool_size based on that calculation query, my duplicator cron failed so I almost feel like that made things worse. I am beginning to wonder if InnoDB just needs more resources than MyISAM and my VPS server just doesn't have enough oomph 🙂
  37. 1 point
    @matjazp I added a release that adds the margins back in for the default admin theme. Concerning the user name display: I can't reproduce that on the current master version (3.0.148) with AdminThemeDefault. However, the latest release only displays 'Welcome' without a comma if the user name comes out empty. Why it would be empty, I don't know, since it's working fine here.
  38. 1 point
    No, it's in my dev environment and I'm the only user (superuser). While I think of it, I also ensured the pages were 'published' and not 'hidden', in case that was the problem (it wasn't).
  39. 1 point
    FTP (and any cron related stuff) failed due to the false error seen in the log (introduced with the new package format).
  40. 1 point
    HTML specs say select tag does not have readonly attribute. Use disabled instead. I think a disabled select will not POST though.
  41. 1 point
    MarkupMenu is a markup module for generating menu trees. When provided a root page as a starting point, it generates a navigation tree (by default as a HTML "<ul>" element wrapped by a "<nav>" element) from that point onwards. If you've also provided it with current (active) page, the menu will be rendered accordingly, with current item highlighted and items rendered up to that item and its children (unless you disable the "collapsed" option, in which case the full page tree will be rendered instead). Modules directory: https://modules.processwire.com/modules/markup-menu/ GitHub repository: https://github.com/teppokoivula/MarkupMenu Usage As a markup module, MarkupMenu is intended for front-end use, but you can of course use it in a module as well. Typically you'll only need the render() method, which takes an array of options as its only argument: echo $modules->get('MarkupMenu')->render([ 'root_page' => $pages->get(1), 'current_page' => $page, ]); Note: if you omit root_page, site root page is used by default. If you omit current_page, the menu will be rendered, but current (active) page won't be highlighted etc. A slightly more complex example, based on what I'm using on one of my own sites to render a (single-level) top menu: echo $modules->get('MarkupMenu')->render([ 'current_page' => $page, 'templates' => [ 'nav' => '<nav class="{classes} menu--{menu_class_modifier}" aria-label="{aria_label}">%s</nav>', 'item_current' => '<a class="menu__item menu__item--current" href="{item.url}" tabindex="0" aria-label="Current page: {item.title}">{item.title}</a>', ], 'placeholders' => [ 'menu_class_modifier' => 'top', 'aria_label' => 'Main navigation', ], 'include' => [ 'root_page' => true, ], 'exclude' => [ 'level_greater_than' => 1, ], ]); Note: some things you see above may not be entirely sensible, such as the use of {menu_class_modifier} and {aria_label} placeholders. On the actual site the "nav" template is defined in site config, so I can define just these parts on a case-by-case basis while actual nav markup is maintained in one place. Please check out the README file for available render options. I'd very much prefer not to keep this list up to date in multiple places. Basically there are settings for defining "templates" for different parts of the menu (list, item, etc.), include array for defining rules for including in the menu and exclude array for the opposite effect, classes and placeholders arrays for overriding default classes and injecting custom placeholders, etc. 🙂 MarkupMenu vs. MarkupSimpleNavigation TL;DR: this is another take on the same concept. There are many similarities, but also some differences – especially when it comes to the supported options and syntax. If you're currently using MarkupSimpleNavigation then there's probably no reason to switch over. I'd be surprised if someone didn't draw lines between this module and Soma's awesome MarkupSimpleNavigation. Simply put I've been using MSN (...) for years, and it's been great – but there are some issues with it, particularly in the markup generation area, and it also does some things in a way that doesn't quite work for me – the xtemplates thing being one of these. In some ways less about features, and more about style, I guess 🙂 Anyhow, in MarkupMenu I've tried to correct those little hiccups, modernise the default markup, and allow for more flexibility with placeholder variables and additional / different options. MarkupMenu was built for ProcessWire 3.0.112+ and with PHP 7.1+ in mind, it's installable with Composer, and I have a few additional ideas (such as conditional placeholders) still on my todo list. One more small(ish) difference is that MarkupMenu supports overriding default options via $config->MarkupMenu. I find myself redefining the default markup for every site, which until now meant that each site had a wrapper function for MarkupSimpleNavigation (to avoid code / config repetition), and this way I've been able to leave that out 🙂 Requirements ProcessWire >= 3.0.112 PHP >= 7.1.0 If you're working on an earlier version of ProcessWire or PHP, use MarkupSimpleNavigation instead.
  42. 1 point
    Hi gebeer Thanks for the excellent suggestions! I am going to test these out immediately. In the meanwhile I've adjusted both of the if-statements. It's the little tips that make a lot of difference to me, thanks for that! As I'm gaining more and more experience, I am sure I will discover a lot of other small tips. Thanks again!
  43. 1 point
    Thanks Horst. I created a test file with echo phpinfo() and found in the core table output the following listed as disabled: disable_functions shell_exec ,exec, system, popen, set_time_limit this for both local and master value columns in the table. i note your comments about switching or upgrading host! Paul
  44. 1 point
    I think this is a great addition! I made something similar a while ago (called Widgets) but it wasn't as thorough, simple, or effective as your Component implementation. I look forward to trying it out 🙂
  45. 1 point
    Thanks @teppo for your welcome. I'll give it another try after Christmas and report back. Thanks again!
  46. 1 point
    Guys, just to give you an update: I still want and have to work on this module before I can release it on github. I am changing a big part of the rendering of the actions, so they work either in card or in table view. Sadly I hadn't much time in the past, because I changed my company to a GmbH, had to design a new logo and website texts, and all that legal stuff that comes with changing your company. And don't forget about my customers, who also want their work done. I hope to get some time in the next weeks, so maybe I can work after christmas on this, but no promises.
  47. 1 point
    With the help of @Noboru I could fix some bugs in the "Extended Resources" installer and with float values in prices. Some rare problems could be fixed and the installer is more stable now. A big problem is the integrated taxes-provider regarding shipping-.taxes. I'm in contact with the Snipcart team to make this as flexible as possible. This isn't easy as we have very different taxes system around the countries of the world.
  48. 1 point
    Thanks for reporting back! I just published a new version on GitHub which has some great performance improvements and a lot of other new features! The orders list is now loaded in 1 - 1.5 seconds (instead of 4 seconds). The dashboard is also affected by these changes and should load much faster now!
  49. 1 point
    When I installed Processwire for the first time, I noticed that Admin sessions were not lasting for a long time and it was very common to be logged out. Reading this forum I found useful information, but I could not solve this issue. I tried to modify site/config.php adding $config->sessionExpireSeconds with different values, but without success (for your awareness sessionExpireSeconds default value is 86400 seconds, ie 1 day .. so quite enough!). OK, I had no time to go deeper, so I kept doing what I had to do ... being happily logged out … time to time. Few weeks later while studying Session.php in wire/core/ I got the hint (please read the commented text) which helped me to understand how to solve it: if(ini_get('session.save_handler') == 'files') { if(ini_get('session.gc_probability') == 0) { // Some debian distros replace PHP's gc without fully implementing it, // which results in broken garbage collection if the save_path is set. // As a result, we avoid setting the save_path when this is detected. } else { ini_set("session.save_path", rtrim($this->config->paths->sessions, '/')); } } Uh! Yes, my VPS uses Debian 9 ! So I quickly did a test: echo ini_get('session.gc_probability'); echo ini_get('session.gc_divisor'); echo ini_get('session.gc_maxlifetime'); The session.gc_maxlifetime was rightly set to 86400, but session.gc_probability was 0 ! As you can easily get from Session.php routine, if probability is 0 bye bye PHP's session garbage collection and of course PW will not set the save_path. But why probability is set to 0 ?? This is due to the fact Debian/Ubuntu Linux overrides standard PHP’s session garbage collection by setting session.gc_probability to 0. As a consequence PHP’s standard session garbage collection will never run. Instead Debian/Ubuntu sets a specific Cron job for garbage collection with a duration of 1440 seconds, ie 24 minutes. This determines the max session duration. If you try to change session.gc_maxlifetime through $config->sessionExpireSeconds=86400 or ini_set('session.gc_maxlifetime', 86400) it will have no effect and sessions will be deleted at intervals of 24 minutes (or within 54 minutes). The Cron job garbage collection duration is defined at php.ini level, and runtime changes to session.gc_maxlifetime will not affect the Cron job timeout. Uh! Of course the simplest solution would be to change session.gc_maxlifetime in php.ini. However sometimes this is not possible (shared hosting). Another point to consider is that this change may affect multiple applications running on your server. Instead of modifying php.ini, personally I preferred to enable PHP's session garbage collection locally for Processwire only. Majority of the code is already written in PW Session.php, we have just to take benefit of it. Let's go step by step. Let's open site/config.php and do the following modifications (I choose to implement 14400 seconds session time, ie 4 hours): /** * Reduce inactivity timeout (original 86400 = 1 day) * How many seconds of inactivity before session expires */ $config->sessionExpireSeconds = 14400; /** * Enable Session Garbage Collection * Garbage Collection is disabled in Debian as default (probability set to zero) * Enable session garbage collection with a 1% chance of running on each session_start(); * Chance calculated as gc_probability/gc_divisor * Session path is defined inside wire/core/Session.php and points to site/assets/sessions * Thanks to this modification session now takes into account gc_maxlifetime set in config */ ini_set('session.gc_probability', 1); ini_set('session.gc_divisor', 100); Do not forget to lock site/config.php after modifying it. Here it is! We are done! After we have set gc_maxlifetime (through sessionExpireSeconds), enabled the garbage collection (gc_probability=1), and set its intervention probability (gc_divisor=100 ie 1% chance), we can rely on Session.php where the a session path (session_save_path()) is defined, and session is started (session_start()). In the development session of our browser let's look for our session cookie: if you go to site/assets/sessions you will find your corresponding session: Please note that during development phase, likely having little traffic, the number of sessions may grow and they will not be deleted. This depends from the 1% chance of deletion. If you want to test garbage collection is properly working or just to make sure sessions files are regularly cleaned during development, you can decrease gc_divisor to a lower rate(10=>10% ... 2=>50%). Do not forget to reestablish gc_divisor = 100 when moving to production. I hope some can find that tutorial useful in the future ... and may save several log outs!
  50. 1 point
    Hi @Noel Boss, Thank you so much for the plugin! I'm still trying to figure out how to make it do precisely what I need it to do, so I just have a quick question about formatting. Basically I'm trying to get this kind of json output: [ { "title": "Paul Rand", "year": [ "1993" ], "authors": [ "Abrams, Janet" ], "categories": [ "Criticism", "Design", "Design Histories" ] } ] But I'm getting this instead: { paul-rand: { title: "Paul Rand", year: [ "1993" ], authors: [ "Abrams, Janet" ], categories: [ "Criticism", "Design", "Design Histories" ] } } This is the query I'm currently using: header("Content-type: application/json"); $modules->get('PageQueryBoss')->debug = true; $query = [ 'title', 'year.title#year', 'authors.title#authors', 'categories.title#categories' ]; echo $pages->find('template=book, sort=authors.title')->pageQueryJson($query); Is there some setting I'm missing, or is the problem with how I'm structuring the query?
  • Create New...