Jump to content

fbg13

Members
  • Posts

    344
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by fbg13

  1. I download everything to my pc with rsync, I'm on Windows 10 so I use Bash on Ubuntu on Windows, for Windows 7 there's cygwin. ssh root@ip /var/www/clients/client1/web1/web/script.sh && rsync -av -e ssh root@ip:/var/www/clients/client1 /mnt/e/zBackup/www --exclude-from '/mnt/e/zBackup/www/exclude.txt' --delete ssh root@ip /var/www/clients/client1/web1/web/script.sh - runs a script that backups all databases rsync -av -e ssh root@ip:/var/www/clients/client1 /mnt/e/zBackup/www - downloads everything from /var/www/clients/client1 on my vps to E:\zBackup\www on my pc --exclude-from '/mnt/e/zBackup/www/exclude.txt' - text file with paths to exclude from downloading Database backup script
  2. @flydev Take a look at https://github.com/jubos/fake-s3 and https://github.com/jserver/mock-s3 I have not used them.
  3. You can always use the cache for time/resource demanding code and you can update it with a cron or hook so users never get long load times.
  4. https://processwire.com/api/modules/form-builder/#requirements
  5. Users are pages in PW, if you look at the database there is no users table. This is how you create an user // Create the user $u = new User(); $u->name = $sanitizer->pageName($username); $u->email = $sanitizer->email($email); $u->pass = $pass; $u->addRole("member"); $u->save(); this will create a new page under /admin/access/users/ and that is your user. What i suggested above is just what i find easier to work with as i don't want to mix default pages with the rest.
  6. @LimeWub Regarding the processing of the form pages. You can save the forms in one or more pages under a page representing the user. For example you create a page named "Users" and whenever an user registers you create a page under users with the user's name. Users --username1 --username2 Then when he submits a form you create a page under the corresponding user. Users --username1 ----form1 ----form2 ----form3 --username2 ----form1 ----form2 Or create just one page and you save just the fields from the current form and on the next forms you update the page with the new fields. Then you can get the forms for a user with $currentUserForm1 = $pages->get("parent=/Users/username1/, name=form1"); $currentUserForm2 = $pages->get("parent=/Users/username1/, name=form2"); create pages through api upload files
  7. This https://www.mail-tester.com helped me with my e-mail. I got it from someone here on the forum i think.
  8. $config->urls->httpRoot https://processwire.com/blog/posts/processwire-2.6.18-updates-pagination-and-seo/#new-http-prefix-available-for-all-config-gt-urls-properties
  9. I think Pages::added might fit better. Thanks.
  10. I'm so stupid . I am saving the same page, I have a views field that gets incremented once per session.
  11. With null as expiration, after a restart, it still doesn't get the cache, but when opening the page in another browser (after it was loaded in another browser) it gets it on the first load. Same with no expiration or an integer. And I forgot to ask, but why is the code inside the hook executed?
  12. I changed the code in the template to only $cache->get("cacheName"); and left the cache generation to the hook for easier debugging. Also I changed the constant to null and opened the page in a new browser, with the same result. Will test it a little more, but i can't restart my pc right now.
  13. The module where i generate the cache is autoloading and whenever i restart my pc and access a page that should be cached, and it is cached as i can see the entry in the caches table, the caching functions still executes. If I refresh the page, it loads fast, 0.5 seconds compared to 13 seconds. If I open the page in another browser the same happens, first page access doesn't load the cache, but creates it again, even though it's in the database. Is this a bug or am i missing something?
  14. @kongondo is the sql solution preferred because it's faster or uses less memory, or both, compared to php?
  15. I have pages that have children whose name/title is just a number. echo "<pre>" . print_r( $page->children()->sort("name"), true) . "</pre>"; echo "<pre>" . print_r( $page->children("sort=name"), true) . "</pre>"; The above gives me //echo "<pre>" . print_r( $page->children()->sort("name"), true) . "</pre>"; ProcessWire\PageArray Object ( [items] => Array ( [2] => /parent/1/ [0] => /parent/3/ [3] => /parent/5/ [4] => /parent/11/ [1] => /parent/15/ [6] => /parent/31/ [5] => /parent/33/ ) ) // echo "<pre>" . print_r( $page->children("sort=name"), true) . "</pre>"; ProcessWire\PageArray Object ( [items] => Array ( [0] => /parent/1/ [1] => /parent/11/ [2] => /parent/15/ [3] => /parent/3/ [4] => /parent/31/ [5] => /parent/33/ [6] => /parent/5/ ) ) Seems like this is not possible as mysql can't sort results that way. http://stackoverflow.com/questions/153633/natural-sort-in-mysql I think that's why the ways of sorting i posted above are different, first is sorted by php that can natural sort and second is sorted by mysql which can't natural sort/
  16. Try $pages->find($selector)->sort("fieldToSortBy");
  17. http://php.net/manual/en/language.variables.scope.php
  18. Use wire('pages') instead of $pages inside of functions.
  19. I think the count in your case returns the number of children of the page returned by $pages->get(1021)->Artist->get("Artist_firstname=" . $firstname . ", Artist_lastname=" . $lastname)->Artist_works Do you really need so much method chaining? You can probably get the page you need with just one selector.
  20. count("Artist_works_inventory_no='1'") 3 pages matching the selector, returns int 3 find("Artist_works_inventory_no='1'") 3 pages matching the selector, returns PageArray of 3 page objects , but you only get the first one because of the $pages->get https://processwire.com/api/ref/pages/
  21. this is how you set a field on the $u page, if the field exists you have to save the page after. To set a session variable use https://processwire.com/api/ref/session/set/ and to get it use https://processwire.com/api/ref/session/get/ https://processwire.com/api/ref/ Edit: users are pages too.
  22. You're echoing the titles of Page A, B and C not their subpages. $store = $pages->get("parent=/deals/"); foreach ($store->children as $child){ foreach($child->children as $grandchild) { echo $grandchild->title; } }
  23. $store = $pages->find("parent=/deals/"); Try with parent between forward slashes.
×
×
  • Create New...