Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 06/11/2018 in all areas

  1. I guess that a chat channel would simply mean too much distraction. imho, there's nothing wrong with using a forum as the main place of communication, even in 2018. The general expectation with chat is that there's always someone around within 3 seconds with a useful reply / solution / answer. IRL it doesn't always work like that, if you have a day-job and have to focus on your daily work at hand. This may sound like I'm all against having a PW Slack channel - I'm not. But I'm simply afraid that infos / tips would be even more fragmented that way. (just my 2 cents)
    5 points
  2. PW runs potentially slower when debug mode is on I guess. Did you disable it in your tests? There are quite a few big sites and web-apps (even multi-site environments) built with PW. Perhaps at some point, no matter what framework you're choosing, you'll need to tweak and optimize at some point. I'm sure it will only be a matter of time until @bernhard chimes in here and tell you about the wonderful RockFinder SQL module he built. Some "native PW" queries were dramatically faster when using that module. Just one of many examples what you can do if you want even more speed. re: ProCache So far, I haven't had the need for this, but I only keep hearing good things about it. FWIW, here's a related forum thread And finally, there's also some "best practise" stuff worth knowing, like (chosen randomly):
    4 points
  3. Update 2018-07-09: ProcessNetteTester module is available in the Modules Directory and on GitHub. This is a short tutorial on how to use Nette Tester with ProcessWire. As you will see it's very easy to setup and use and it's perfect for testing your code's functionality. With bootstrapping ProcessWire it's also possible to check the rendered markup of pages using the API, checking page properties, etc. It's also a great tool for module developers for writing better code. While there will be nothing extraordinary here that you couldn't find in Tester's docs this can serve as a good starting point. Prerequisites: PHP 5.6+ 01 Download Tester Go to https://github.com/nette/tester/releases and download the latest release (currently 2.0.2). Download from the link reading "Source code (zip)". You can use composer also if you wish. 02 Extract Tester files Create a new directory in your site root called "tester". Extract the zip downloaded here, so it should look like this: /site /tester/src /tester/tools /tester/appveyor.yml /tester/composer.json /tester/contributing.md /tester/license.md /tester/readme.md /wire ... 03 Create directory for test files Add a new directory in "/tester" called "tests". Tester recognizes "*.Test.php" and "*.phpt" files in the tests directory, recursively. 04 Create your first test In the "tests" directory create a new "MyTest.php" file. The first test is a very simple one that bootstraps ProcessWire and checks if the Home page name is "Home". This is not the smartest test but will show you the basics. Add this to "/tester/tests/MyTest.php": <?php namespace ProcessWire; use \Tester\Assert; use \Tester\DomQuery; use \Tester\TestCase; use \Tester\Environment; require __DIR__ . '/../src/bootstrap.php'; // load Tester require __DIR__ . '/../../index.php'; // bootstrap ProcessWire Environment::setup(); class MyTest extends TestCase { // first test (step 04) public function testHomeTitle() { $expected = 'Home'; // we expect the page title to be "Home" $actual = wire('pages')->get(1)->title; // check what's the actual title Assert::equal($expected, $actual); // check whether they are equal } // second test will go here (step 06) // third test will go here (step 07) } // run testing methods (new MyTest())->run(); I've added comment placeholders for the second and third tests that we will insert later. 05 Run Tester Tester can be run either from the command line or from the browser. The command line output is more verbose and colored while in the browser it's plain text only (see later). Running from the command line Navigate to the "/tester" directory in your console and execute this: php src/tester.php -C tests This will start "/tester/src/tester.php" and runs test files from the "/tester/tests" directory. The "-C" switch tells Tester to use the system-wide php ini file, that is required here because when bootstrapping ProcessWire you may run into errors (no php.ini file is used by default). You may load another ini file with the "-c <path>" (check the docs). If the title of your Home page is "Home" you should see this: If it's for example "Cats and Dogs", you should see this: Running from the browser First we need to create a new PHP file in ProcessWire's root, let's call it "testrunner.php". This is because ProcessWire doesn't allow to run PHP files from its "site" directory. The following code runs two test classes and produces a legible output. IRL you should probably iterate through directories to get test files (eg. with glob()), and of course it's better not allow tests go out to production. <?php ini_set('html_errors', false); header('Content-type: text/plain'); echo 'Starting tests.' . PHP_EOL; echo '--------------------------' . PHP_EOL; $file = __DIR__ . '/PATH_TO/FirstTest.php'; echo basename($file) . ' '; require $file; echo '[OK]' . PHP_EOL; $file = __DIR__ . '/PATH_TO/SecondTest.php'; echo basename($file) . ' '; require $file; echo '[OK]' . PHP_EOL; echo '--------------------------' . PHP_EOL; echo 'Tests finished.'; exit; Navigate to "DOMAIN/testrunner.php" in your browser to execute the file. If every test succeeds you should get this: If there are failed tests the execution stops and you can read the error message. If there were more tests (eg. ThirdTest), those won't be displayed under the failed test. 06 DOM test This test will check if a page with "basic-page" template has a "h1" element. We will create the page on the fly with ProcessWire's API. To keep things simple we will add the new test as a new method to our MyTest class. Add this block to the MyTest class: public function testBasicPageHeadline() { $p = new Page(); $p->template = 'basic-page'; $html = $p->render(); $dom = DomQuery::fromHtml($html); Assert::true($dom->has('h1')); } This will most likely be true but of course you can check for something more specific, for example "div#main". Note that we have used the DomQuery helper here (check the "use" statement on the top of the file). 07 Custom function test You will probably want to make sure your custom functions/methods will work as they should so let's write a test that demonstrates this. I don't want to complicate things so I'll check if the built-in "pageName" sanitizer works as expected. Add this to the myTest class: public function testPageNameSanitizer() { $expected = 'hello-world'; $actual = wire('sanitizer')->pageName('Hello world!', true); Assert::equal($expected, $actual); } This should also be true. Try to change the expected value if you are eager to see a failure message. 08 Next steps You can add more methods to the MyTest class or create new files in the "tests" directory. Check out the range of available Assertions and other features in the docs and see how they could help you writing more fail-safe code. Once you make a habit of writing tests you'll see how it can assist making your code more bulletproof and stable. Remember: test early, test often ? If you find out something useful or cool with Tester make sure to share.
    3 points
  4. Hello, ProcessWire is built with the idea that it can handle 1,000's of pages. However, there has been sites in the past that have 100,000's. This is where things like $pages->findMany() came in. People have ran large websites without any issue. I can't say much for the amount of requests however, I don't think ProCache is right for you in this instance. For a dynamic site you are best taking advantage of the core cache system (https://processwire.com/api/ref/cache/). For example, you can use core cache to cache all posts so each user only gets post from the cache and you can clear that cache only when someone posts a comment. ProcessWire's API is so powerful once you get into it that something like this will actually be really easy. I can honestly say you are making the right choice with ProcessWire for this project, and with a few tweaks you can have it scale very nicely.
    2 points
  5. Are you sure? I'd expect it to always return the object. It's just that the object implements __toString with it's name, so it's casted to a string if needed. @PWaddict With == it's doing the same thing, because __toString returns the name of the template, but if you'd use === they would no longer have the same result.
    2 points
  6. https://thesmartgroup.ie/ We launched this earlier in the year, I'm only just getting round to sharing it. This is the 4th iteration design wise in the past 5 years and personally my favourite in terms of design. The old site was PW based so we had a lot of the content in there but undertook a major re-write and claw back to make everything cleaner and more succinct - relying on more visuals to promote the work we do rather than verbose copy. The site is not using anything out of the ordinary, just standard modules I tend to use for all PW sites: AIOM SEO Markup Sitemap XML AutoSmush MenuBuilder: Markup The site loads pretty darn quick considering it's using a lot of images and many of them are 96DPI for better display on Retina.
    2 points
  7. Hello everyone, this is my first post on the forum and before I start with my questions, I want to say a big thanks to all people working on this wonderful framework! I'm a happy ProcessWire user, running a smaller site since two years and another just recently launched. Now I'm planning for a larger project and I'm wondering if ProcessWire is the right framework here, or where its limits are, especially regarding the database. The project will be a community site with typical features (profiles, events, forums) supporting local arts communities. The communities create their own content, so it will also have frequent write requests. For the MVP there will be just two pilot cities, but on the long it should support cities worldwide. I'm pretty sure that ProcessWire will have no issues with the MVP, but will it also serve it when it scales? Some test I did so far with PW 3.0.98, apache 2.4.29, php 7.2.2, mysql 5.7.19 on my desktop (Windows10_64, i3-6300/16GB/NVMe): - create a ProcessWire setup with the skyscrapers profile -- browse pages and log mysql queries -- run apache-bench against it - create another ProcessWire setup with the blank profile -- browse page and log mysql queries -- run apache-bench against it While the apache-bench results were actually good, I'm a bit scared about the number of mysql queries I've seen for a single page request. On the skyscapers/about/ I got 76 requests, on the blank home still 23. Repeating my requests, I see the same queries hitting mysql again, so there is nothing cached. Questions: - is the number of mysql queries usual? - can a layer like memcached be implemented easily? - is ProCache a solution also for frequently changing content? - are there experiences with clustering? Thank you very much for your time! Christof
    1 point
  8. I'm in the middle of uploading them. ? They'll be perfected by the end of the day.
    1 point
  9. Just did a bit of digging and someone with a similar issue found that apache was down. They resolved the issue by restarting Apache and everything worked well for them after that. (https://www.digitalocean.com/community/questions/502-gateway-errors-who-can-help) service apache-sp start
    1 point
  10. PW is MIT & MIT2: https://processwire.com/about/license/mit/ https://processwire.com/about/license/mpl/ In short: https://choosealicense.com/licenses/mit/ Distribution is granted but include license and copyright notice. You might want to state that your own work is MIT too. And of course, check what each module or any other library says about licensing. Generally speaking I think you will be ok to share it like that.
    1 point
  11. Hi @Christof Kehr and welcome to the forum. Thx for the hint, I renamed the topic and placed a more obvios comment in the first post. Why should it not be a solution? It's an absolutely awesome tool, bypassing sql and php completely once the content has been cached, so for sure it would reduce your server load drastically. For example if you had 2.000 requests ans content changed 2 times during these 2.000 requests this would mean 2 requests including php+mysql and 1.998 requests serving only the static HTML file ? Thx for the kudos, but I don't think he will need my module for the features he mentioned so far ? RockFinder is great for listings of pages. It is especially built for the coming RockGrid module where you can list thousands of pages in a grid that the user can manipulate on the client side (filtering, instant aggregations etc). It can also be handy for things like CSV export or RSS feeds or the like. Other than that I don't think that it is that useful and the core utilities are perfectly fine (just use pagination and proper limits). ProcessWire is already built with scalability in mind and others have already reported sites handling millions of pages (see here for example https://processwire.com/talk/topic/9491-site-with-millions-of-„pages”/ ). It seems that in your case you are more concerned about the scalability of the infrastructure (requests) than the amount of data handled by the system (pages)?! ProCache will for sure be great: https://processwire.com/api/modules/procache/ Not sure about this one, because the find queries usually are cached, but I don't know exactly how that works because usually you don't have to care about such things as it just works? Maybe I'm misunderstanding you or @Christof Kehr but why do you think ProCache would be no good idea here? Or why should the core cache be the better choice? Of course, ProCache is not the solution to all our problems, but this statement definitely needs a more detailed explanation ?
    1 point
  12. "waiting for table level lock" would suggest that something is odd on the server side and/or mySQL. Maybe mySQL doesn't have enough memory, or is being re-booted every now and then, and can't handle the queries fast enough. Perhaps switching from myISAM to InnoDB would help already. Or maybe this is being caused by a large mysqldump process https://superuser.com/questions/1093610/mysql-5-7-stuck-forever-waiting-for-table-level-lock
    1 point
  13. Yes, debug mode was off during my tests. While searching the forum for sql performance some days ago I stumbled upon the RockSqlFinder post, but as it stated "outdated", I did not look closer into it unfortunately. Thanks for pointing me there, @dragan!
    1 point
  14. Things are slowly stabilizing and I am thinking about releasing a "Preview" Version this or next week. Since it is a "setup" and not only a Module I would like to make the entire demo-site downloadable using Duplicator for example. Duplicator has it's own setup procedure, so this should be easy for everybody. My question is about legal stuff. Is it OK to include the wire folder (PW 3.0.105) and modules like AOS etc. in a downloadable Duplicator Zip File? Thank you.
    1 point
  15. Watch for template settings that are only set to allow http?
    1 point
  16. Hello @Sten So what exactly is the problem? Don't you get any output? What happens? What is you path to templates in the config of the module? I have /templates/views and with my twig files in this directory everything works fine. Did you choose twig as the template files suffix? Your code and extend seem to be correct. The global template file field has to be empty so you can work with extends like you do
    1 point
  17. Thanks for adding this feature! It might be good (just to avoid any confusion) to exclude the skip trash option on the delete tab of ProcessUser because the deletion there is permanent by default.
    1 point
  18. I don't know either, since I never used .local. But try to add localhost or 127.0.0.1 to your site/config.php file in the "allowed hosts" array. And maybe also delete everything that's inside site/assets/cache and reload everything.
    1 point
  19. Surely you are right. My explanation lacks correctness, as I implied a string conversion, derived from the example pwaddict has given. Thanks for chimimg in and corecct this. ?
    1 point
  20. it depends on the context. If OutputFormatting is off, $page->template returns the object, if OutputFormatting is on, it returns only the name.
    1 point
  21. Check the Versions List section of the PW Info panel in Tracy:
    1 point
  22. Hi Folks, I'm new to this forum, and only recently discovered PW. I'm coming from recently giving October and Craft and WordPress serious goes, but have been very curious to try a flat file approach. I must say for what it is worth, I spent hours and days bouncing around the web trying to find and then compare CMSs generally, and flat file CMSs specifically. PW didn't show up at first at all...which is unfortunate, as this seems like a great CMS and I look forward to giving it a go and following this forum. Most of the buzz seemed to be around Grav and Kirby. As a newbie who just discovered PW, I will point out that one of the things I look at when considering a CMS is what kind of pulse it has in the social media/forums realm. For example, I was surprised to see that you all don't have a Slack channel...or if you do, I can't find it, and it is not listed on the main PW page. That is a great way to find out what is going on within any given community, and addition to forums like this of course. You do have Twitter listed, which is great. I am also surprised that you don't have an introductions section in this forum for newbies. Maybe it's not that critical, but as a new member to a community it is nice to have. You of course can announce your arrival elsewhere in the forum like am I doing here. And yes, first impressions upon landing on the CMS front page makes a big difference. For example, I recently landed on the Razor CMS page and immediately cringed and couldn't get away from it fast enough. I forget now who it was after looking at so many CMSs, but another CMS front page immediately struck me as being corporate 1995 and also made me cringe and I had to leave stat. I know looks aren't everything, but considering what we do, well they kinda are lol. In any case, I thought I would at my 2.5 cents as a newbie who has very recently stumbled upon your community, and ran across this discussion. Cheers
    1 point
×
×
  • Create New...