Skip to content

Commit

Permalink
Merge pull request #248 from wikitongues/staging
Browse files Browse the repository at this point in the history
Production Deploy
  • Loading branch information
FredericoAndrade authored Nov 11, 2024
2 parents dd4119d + 6218475 commit d850d9e
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 4 deletions.
10 changes: 7 additions & 3 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -148,9 +148,7 @@ Database access through Beekeeper Studio is only possible while the SSH tunnel i
- **Database User Not Allowed**: Use the MariaDB console to grant appropriate privileges (`GRANT ALL PRIVILEGES` commands) as described in Step 2.

## Database Sync
Work is underway to syncronize databases across environments
Utilizing WP-CLI
Local database syncs are accomplished with the `tool-sync-db-from-prod.sh` script.
Work is underway to syncronize databases across environments. To sync your local database up with Prod, run `bash tool-sync-db-from-prod.sh` from your local terminal.


# CSS and Compiling Stylus
Expand Down Expand Up @@ -191,6 +189,12 @@ Some of our advanced features are maintained as custom plugins. At present, we h
/includes/templates/*
```

# Errors

Localhost db view error: `The user specified as a definer ('wikitong_master'@'localhost') does not exist`
1. `DROP VIEW IF EXISTS languages_view;`
1. Recreate the View

# To-Do

## Code structure and styles
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<?php
// Load WordPress environment.
require_once('wp-load.php');

global $wpdb;

// Fetch all serialized license_link entries.
$serialized_entries = $wpdb->get_results("
SELECT meta_id, meta_value
FROM {$wpdb->postmeta}
WHERE meta_key = 'license_link'
AND (meta_value LIKE 'a:%' OR meta_value LIKE 's:%')
");

foreach ($serialized_entries as $entry) {
$meta_id = $entry->meta_id;
$serialized_value = maybe_unserialize($entry->meta_value);

// Check if it's an array (from serialized data), get the first item; otherwise, use the value as-is.
$plain_text_value = is_array($serialized_value) ? $serialized_value[0] : $serialized_value;

// Update the meta_value with the plain text URL.
$updated = $wpdb->update(
$wpdb->postmeta,
['meta_value' => $plain_text_value],
['meta_id' => $meta_id],
['%s'],
['%d']
);

if ($updated) {
echo "Updated meta_id {$meta_id} to: {$plain_text_value}\n";
} else {
echo "No update was made for meta_id {$meta_id}. It may already be plain text or an error occurred.\n";
}
}

echo "All serialized entries for 'license_link' have been processed.\n";
2 changes: 1 addition & 1 deletion wp-content/themes/blankslate-child/single-videos.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
$reversed_license_link = array_reverse($license_link);
$video_license_url = array_pop($reversed_license_link);
} else {
$video_license_url = '';
$video_license_url = $license_link;
}
$featured_languages = get_field('featured_languages');

Expand Down

0 comments on commit d850d9e

Please sign in to comment.