Jump to content

Peter Falkenberg Brown

Members
  • Content Count

    311
  • Joined

  • Last visited

  • Days Won

    4

Peter Falkenberg Brown last won the day on November 28 2019

Peter Falkenberg Brown had the most liked content!

Community Reputation

164 Excellent

About Peter Falkenberg Brown

  • Rank
    Sr. Member

Contact Methods

  • Website URL
    https://datavarius.com

Profile Information

  • Gender
    Male
  • Location
    Maine, USA
  • Interests
    I'm a writer, speaker, and publisher.
    I also own a web programming consulting business at:
    https://datavarius.com
    I specialize in creating custom websites and web database applications.

Recent Profile Visitors

8,069 profile views
  1. You're very welcome, @szabesz! (and thank you!) This thread started with my how-to questions about image migration. Besides the modules that @adrian and @kongondo mentioned, I didn't find any clear documentation about how to deal with image migration with comprehensive detail (I might have missed finding it). Of course, I read a number of pages about image scripting, but I didn't see info that covered all the bases. Adrian expressed skepticism about the stability of the module Kongondo mentioned, and Adrian's module didn't fit my specific needs, so I didn't use either of those modules, and decided to proceed with my own script. But my script didn't deal with cropped images (because I didn't have any), unless they're automatically brought over by the copy command I ran to bring in any image variations. Thus, my script might have missed some important things with images. I'm not sure. I'd love to see a how-to on this very topic, i.e. a comprehensive write-up of how to migrate images and catch every detail. My efforts were a "roll-your-own" attempt to do it, and it worked for me. But I have no confidence that I covered all the details of image migration. If I did, I'd love to hear about it. ๐Ÿ™‚ Peter
  2. Hi All, I've added routines to the script to create a file of hrefs in the body field, and also a file of 301 redirects for an .htaccess file. There are so many edge cases with internal hrefs that I decided to edit them by hand, based on the list created. (For example, an href that links to a second internal PW page on the target domain that PW's url system on the source domain doesn't know about.) I also moved the chown command to include pages that didn't have images, because the file dir has to be owned by the domain and running the script as root ends up making the file dir owned by root. Again, I realize that this script may only serve a very small group of people who need to do exactly what I needed it for: to migrate many sections of pages from one PW domain to another PW domain that had a different section structure. I've successfully and quickly moved many sections and pages as of now, so I'm confident that the script is doing what I needed. If someone else finds it useful, that's grand. ๐Ÿ™‚ Here it is, below. Click the "reveal hidden contents" icon below to see it. Peter
  3. Hi @szabesz, Good idea... I deleted the 1st version of the script and put the second one in a spoiler. I couldn't figure out how to delete an empty spoiler or code block. Do you know how? Edit: I figured it out: just go below the empty box and hit the backspace key until it's gone. ๐Ÿ™‚ Thanks again, Peter
  4. Hi All, I've brought my wee script forward to the point of functionality for my use, minus a couple of things I'll be adding, like a routine to create a list of 301 redirects that I'll be pasting into my .htaccess file on the "old" domain. I'm also going to write a separate small script to click through pages to migrate that will create a list of href's in each page's body text, so that I can see if they have to be edited. In my case, and my experience, href's can have so many variations, including links to external pages, links to internal PW pages that have been moved *internally*, and links to PW pages that have moved to an external site (e.g. the site being migrated to, using a different url). So I'm not trying to incorporate href modification into the script at this time. I realize that Adrian @adrian has created a very complex and thorough blackbox module for migrations. My script is in no way a replacement for his *much more* sophisticated module. As I mentioned, and as I've noted in the script, I wrote this for a very narrow use-case that may only be useful to me. No idea, actually. I'm eager to dig deeper and deeper into ProcessWire, and move from my own procedural code method into object-oriented code. Lot's of catching up to do, since for the last 13 years I've been managing servers, etc, and didn't code all day, every day. But my oh my, I LOVE ProcessWire. What a joy to use. ๐Ÿ™‚ EDIT: May 26, 2020: I've added the routines listed above to v1.1, pasted in a new response below, dated May 26. I also fixed an error with the chown action. See post further down, for the script. Peter
  5. Hi @adrian, I ran the exporter and importer on 1 page, and had the following issues: (I used Append as you suggested.) - The template file was still overwritten - the parent page was imported, probably because the parent page didn't exist in the target site (by design). (I only wanted to migrate the pages under one section to a new section in the target site.) - the images and pdf's were in the zip file but they did not upload to the files/ID dir - the links in the body text still had the old id in the source. - and when I selected "Edit Imported Content" it failed and produced an error - "Missing required ZIP or JSON Source" (when I didn't select that, the second time, it worked, but with the issues above) Yours, Peter
  6. Hi @kongondo, Great suggestion! So much better. On your comment about the find v. get -- you are correct, but that was just a test bit of code. My real export will have multiple pages via a find. Thanks VERY much for your help! Peter
  7. Thanks, @Ivan Gretsky and @kongondo, My old site is on PW 3.0.42, whereas the module is in 3.0.72. My new site is on 3.0.148. Looks like I'll have to upgrade. Peter
  8. Hi @kongondo, You wrote: I looked for that in my Modules setup and also on the PW modules page, and couldn't find it. Do you have a link to it? Thanks, Peter
  9. Hi @adrian, I installed your excellent Migrator module, and saved a zip file for the one page that I've been testing. After inspecting the zip file, I noted that you do indeed bring over the template file and the field structure. In my case, my destination install has identical fields already, but in some cases the the fields or template files might conflict, so overwriting would be a problem. I didn't see a selection to only migrate content, and not fields and templates. It seems to me that your module is perfect for a certain use case, but not necessarily for mine, which only involves migrating content. Unless I missed something. ๐Ÿ™‚ Peter
  10. Hi @adrian, Yes, I can see that your Migrator module looks really fantastic. I'll take a look at it. I still want to deepen my knowledge of the image steps, however. I did notice that your list of migrated items includes the cropped images, which I did not address, partly because I didn't have any cropped images. Thanks again! Peter
  11. Hi @adrian, I don't think I was really trying to reinvent the wheel. I was honed in on a more specific, "narrow-band" problem of the technical requirements to copy images in pages into a replicated PW page. I wanted to pursue that partly to understand what it took to do that one task from a PW to PW website, but also for other migrations, from other CMS's, into a PW install. In other words, I'm seeking to increase my knowledge of those image-related steps, rather than just use a plug-in module. I'll look at Migrator too. When you mention a lot of problems to solve, are you talking about the image copy task, or something else? Thanks, Peter
  12. Note that the code above is a rough first draft, and doesn't include code to copy files, like PDFs. I've already started to change the structure of the file to accommodate that extra step, etc. The code above is just meant as a proof of concept, to see if I'm going in the right direction. Feedback from PW gurus is deeply appreciated. (Or anyone else, too!) Peter
  13. ==> Edit: May 23, 2020 - see second version of this script, posted below on 5/23. I cleaned it up and added the function to copy non-image files. ======================= Hi All, I dug in, testing my code against one page that had two images with 2 variations and descriptions. I got to the point where my code successfully copied that page to a different PW instance; set a few data fields (not all of them); added the images and descriptions; and copied the variation image files (and chowned them to the new domain user, since I ran the script as root). It also replaced the files/ID value in the body text. It seems to work, after multiple tests. I've pasted the code below. => My questions now are: * Assuming I'm coding it by hand, rather than using a 3rd party module: 1. Is there an easier way to do it? 2. Do any errors or tasks-not-done pop out at anyone? 3. Does my code look correct? Thanks! Peter (see code below) -- I deleted this version. See code further down in thread.
  14. Thank you, Gentlemen... I'll look at those modules. As a point of knowledge, is there a raw function or steps in coding that would grab all of the images in one page, including the variations and then if one has created a new page in the second instance and saved it, a function or steps in coding to save the previously grabbed objects / variables, etc, to the new page, while copying the images from the old location to the new one? Given that the modules above exist, I would assume so. For example, if you get a title value from the old page, you then set the new page's field to that value. It's simple and logical. Are there corresponding code steps to do the same for images and all of their related variations and meta data (like descriptions), etc? It seems like https://processwire.com/api/ref/pageimages/ might include those "code steps," but I'm not sure. I want to dig in and learn the manual method, if I can. Thanks! Peter
ร—
ร—
  • Create New...