Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"license": "MIT",
"dependencies": {
"@aws-sdk/client-s3": "^3.772.0",
"serverlesswp": "^0.4.0",
"serverlesswp": "^0.4.1",
"sqlite3": "^5.1.7"
},
"engines": {
Expand Down
9 changes: 7 additions & 2 deletions util/directory.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,14 @@ const execSync = require("child_process").execSync;

exports.setup = function() {
if (!fs.existsSync('/tmp/wp')) {
fs.mkdirSync('/tmp/wp');
try {
execSync('cp -R /var/task/wp/* /tmp/wp/');
// Symlink entire WordPress directory for fast read access to core files
fs.symlinkSync('/var/task/wp', '/tmp/wp');

// Remove wp-content symlink and replace with real writable copy
// This is needed for SQLite db.php and any plugin-generated files
fs.unlinkSync('/tmp/wp/wp-content');
execSync('cp -R /var/task/wp/wp-content /tmp/wp/');
}
catch (err) {
console.log(err);
Expand Down
3 changes: 2 additions & 1 deletion util/sqliteS3.js
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,8 @@ exports.prepPlugin = async function (wpContentPath, sqlitePluginPath) {
const content = await fs.readFile(newPath, 'utf8');
const modifiedContent = content.replace(new RegExp(/{SQLITE_IMPLEMENTATION_FOLDER_PATH}/, 'g'), sqlitePluginPath);

await fs.writeFile(newPath, modifiedContent)
await fs.writeFile(newPath, modifiedContent);
init = true;
}
catch (err) {
console.log(err);
Expand Down