{"id":21970141,"url":"https://github.com/gwa/wpsh","last_synced_at":"2026-04-12T01:33:00.595Z","repository":{"id":62513675,"uuid":"74996642","full_name":"gwa/wpsh","owner":"gwa","description":"A PHP command line tool for syncing between PROD and local WordPress sites.","archived":false,"fork":false,"pushed_at":"2017-01-11T14:06:46.000Z","size":23,"stargazers_count":3,"open_issues_count":3,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-19T12:41:28.289Z","etag":null,"topics":["sync","utility","wordpress"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/gwa.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-11-28T17:22:42.000Z","updated_at":"2018-04-28T19:23:55.000Z","dependencies_parsed_at":"2022-11-02T10:16:45.836Z","dependency_job_id":null,"html_url":"https://github.com/gwa/wpsh","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gwa%2Fwpsh","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gwa%2Fwpsh/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gwa%2Fwpsh/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gwa%2Fwpsh/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gwa","download_url":"https://codeload.github.com/gwa/wpsh/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245028171,"owners_count":20549471,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["sync","utility","wordpress"],"created_at":"2024-11-29T14:31:54.567Z","updated_at":"2026-04-12T01:33:00.557Z","avatar_url":"https://github.com/gwa.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# wpsh\n\nA command line tool for local WordPress development.\n\n## Introduction\n\n`wpsh` is a command line tool we use to sync the database and uploaded files from a remote (PRODUCTION) WordPress install to a local (DEVELOPMENT) install.\n\nIt was inspired by Drupal's `drush` tool.\n\n## Prerequisites\n\nYou will need:\n\n* `composer` installed locally (for installation).\n* `mysql` needs to be installed remotely.\n* `mysql` and `rsync` need to be installed locally and in your path.\n* SSH access to the remote server.\n\n## Installation\n\nInstall globally using [composer](https://getcomposer.org).\n\n```bash\n$ composer global require gwa/wpsh\n```\n\nTest that `wpsh` is installed:\n\n```bash\n$ wpsh\n```\n\nYou should see some usage help output.\n\n## Setup\n\n### Aliases\n\nSite \"aliases\" contain the configuration for a site, either remote or local. `wpsh` looks for site aliases in `~/.wpsh`.\n\nFirst create the directory in your HOME directory.\n\n```bash\n$ mkdir ~/.wpsh\n```\n\nCreate a file called in `~/.wpsh` called `alias.[mysite].php`.\n\n`mysite` can contain alphanumeric characters, hyphens and periods.\n\n```php\n\u003c?php\n// File: ~/.wpsh/alias.mysite.php\nreturn [\n  // The production server\n  //\n  '@mysite.prod' =\u003e [\n    // SSH configuration\n    'remote' =\u003e [\n      'host'     =\u003e '123.255.12.123',\n      'user'     =\u003e 'username',\n      // Path to a SSH key file\n      // 'identity' =\u003e '~/.ssh/custom_rsa',\n    ],\n\n    // Absolute paths\n    'path' =\u003e [\n      // The base directory\n      'base'    =\u003e '/var/www/mysite',\n      // Path to a custom MySQL cnf file\n      'cnf'     =\u003e '~/mysql_cnf/mysite.cnf',\n      // Path to a custom wp dir, relative to base\n      // 'wp' =\u003e '',\n      // Path to a custom uploads dir, relative to base\n      // 'uploads' =\u003e 'wp-content/uploads',\n    ],\n\n    // Database settings\n    'db' =\u003e [\n      // Name of the database\n      'database' =\u003e 'dbname'\n    ],\n\n    // Other settings\n    'settings' =\u003e [\n      'siteurl' =\u003e 'http://www.example.com',\n      // Set a custom `home` path. Defaults to siteurl.\n      // 'home' =\u003e 'http://www.example.com/wp',\n    ]\n  ],\n\n  // The local development copy\n  // Settings as above, but without `remote`\n  //\n  '@mysite.local' =\u003e [\n    'path' =\u003e [\n      'base'    =\u003e '/path/local/server/wordpress',\n    ],\n\n    'db' =\u003e [\n      'database' =\u003e 'dbname',\n    ],\n\n    'settings' =\u003e [\n      'siteurl' =\u003e 'http://mysite.local',\n    ]\n  ],\n];\n```\n\n### MySQL cnf files\n\nWe use `cnf` files [to store MySQL credentials](http://dev.mysql.com/doc/refman/5.7/en/option-files.html).\n\nYou can save these in one of the default paths (see MySQL docs), or in a custom path that is defined in the site alias' `cnf` path.\n\nExample:\n\n```\n[client]\nuser=mysqluser\npassword=\"pa$$word\"\nhost=127.0.0.1\nport=3306\n```\n\n## Usage\n\nThe following commands are available.\n\n### `sa`\n\nLists available aliases.\n\n```\n$ wpsh sa\n```\n\n### `mysqldump`\n\nCreates a mysql dump file.\n\n```\n$ wpsh mysqldump [@alias] \u003e /path/to/outfile.sql\n```\n\n### `mysqlsync`\n\nSyncs DB from @alias1 to @alias2.\n\nUpdates settings and URLs in posts with the local settings and URLs.\n\n```\n$ wpsh mysqlsync [@alias1] [@alias2]\n```\n\n### `rsync`\n\nSyncs uploads from @alias1 to @alias2.\n\n```\n$ wpsh rsync [@alias1] [@alias2]\n```\n\n## TODOs\n\n[ ] Provide hook mechanism for custom scripts / MySQL queries to be executed after sync.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgwa%2Fwpsh","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgwa%2Fwpsh","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgwa%2Fwpsh/lists"}