Jump to content


  • Posts

  • Joined

  • Last visited

  • Days Won


elabx last won the day on December 29 2021

elabx had the most liked content!

About elabx

  • Birthday 04/12/1988

Profile Information

  • Gender
  • Location
    Mexico City

Recent Profile Visitors

11,775 profile views

elabx's Achievements

Hero Member

Hero Member (6/6)




Community Answers

  1. I think @kongondo gives here a super simple example and even refers to it as trivial, haven't tried anything yet tho:
  2. Basically something like this: image: atlassian/default-image:2 definitions: # Copy files and exclude the ones from .gitignore, # which includes logs and custom overrides out of version control. # Run latest migrations if existing. script: &deploy-script rsync --stats --human-readable --recursive --delete-after --no-perms --no-owner --no-group --exclude-from=$BITBUCKET_CLONE_DIR/.gitignore --exclude="bitbucket-pipelines.yml" $BITBUCKET_CLONE_DIR/* $SERVER_USER@$SERVER_ADDRESS:$APP_PATH; ssh $SERVER_USER@$SERVER_ADDRESS "php $APP_PATH/modules/Migrations/bin/migrate run"; pipelines: branches: main: - step: name: awesomewebsite.com script: - SERVER_USER=$USER - SERVER_ADDRESS=$SERVER - APP_PATH=$PATH - *deploy-script dev: - step: name: dev.awesomewebsite.com script: - SERVER_USER=$DEV_USER - SERVER_ADDRESS=$DEV_SERVER - APP_PATH=$DEV_PATH - *deploy-script So it's like a tad bit more fancy FTP upload lol
  3. Well in this scenario I was talking about a particular project that is more "app like". But the rest of sites I manage, which might have specific features regarding template/fields, different templates that are for one specific website/design, I handle them the same way, repo and deployment through pipelines. I'd love to hear about what other things you've tried if you'd be keen on sharing. I've seen some folks move to Statamic/Kirby for this purpose. Thinking about this I've thought a "migration recorder" built on field save hooks, would be neat. Like, you're doing your work on PW thinking about the awesome features you wanna build, building repeaters/matrix, changing file widths, show conditions, all those things we love. Then you go into Setup > Migrations and you find all the work you just did on your repeater field recorded. Just a thought for one part of the whole problem. EDIT: I just read about the YAML thing Craft does, thanks for sharing! 😮
  4. Give a look at this blog post: https://processwire.com/blog/posts/pw-3.0.153/
  5. Hey @Moritz! I use RockMigrations to handle most of the API related stuff along the initial Migrations module, which has a CLI interface letting me run pending migrations per site and keeps the track of it. The sites all share the same features and templates, nothing can be added as a "site specific feature" that involves a "custom pw stuff" in the database, it religiously needs to be in sync. I use bitbucket pipelines for deployments, and it's a very simple script involving rsync and running the Migrations CLI. I do write everything that involves a "new feature" regarding fields on a page, repeater matrix, etc. I'd say once you got it figured out, most of the time i'm copy pasting between migrations and adapting. I'd love to get in sync with some sort of automated testing (end to end with cypress?), but right now it just involves manually testing, and deploying to a few sites to test, fix otherwise and deploy again. I guess this is more of a management issue?? Maybe I am not understanding your full perspective here. No db dumps becase as you mention, it will mess up content. HannahCodes I migrate using the text version export of the hannahcode haha Module updates I guess just upgrading the files?? Haven't got into a deeper issue where something breaks while doing these. I think, up to know, I have just installed new modules. I keep processwire install outside of this equation, I am not sure if this was a wise decision, but it is like that lol One thing that is super important that I haven't though very well is rollbacks. Right now I basically would just run another migration on top, chekout/cherrypick from earlier branch or sth. Though haven't had enough time on this setup to mess up like this and need a rollback or where just doing a migration on top wouldn't work.
  6. I've thought of this a bunch of times! Common settings for the repeater types. Some I normally use are visibility settings, and sometimes dates for ranges to enable/disable.
  7. Something else I've done is dynamically manage the options available for a page reference field depending on where it is in the page tree through a few hooks. So, say each product category has as children two more "parent pages", one for the products, and one for the specific categories of that product page. I won't go into much detail right now as I don't even know if if suits your case.
  8. I'd approach this with either Page fields. Would it matter if the available sizes available for selection in appear on every product-category??
  9. Check the classes that are rendered within the body tag, you should see useful classes there to override css per-role. If you mean tabs/fields within the edit pages screen, there is a lot that can be made through roles and field permissions. https://processwire.com/blog/posts/field-permissions-overrides-and-more-2.6.2/#granular-access-control-with-field-level-permissions This post is old but I bet (without guarantee) that it most likely remains the same or very similar. This Dashboard is super configurable and I bet you can simply wrap the configuration of the panels into some switch/if statements to deliver configurations per role/user.
  10. Not sure if you read my last post and why I asked what I asked but nontheless I think you could try the following code on ready.php. Have in mind, the following function declared in the saved() hook executes after the page is saved, which would be my first approach in getting the gecoded location without doing all the pages in one request . So this approach sort of "throttles" geocoding the address, doing it only when the user adds the address. $wire->addHookAfter('Pages::saved', function(HookEvent $event) { $page = $event->arguments(0); // Skip if not the template we are interested in.. if($page->template != 'customer_project') return; $geo = new \OpenCage\Geocoder\Geocoder('API-KEY'); //This is the field that contains the address in the pages with customer_project template $address = $page->address_field; if ($page->customer_project_address === 1 && $address){ // I guess the first param is the actual address? $address assigned above? $result = $geo->geocode("Another location", ['language' => 'Sweden', 'countrycode' => '+46']); $first = $result['results'][0]; $coordinates = $first['geometry']['lat'] . ',' . $first['geometry']['lng']; //here the field gets saved, have in mind that this is different than saving //the whole page, which would get is into an infinite loop in this scenario $page->setAndSave('my_location_field', $coordinates); } });
  11. Would it work if after one of the following events: User visits page (literally opens up the browser in the page) Page save (whoever saves the address, hits Save in the admin, or the page is saved through the api) The location lat, lng would get added and saved to the page's field through the API?
  12. This does seem like an issue with htaccess not kicking in or mod_rewrite, does writing gibberish on the access throw an error? Cheap trick to see if it works ha! 🤔
  13. Hi!! Try this: $found = $pages->find('template=customer_project'); forach($found as $p){ $p->setAndSave('location',"Hello world" ); } EDIT: Just reading again that you have this in ready.php so this will run on every page load, for every page with custom_project template, not very efficient lol. Like you mention, perhaps a hook after certain action would be better?
  14. Very elucidating!! I'm learning this myself and it's great to confirm/correct some of the assumptions I had. Thanks a bunch for this @MarkE!
  • Create New...