4

"Digital Ocean through Forge" is a good solution. Sounds like you're on a well-powered droplet as well. I'd recommend moving your assets into the cloud to speed things up a bit. Something like Amazon S3 with CloudFront. Honestly, the biggest drag is probably the use of multiple locales. Craft is making duplicates of pretty much all of the content in your ...


3

If you really, really want to create an entry from within the database (you must have a VERY good reason to do so), then you should create a row in: entries elements elements_sites content If you'd like the easier path, use Content migrations. Create a migration, and then add something like: // Create the entry $myNewEntry = new craft\elements\Entry(); $...


3

If I'm understanding correctly, there are two methods I'd suggest; Instead of reconciling the data from Site A, I would first setup Site A with Site B + C and add any new fields/sections you will need, then set up project config so that any structural changes you make locally on development will be made remotely. Put it live, then you/the client can ...


2

For reference, the status of all elements is stored in the "elements" table, the column is "enabled" and the valid values are 1 and 0. Entry, Category, Matrix, Asset and all other elements will have their id as a foreign key linked to this table


2

Is this Craft 2 or Craft 3? There are a few of ways to get entries but basically you could do something like (Craft 3) use craft\elements\Entry; $entries = Entry::find()->status(null)->all(); To find all disabled entries.


2

Nothing to see here. We had a corrupt index. Running this command in the DB brought our searches down from 90 seconds to 1 or 2 seconds. I'd still love it to be faster. But we can live with 2 seconds: optimize table searchindex;


2

I have run the following on my computer in order to allow Mac OS's terminal to speak to MAMP's MySQL. I have not done the steps outlined in your linked article. Craft's built-in backup tool works fine for me so perhaps this will help you too. sudo ln -s /Applications/MAMP/Library/bin/mysqldump /usr/local/bin/mysqldump Here's a github issue on the matter ...


2

I believe you can use getLastInsertID to fetch the ID: Craft::$app->db->getLastInsertID();


1

The database backup from Craft is slightly different to the SQL export in phpMyAdmin. Craft’s export (presumably) assumes you’re going to want to import that data into an existing site, whereas phpMyAdmin’s default (presumably) assumes you’ll want to import it into an empty database. However you can do exactly as you suggest — export from phpMyAdmin locally, ...


1

I'm not sure why you would do two different servers. Your front end can be cached with Blitz / NGINX which will take a load off the server and admin. How often are you aggregating the data? I've just imported 10k records from a source and I would recommend writing your own module to handle the imports as commands. From there you could set up a cron which ...


1

Have a look at your .env file on the production system and your config/db.php file your repo. Craft has changed the way db access data is stored and must now be provided as a DSN This is now config/db.php return [ 'dsn' => getenv('DB_DSN'), 'user' => getenv('DB_USER'), 'password' => getenv('DB_PASSWORD'), 'schema' => getenv('...


1

From Craft Support: Assuming the credentials in your .env are correct on that site, could you run ./craft clear-caches/all (or manually empty your web/cpresources and storage/runtime


1

Yes, it would be possible. I don't think there's an easy (plugin) solution for this purpose, though. If your project has an active module, you could use that to save the click count and retrieve it from the DB. Make sure your module works (in the default Craft project, it's as simple as uncommenting the module line in config/app.php) Create a migration to ...


1

Command ./craft migrate/all fixed this issue.


1

When you do your export in phpmyadmin, make sure you check the 'disable foreign key checks' box in the custom options:


1

It's from the top of my head here so no idea if this is going to work, but my idea is: Get all active alerts order by postDate (just their ID's to make it faster) Retrieve all related countries and take the first 5 (You can do a relatedTo with more than 1 entry.) {% set alerts = craft.entries({ section: 'alert', orderBy: 'postDate desc', ...


1

OK, here is one solution I've come up with, which seems to work and (I think) avoids 1+ queries: {% set groups = craft.entries({ section: 'alert', with: [ 'country', ] }).orderBy('postDate desc').status('live').all() | group(alert => alert.country[0]) %} <ul> {% for country, alerts in groups | slice(0, 5) %} <li&...


1

Here is the Solution. Clearing a couple of lines from the SQL file made it work.


1

I figured it out. The problem was that the code that set seoAuthor on every template was still there. So even tho the field was removed from the layout, the db still contains that field, so is able to retrieve it. The fix was to remove the code that set the variable in the templates, and now works as intended. One thing that still confuses me is why ...


1

The solution is below. EDIT: only for MySQL 5.7.4 and lower! Higher versions break. For whatever reason, the mechanics of the group filter in this case was producing a new query for every Entry. Below, resolves this by doing the same job in a more performant way. I'm not entirely sure of the mechanics of how this works, but the answer was supplied over on ...


1

I only know mamp. You have to point the local domain to the web folder. If you don't change the folder structure the composer libraries will live outside the public folder just fine. Do you get any errors or something?


1

Not sure how the database backup was created and what's being used to restore it, but using this would fix the error: CREATE SEQUENCE IF NOT EXISTS 'public.assetindexdata_id_seq' Alternatively, if you delete the database to destroy all of the associated metadata, then it shouldn't matter. https://www.postgresql.org/docs/9.5/sql-createsequence.html


1

You would not use the headless API to submit content in into Craft, as neither the GraphQL or Element APIs support writing. The frontend entry form functionality is fairly well documented. You would just need your frontend to build out a post request including the correct action, CSRF token, and whatever fields are needed. The action endpoint will ...


1

In my case I was missing the .env file in my Atomic SFTP deploy. 🤦🏼‍♂️ So the DB_DRIVER setting was not there...


1

there should be execute() fn at the last to execute the sql query craft()->db->createCommand() ->insert('mytablename', array( 'field1' => 'foo', 'field2' => 'bar' )) ->execute();


Only top voted, non community-wiki answers of a minimum length are eligible