Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 03/23/2023 in all areas

  1. Incoming update of Duplicator v1.5 --- Encryption is being implemented, if you want to give a try, the feature is available on the branch feature-encryption : - https://github.com/flydev-fr/Duplicator/tree/feature-encryption More infos and Instructions can be found by reading or running the script generate-keys.php on a terminal. --- I shared infos with Steve, I also want to share it with you : => Test on a Package of 687MB on PHP8.1 Do not take care of performance info given on this post, see ?
    3 points
  2. Then I must say that the bad performances was due to my machine and/or setup (caddy/php-fpm, thats is quite bad and sad on Windows). On the Windows Server, performance are ? ! A backup of a setup of 2.11GB, once compressed, 801MB, the whole process took 107sec ✅ ?? encryption: 2.5sec decryption: 3.5sec Not bad ?
    2 points
  3. <?php public function editFormContent($form) { $form->add([ 'type' => 'text', 'name' => 'published', 'label' => 'Published at', 'value' => date("Y-m-d H:i:s", $this->published), ]); } public function onProcessInput($form, $input) { $pub = date("Y-m-d H:i:s", strtotime($input->published)); $query = $this->wire->database->prepare( "UPDATE pages SET published=:pub WHERE id=:id" ); $query->execute([':pub' => $pub, ':id' => $this->id]); } ?
    2 points
  4. Yes sorry, I edited my post after posting it. Yes ok, that's what I had in mind. Actually, with Halite, it shouldn't be possible. The only solution I have in mind after I read the C library yesterday, is the need to write another wrapper to be able to set max execution time limit in the process. This is what I meant on my previous post > As I have no control over the stream (Halite seal encryption use chunks on stream when using the File class)...
    1 point
  5. Currently on Digital Ocean (although will actually be moving the project to AWS shortly). I just ran a backup from the CLI and in that situation (where the timeout doesn't come into affect), it seems to have worked as expected, with both the zip and zip.enc files having the same size, but I am still confused why the .zip is kept - shouldn't that be deleted after the creation of the .zip.enc file? Actually, should both be exactly the same file size - does the encryption not result in some change? I came across the timeout when trying to run a backup from ProcessDuplicator using the native DB / local only options - I still think this need to work.
    1 point
  6. Just looking into that libsodium error. I see that it's being generated by Halite's isLibsodiumSetupCorrectly() function, but when I call the components from that I get the following, which suggest it should be ok. Actually, it's just a case of inverted logic in your code - note the ! where it shouldn't be. if (!\ParagonIE\Halite\Halite::isLibsodiumSetupCorrectly()) { $field->notes = __("☑️ `libsodium` setup [**OK**]"); } else { $field->notes = __("⚠️ `libsodium` setup [**FAIL**]"); }
    1 point
  7. Hi @flydev - thanks so much for your work on this. I've just been testing it out and have a few questions: 1) I am seeing libsodium setup [FAIL] at the bottom of the private key section in the config settings. I have libsodium-dev and php-libsodium installed so not sure where there error is coming from. Any ideas? 2) The backup seems to work as expected, but I am seeing both .zip and .zip.enc files created. Are they both supposed to remain after the backup has completed running? 3) Is is expected that the .enc version is about 2/5ths the size of the main .zip file? Actually, I think I just answered #2 and #3 - turns out I got this error Fatal Error: Maximum execution time of 300 seconds exceeded (line 23 of /paragonie/sodium_compat/src/Core/ChaCha20.php) which I suppose means the encryption didn't complete. Do you think it would make sense to override the php time limit within this process to avoid this? Thanks again!
    1 point
  8. OK - this kind of works: In my template I've included the Cloudflare script (and added their end point to the content security policy). Then I'm injecting a placeholder into the form: $comments_form= $page->comments->renderForm(array( 'requireHoneypotField' => 'email2' )); // add a div with class="cf-turnstil" to the form - this gets replaced with a token (after a successful challenge) $cft_tag='<div class="cf-turnstile" data-sitekey="yourturnstilesitekey"></div>'; $comments_form=str_replace("CommentForm' method='post'>","CommentForm' method='post'>$cft_tag", $comments_form); echo $comments_form; Cloudflare replaces that with a token if they think you're not a bot. Then in init.php (not _init.php) I'm hooking into ProcessPageVIew $this->addHookBefore('ProcessPageView::execute', function(HookEvent $event) { if(wire('input')->post('CommentForm_submit')){ // get the Cloudflare token. $cf_token=wire('input')->post('cf-turnstile-response'); // and send it to siteverify $postdata = http_build_query( array( 'secret' => 'yoursupersecretcloudflaresecretkey', 'response' => $cf_token ) ); $opts = array('http' => array( 'method' => 'POST', 'header' => 'Content-Type: application/x-www-form-urlencoded', 'content' => $postdata ) ); $context = stream_context_create($opts); $api_json_response = file_get_contents('https://challenges.cloudflare.com/turnstile/v0/siteverify', false, $context); if($api_json_response ){ // check result and redirect if failed. $result=json_decode($api_json_response,TRUE); if(!($result['success'])){ // die or redirect or whaterver you fancy. // print_r($result); // die("Failed verification."); wire('session')->redirect('/some-help-page-or-something/'); } }else{ // die or redirect or whaterver you fancy. die("No response from verification server."); } } }); If we have a comment that's been submitted then I check the token with Cloudflare. If it fails we can redirect or die or something - it'd be nice to fail a bit more gracefully. No idea how well this will deal with spam and I think I'll need to do some user testing but I think it might be useful.
    1 point
  9. Sometimes it can help if you choose another syntax, i.e. pages()->find() or \ProcessWire\wire - depending on whether you're editing a template or module. Give it a try. There's also this:
    1 point
  10. Yes, but was the whole process, encrypting the 687MB and decrypting it. Encrypting took nearly 1h48. On my side, it's not usable as I have some databases of 7GB or even 11GB, and a custom tool handle it, but of course, it's only available on private server where we have the hand on it. I will launch this afternoon a test on a Windows Server with Xeon CPU and 32GB of RAM, let's see.. The issue of processing time will be tackled, but only on a private server. Anyway, having a huge database or file size on a shared server should not be too frequent (I have no stats to look at..). Do not take care of performance info given on this post, see ?
    1 point
  11. Under 4 hours 27 mins 52 secs? Protecting data is very expensive for sure. It's just that lawmakers don't give a damn about that because it's not they who need to pay the price. Anyway, thank you for advancing Duplicator!
    1 point
  12. Thanks @elabx(although slightly discouraging that even you gave up...). I think I'm going to switch tack and hook in ProcessPageView::execute to check the token and then just redirect if it fails. I'll let you know how I get on....
    1 point
  13. @horst after a PHP upgrade to 8.2 we get these deprecation warnings: PHP Deprecated: Creation of dynamic property ImageManipulator02::$originalImage is deprecated in ImageManipulator02.class.php:215 PHP Deprecated: Creation of dynamic property ImageManipulator02::$configOptions1 is deprecated in ImageManipulator02.class.php:265 PHP Deprecated: Creation of dynamic property ImageManipulator02::$configOptions2 is deprecated in ImageManipulator02.class.php:267 PHP Deprecated: Creation of dynamic property ImageManipulator02::$dibIsLoaded is deprecated in ImageManipulator02.class.php:839 PHP Deprecated: Creation of dynamic property ImageManipulator02::$iptcRaw is deprecated in ImageManipulator02.class.php:362
    1 point
  14. I kinda tried this and gave up lol but here's what I found: You'd probably start with the CommentFormCustom class: https://github.com/processwire/processwire/blob/master/wire/modules/Fieldtype/FieldtypeComments/CommentFormCustom.php The first comments have a little bit on how these could be used. I THINK, that something not covered is upadting the processing of the comment, so my guess is that you could implement your own "CommentFormMillipedia" for example, extending CommentForm just like CommentFormCustom, and override the processInput method, so you could process additional stuff, aside from the form fields. Although from reading the code you'd probably have to copy the whole FieldytpeComment module due to the way ComentFormCustom class is loaded. To be honest it was a bit suprised to see the comment form is not built with the Inputfields API! Maybe to allow more simplicity on the rendering?
    1 point
  15. thank you @Denis Schultz simply adding it to sass uikit which i compile anyway makes a lot of sense
    1 point
  16. Using RockMigration's MagicPages feature: <?php public function editFormContent($form) { $form->add([ 'type' => 'markup', 'label' => 'Published at', 'value' => date("Y-m-d H:i:s", $this->published), ]); } No additional fields needed as @Jan Romero said ?
    1 point
  17. I think I should add some infos about generating a working API key in the readme ?
    1 point
  18. Another thought, you may want to record invoices separately from orders, to deal with unsatisfied or partially satisfied orders. Alternatively this might be handled by status fields on order lines. At the risk of repeating myself, getting the business specification right is paramount. PS I absolutely agree with @teppo regarding decimal fields. A slip on my part.
    1 point
  19. BTW, on the frontend I use this https://github.com/brick/money which works well. It is a bit verbose to do math like that, but worth the hassle.
    1 point
  20. Use decimal, already in the core, see (FieldtypeDecimal uses InputfieldFloat): https://github.com/processwire/processwire-requests/issues/126 https://weekly.pw/issue/367/ "Float and integer fields are now considered compatible with the newly added decimal field, making it possible to convert these from one type to another." If you feel like applying custom formatting in the admin, see :
    1 point
  21. Thank you @bernhard for this extensive post. I use RockMigrations every day and love it, as I stated often before. It isn't as hard as it looks at first. Just try it out and if you should stumble over something, then just ask for support here in the forum. RockMigrations saves much time and makes it easy to develop features in your dev environment and then when the feature is finished push the changes to the live server with migrations being executed automatically, which creates all fields, templates and even pages and contents. Could live without it, but that would be a sad life. So.... start using it now!
    1 point
  22. Since I had to update more and more projects lately and also the PHP version of some of these projects was set to >=8 in the meantime I created a fork of the module and updated mPDF to version 8.1.3. With only some small changes in the WirePDF module I can now continue to use Pages2PDF without any restrictions. Maybe this is helpful for someone. https://github.com/markusthomas/Pages2Pdf
    1 point
  23. I guess they are able to trash pages but just don't see the trash button on the page list? Modules > Core > ProcessPageList > Check the checkbox to allow non-superusers to use the trash button from the pagelist
    1 point
  24. I like repeaters for structuring data. For building a layout, not so much. I've seen the demo's on this forum of people using repeaters in creative ways to build a layout, but it never looks very intuitive to me. I've grown to dislike this approach so I've been looking at other content management systems for inspiration. Bolt CMS uses Article Editor, which is a nice (paid) javascript solution that's basically an advanced wysiwyg editor with support for grids and other nice features. I decided to integrate this into Processwire as an inputfield. Here's a demo: I created a few plugins for Article Editor that take care of uploaded images, inserting links and Hanna code support for adding dynamic bits to the editor. And the field also works in repeaters. You can pass your CSS to the editor so that the editor preview should look identical to the real page. I am using Bootstrap. A bonus of building a page this way is that the whole layout is stored in a single field so there should be fewer requests to the database compared to repeaters. Please note that since Article Editor is not free, you need a license to use it. I've been working on this module on and off for a while. There are refinements to be made, like perhaps loading the Hanna code previews dynamically (they are currently inserted into the editor after saving the page). Not sure if it would be good enough to release publicly but I thought I'd share it anyway because I'd like to hear if you think this is a nice approach :)
    1 point
×
×
  • Create New...