Jump to content
Rodd

Duplicate my website to my local environment

Recommended Posts

Hi everyone!

I have a website in a production environment and I want to duplicate it in a local environment. I exported the content of the website (with the 'Site Profile Exporter' module) but I cannot use it actually. I've got an issue with the database. I imported this one in MAMP then.

I also exported the pages (with the 'ProcessPagesExportImport' module), but I cannot import it to my local website because the fields don't exist. So I created this fields, but I have this error :

Quote

SQLSTATE[42S01]: Base table or view already exists: 1050 Table 'field_video' already exists

How can I use the elements that already exist and are presents in my database? How can I duplicate correctly the templates, fields and pages?

Thanks by advance

PS: Sorry if my english is bad

 

Share this post


Link to post
Share on other sites

Hello,

I do not have much experience with site profile exports, I tried it out when I first started using ProcessWire but I have not used it ever since. So I cannot help you in that regard but you might want to consider different approaches as well, see:

https://processwire.com/talk/topic/17302-working-on-a-webproject-with-pw/

I hope this helps.

  • Like 3

Share this post


Link to post
Share on other sites

Thank you both to answer me.

On 6/21/2020 at 9:50 PM, rick said:

This may help.

 

rick I tried your solution but it doesn't work 500 Internal Server Error 😕 even after have changed my config.php

szabesz I already saw the propositions of people who participate at this discussion

Share this post


Link to post
Share on other sites

"500 Internal Server Error" may be a red herring - it seems to be PW's way of avoiding display of plain old PHP errors on the front end on a production server. Can you see the PHP error log on your hosting? Do you get the error when you log in to the back end? if you can log in, Tracy will be your friend.

 

  • Like 1

Share this post


Link to post
Share on other sites

Hi everyone!

I almost did it. So I'm gonna share what I did for people who can have the same issue

I checked my log first, and I saw that I was connected with the guest user and not the admin user. Anyway, I uninstalled the project and reinstalled a new one.
For this, I created a new project with the master version of Processwire (with the multi-language option). I replaced the content of my database by the database that I have for my website in production - same tables, same fields, just content which is new.
Then, I put the templates that I have on my Gitlab plus modules and assets. I used the 'ProcessPagesExportImport' module and saw what I had to do for fields and templates before to import my pages. Almost all of my pages are on the website in the local environment.

But I still have a problem. This is the error that I have.

Quote

Fatal Error: Uncaught Error: Call to a member function setLanguageValue() on null in /Users/ilyas/Documents/yuzu-gaming/wire/modules/LanguageSupport/FieldtypeTextLanguage.module:144
Stack trace:
#0 /Users/ilyas/Documents/yuzu-gaming/wire/modules/LanguageSupport/FieldtypeTextareaLanguage.module(114): ProcessWire\FieldtypeTextLanguage->___importValue(Object(ProcessWire\Page), Object(ProcessWire\Field), Array, Array)
#1 [internal function]: ProcessWire\FieldtypeTextareaLanguage->___importValue(Object(ProcessWire\Page), Object(ProcessWire\Field), Array, Array)
#2 /Users/ilyas/Documents/yuzu-gaming/wire/core/Wire.php(392): call_user_func_array(Array, Array)
#3 /Users/ilyas/Documents/yuzu-gaming/wire/core/WireHooks.php(823): ProcessWire\Wire->_callMethod('___importValue', Array)
#4 /Users/ilyas/Documents/yuzu-gaming/wire/core/Wire.php(450): ProcessWire\WireHooks->runHooks(Object(ProcessWire\FieldtypeTextareaLanguage), 'importValue', Array)
#5 /Users/ilyas/Documents/yuzu-gaming/wire/core/PagesExportImport.php(957): ProcessWire\W (line 144 of /Users/ilyas/Documents/yuzu-gaming/wire/modules/LanguageSupport/FieldtypeTextLanguage.module)


This error message was shown because: you are logged in as a Superuser. Error has been logged.

So yeah I installed the FieldtypeTextareaLanguage module, and used it for a field, but I don't understand why I've got this error. I installed the repeater module too, and there is no problem with it.
Maybe someone can help me for this?

Thanks by advance

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By Vineet Sawant
      Hi,
      I'm trying to import some heavy data into Processwire, but I'm not sure what would be the best way to do it.
      Usually I use CSV to Pages plugin, but this time the data is too heavy(~40k rows with 10+ columns of excel sheet), thus this plugin can't help.
      I also tried Tasker plugin but I can't seem to go through the setup itself, it requires some template setup but I'm totally clueless about how to do it, so that plugin is not of any use either.
      I wanted to know from you guys how you do it and in future what would be the best way to migrate thousands of rows of data in to PW.
       
      Thanks.
       
       
    • By jom
      Chäs & Co is a b2b cheese trader. They love good cheese and are proud of their excellent knowledge und connections to small cheese producers. They maintain a custom made database and used to copy/paste (!) the cheese infos to the former CMS (Contao). Since substituting the database with ProcessWire was no option, they export now the database to a csv file and import it to the new website (expanded version of module ImportPagesCSV).
      From there, the pw magic begins. The staff works with the admin interface: They search and find products in notime using the build-in search field (using cheese names or id. Using ids only possible by adding hook, see this forum thread). They generate price lists easily based on a template, providing checkboxes and option buttons for some restrictions, choose i.e. the cheese origin and price audience (all implemented as page selectors). By saving the page a PDF list gets generated (using mpdf, a php pdf library).
      The visitors can sort and filter the products using a form by shuffle.js. Product details are shown in a popup (fancybox). There's also the option for generating a nice pdf data sheet. No CSS framework being used.
      Other modules used: ProcessJumpLinks, ProcessProMailer, ProcessWireUpgrade.
      Visual design: Nicole Haller


    • By hellerdruck
      Hi all
      I need to export all the texts from a website to a translation company (as json or csv or txt...). How can this be done? Of course manually, but this website is huge and it would take me years...
      Also, as a second step, importing the translation ...
      Any ideas anyone? Tutorials? Plugins?
      Thanks for your help.
    • By Juergen
      Hello @ all,
      I am creating a new inputfield/fieldtype to store opening hours, but I am struggeling to save values from multiple dynamic created inputfields in 1 column of the database.
      Scenario:
      The user can enter one or more opening times per day in a UI.
      Fe:
      Monday open from 08:00 to 12:00 and from 14:00 to 17:00 Tuesday open from 08:00 to 12:00 and from 14:00 to 19:00 and so on
      Via a little JavaScript you can add as much opening times as you need per day - the additional inputfield will be created dynamically.
      After form submission all the values are in the POST array -> this works (see example below):
      ProcessWire\WireInputData Object ( [openinghours_mo-0-start] => 09:00 [openinghours_mo-0-finish] => 13:00 [openinghours_mo-1-start] => 14:00 [openinghours_mo-1-finish] => 18:00 [openinghours_mo-2-start] => 21:00 [openinghours_mo-2-finish] => 23:00 [openinghours_tu-0-start] => 09:00 [openinghours_tu-0-finish] => 13:00 [openinghours_tu-1-start] => 14:00 [openinghours_tu-1-finish] => 18:00 [openinghours_we-0-start] => 09:00 [openinghours_we-0-finish] => 13:00 [openinghours_we-1-start] => 14:00 [openinghours_we-1-finish] => 18:00 [openinghours_th-0-start] => 09:00 [openinghours_th-0-finish] => 13:00 [openinghours_th-1-start] => 14:00 [openinghours_th-1-finish] => 18:00 [openinghours_fr-0-start] => 09:00 [openinghours_fr-0-finish] => 13:00 [openinghours_fr-1-start] => 14:00 [openinghours_fr-1-finish] => 18:00 [openinghours_sa-0-start] => [openinghours_sa-0-finish] => [openinghours_so-0-start] => [openinghours_so-0-finish] => ) The property name is always the name attribute of the field 😉 . If the property is empty means closed on that day.
      Now I need to combine all those values into 1 array (or json array) and store it in the database in 1 column called 'hours' in my case (see screenshot below):

      In my ___processInput(WireInputData $input) method I have tried to make it work like this:
      public function ___processInput(WireInputData $input): self { $name = $this->attr('name'); $value = $this->attr('value'); //input object includes always every input on the page, so lets filter out only inputs from this field //we need to do this, because the number of values is variable - so extract only values that starts with $name.'_' $nameAttributes = []; foreach($input as $key=>$value){ if(substr($key, 0, strlen($name.'_')) === $name.'_'){ $nameAttributes[$key] = $value; } } // loop through all inputfields of this fieldtype $time_values = []; foreach($nameAttributes as $nameAttr => $value) { $time_values[$nameAttr] = $value; } } //save it in the database $input->set('hours', serialize($time_values)); return $this; } The only important part of this code is the last part with the serialize function.
      After saving it will create a record in the database, but the value is always NULL (default value) (see below).

      Checking $time_values returns all the values, but printing out "$this" shows me that the property "hours" inside the Openinghours object is empty (see below) - so the mistake must be there, but I dont know where?!?!?!?
      [title] => Home [openinghours] => ProcessWire\OpeningHours Object ( [data] => Array ( [hours] => ) ) If I check the sleepValue() method or the sanitizeValue() - they are also empty. So it seems that the values will not reach these methods. I havent found a clear documentation of whats going on behind the saving process of an inputfield.
      As far as I know the saving process starts with the form submission. The values are in the POST array and will be processed by the processInput() method. Before they will be saved in the database they will be sanitized by the sanitizeValue() mehtod and afterwards they will be prepared for storage in the sleepValue() method.  The last step is the storage itself.
      Has someone an idea what is missing by storing values from multiple fields into 1 database column or has someone a working example of such a scenario on github to help me out.
      A clear explanation of the storage process will be also helpful.
      Thanks and best regards
    • By Pip
      Hi Everyone 
      I've been working on Processwire for two months now. Structuring the website as needed. Unsure why but I'm getting this one now. Seems my fields has crashed. 
      I've tried googling some answers but can't seem to find a step by step guide on how to rectify this. Any advise? Practically new on this. 
      TIA. 

×
×
  • Create New...