wp core
Загружает, устанавливает, обновляет и управляет установкой WordPress.
Список команд | Описание |
---|---|
wp core check-update | Проверяет наличие обновлений WordPress через API проверки версий. |
wp core download | Загружает WordPress (основные файлы, ядро). |
wp core is-installed | Проверяет, установлен ли WordPress. |
wp core install | Выполняет стандартный процесс установки WordPress. |
wp core multisite-convert | Переводит существующую установку WP в мультисайт установку. |
wp core multisite-install | Устанавливает WordPress multisite с нуля. |
wp core version | Отображает версию WordPress. |
wp core update | Обновляет WordPress до новой версии. |
wp core update-db | Запускает процедуру обновления базы данных WordPress. |
wp core verify-checksums | Проверяет файлы WordPress на соответствие контрольной сумме файлов из WordPress.org. |
Примеры
# Download WordPress core $ wp core download --locale=nl_NL Downloading WordPress 4.5.2 (nl_NL)... md5 hash verified: c5366d05b521831dd0b29dfc386e56a5 Success: WordPress downloaded. # Install WordPress $ wp core install --url=example.com --title=Example --admin_user=supervisor --admin_password=strongpassword --admin_email=info@example.com Success: WordPress installed successfully. # Display the WordPress version $ wp core version 4.5.2
Исходный код команд
wp core check-update
Проверяет наличие обновлений WordPress через API проверки версий.
Lists the most recent versions when there are updates available, or success message when up to date.
Использование
wp core check-update [--minor] [--major] [--field={field}] [--fields={fields}] [--format={format}]
Можно указать Глобальные параметры и следующие:
- [--minor]
- Compare only the first two parts of the version number.
- [--major]
- Compare only the first part of the version number.
- [--field={field}]
- Prints the value of a single field for each update.
- [--fields={fields}]
- Limit the output to specific object fields. Defaults to version,update_type,package_url.
- [--format={format}]
Render output in a particular format.
По умолчанию: table
Может быть:- table
- csv
- count
- json
- yaml
Примеры
$ wp core check-update +---------+-------------+-------------------------------------------------------------+ | version | update_type | package_url | +---------+-------------+-------------------------------------------------------------+ | 5.0.0 | major | https://downloads.wordpress.org/release/wordpress-4.5.2.zip | +---------+-------------+-------------------------------------------------------------+ # Или Success: WordPress is at the latest version.
wp core download
Загружает WordPress (основные файлы, ядро).
Downloads and extracts WordPress core files to the specified path. Uses current directory when no path is specified. Downloaded build is verified to have the correct md5 and then cached to the local filesytem. Subsequent uses of command will use the local cache if it still exists.
Использование
wp core download [--path={path}] [--locale={locale}] [--version={version}] [--skip-content] [--force]
Можно указать Глобальные параметры и следующие:
- [--path={path}]
- Specify the path in which to install WordPress. Defaults to current directory.
- [--locale={locale}]
- Select which language you want to download.
- [--version={version}]
- Select which version you want to download. Accepts a version number, 'latest' or 'nightly'
- [--skip-content]
- Download WP without the default themes and plugins.
- [--force]
- Overwrites existing files, if present.
Примеры
$ wp core download --locale=nl_NL Downloading WordPress 4.5.2 (nl_NL)... md5 hash verified: c5366d05b521831dd0b29dfc386e56a5 Success: WordPress downloaded.
wp core is-installed
Проверяет, установлен ли WordPress.
Determines whether WordPress is installed by checking if the standard database tables are installed. Doesn't produce output; uses exit codes to communicate whether WordPress is installed.
- [--network]
- Check if this is a multisite installation.
Использование
wp core is-installed [--network]
Примеры
# Check whether WordPress is installed; exit status 0 if installed, otherwise 1 $ wp core is-installed $ echo $? 1
# Bash script for checking whether WordPress is installed or not if ! $(wp core is-installed); then wp core install fi
wp core install
Выполняет стандартный процесс установки WordPress.
Creates the WordPress tables in the database using the URL, title, and default admin user details provided. Performs the famous 5 minute install in seconds or less.
Note: if you've installed WordPress in a subdirectory, then you'll need to wp option update siteurl after wp core install. For instance, if WordPress is installed in the /wp directory and your domain is wp.dev, then you'll need to run wp option update siteurl http://wp.dev/wp for your WordPress installation to function properly.
Note: When using custom user tables (e.g. CUSTOM_USER_TABLE), the admin email and password are ignored if the user_login already exists. If the user_login doesn't exist, a new user will be created.
Использование
wp core install --url={url} --title={site-title} --admin_user={username} [--admin_password={password}] --admin_email={email} [--skip-email]
Можно указать Глобальные параметры и следующие:
- --url={url}
- The address of the new site.
- --title={site-title}
- The title of the new site.
- --admin_user={username}
- The name of the admin user.
- [--admin_password={password}]
- The password for the admin user. Defaults to randomly generated string.
- --admin_email={email}
- The email address for the admin user.
- [--skip-email]
- Don't send an email notification to the new admin user.
Примеры
# Install WordPress in 5 seconds $ wp core install --url=example.com --title=Example --admin_user=supervisor --admin_password=strongpassword --admin_email=info@example.com Success: WordPress installed successfully.
# Install WordPress without disclosing admin_password to bash history $ wp core install --url=example.com --title=Example --admin_user=supervisor --admin_email=info@example.com --prompt=admin_password < admin_password.txt
wp core multisite-convert
Переводит существующую установку WP в мультисайт установку.
Creates the multisite database tables, and adds the multisite constants to wp-config.php.
For those using WordPress with Apache, remember to update the .htaccess file with the appropriate multisite rewrite rules.
Review the multisite documentation for more details about how multisite works.
Использование
wp core multisite-convert [--title={network-title}] [--base={url-path}] [--subdomains]
Можно указать Глобальные параметры и следующие:
- [--title={network-title}]
- The title of the new network.
- [--base={url-path}]
- Base path after the domain name that each site url will start with.
По умолчанию: / - [--subdomains]
- If passed, the network will use subdomains, instead of subdirectories. Doesn't work with 'localhost'.
Примеры
$ wp core multisite-convert Set up multisite database tables. Added multisite constants to wp-config.php. Success: Network installed. Don't forget to set up rewrite rules.
wp core multisite-install
Устанавливает WordPress multisite с нуля.
Creates the WordPress tables in the database using the URL, title, and default admin user details provided. Then, creates the multisite tables in the database and adds multisite constants to the wp-config.php.
For those using WordPress with Apache, remember to update the .htaccess file with the appropriate multisite rewrite rules.
Использование
wp core multisite-install [--url={url}] [--base={url-path}] [--subdomains] --title={site-title} --admin_user={username} [--admin_password={password}] --admin_email={email} [--skip-email] [--skip-config]
Можно указать Глобальные параметры и следующие:
- [--url={url}]
- The address of the new site.
- [--base={url-path}]
- Base path after the domain name that each site url in the network will start with.
По умолчанию: / - [--subdomains]
- If passed, the network will use subdomains, instead of subdirectories. Doesn't work with 'localhost'.
- --title={site-title}
- The title of the new site.
- --admin_user={username}
- The name of the admin user.
По умолчанию: admin - [--admin_password={password}]
- The password for the admin user. Defaults to randomly generated string.
- --admin_email={email}
- The email address for the admin user.
- [--skip-email]
- Don't send an email notification to the new admin user.
- [--skip-config]
- Don't add multisite constants to wp-config.php.
Примеры
$ wp core multisite-install --title="Welcome to the WordPress" \ > --admin_user="admin" --admin_password="password" \ > --admin_email="user@example.com" Single site database tables already present. Set up multisite database tables. Added multisite constants to wp-config.php. Success: Network installed. Don't forget to set up rewrite rules.
wp core version
Отображает версию WordPress.
Использование
wp core version [--extra]
Можно указать Глобальные параметры и следующие:
- [--extra]
- Show extended version information.
Примеры
# Display the WordPress version $ wp core version 4.5.2
# Display WordPress version along with other information $ wp core version --extra WordPress version: 4.5.2 Database revision: 36686 TinyMCE version: 4.310 (4310-20160418) Package language: en_US
wp core update
Обновляет WordPress до новой версии.
Defaults to updating WordPress to the latest version.
If you see "Error: Another update is currently in progress.", you may need to run wp option delete core_updater.lock after verifying another update isn't actually running.
Использование
wp core update [{zip}] [--minor] [--version={version}] [--force] [--locale={locale}]
Можно указать Глобальные параметры и следующие:
- [{zip}]
- Path to zip file to use, instead of downloading from wordpress.org.
- [--minor]
- Only perform updates for minor releases (e.g. update from WP 4.3 to 4.3.3 instead of 4.4.2).
- [--version={version}]
- Update to a specific version, instead of to the latest version. Alternatively accepts 'nightly'.
- [--force]
- Update even when installed WP version is greater than the requested version.
- [--locale={locale}]
- Select which language you want to download.
Примеры
# Update WordPress $ wp core update Updating to version 4.5.2 (en_US)... Downloading update from https://downloads.wordpress.org/release/wordpress-4.5.2-no-content.zip... Unpacking the update... Cleaning up files... No files found that need cleaning up Success: WordPress updated successfully.
# Update WordPress to latest version of 3.8 release $ wp core update --version=3.8 ../latest.zip Updating to version 3.8 ()... Unpacking the update... Cleaning up files... File removed: wp-admin/js/tags-box.js ... File removed: wp-admin/js/updates.min. 377 files cleaned up Success: WordPress updated successfully.
# Update WordPress to 3.1 forcefully $ wp core update --version=3.1 --force Updating to version 3.1 (en_US)... Downloading update from https://wordpress.org/wordpress-3.1.zip... Unpacking the update... Warning: Checksums not available for WordPress 3.1/en_US. Please cleanup files manually. Success: WordPress updated successfully.
wp core update-db
Запускает процедуру обновления базы данных WordPress.
- [--network]
- Update databases for all sites on a network
- [--dry-run]
- Compare database versions without performing the update.
Использование
wp core update-db [--network] [--dry-run]
Примеры
# Update the WordPress database $ wp core update-db Success: WordPress database upgraded successfully from db version 36686 to 35700.
# Update databases for all sites on a network $ wp core update-db --network WordPress database upgraded successfully from db version 35700 to 29630 on example.com/ Success: WordPress database upgraded on 123/123 sites
wp core verify-checksums
Проверяет файлы WordPress на соответствие контрольной сумме файлов из WordPress.org.
Downloads md5 checksums for the current version from WordPress.org, and compares those checksums against the currently installed files.
For security, avoids loading WordPress when verifying checksums.
If you experience issues verifying from this command, ensure you are passing the relevant --locale and --version arguments according to the values from the Dashboard->Updates menu in the admin area of the site.
Использование
wp core verify-checksums [--version={version}] [--locale={locale}]
Можно указать Глобальные параметры и следующие:
- [--version={version}]
- Verify checksums against a specific version of WordPress.
- [--locale={locale}]
- Verify checksums against a specific locale of WordPress.
Примеры
Успешная проверка контрольной суммы текущей версии WordPress:
$ wp core verify-checksums Success: WordPress installation verifies against checksums.
Успешная проверка контрольной суммы указанной версии WordPress
$ wp core verify-checksums --version=4.0 Success: WordPress installation verifies against checksums.
Успешная проверка контрольной суммы указанной локали текущей версии WordPress
$ wp core verify-checksums --locale=en_US Success: WordPress installation verifies against checksums.
Проверка контрольной суммы указанной локали текущей версии WordPress, где несколько файлов не прошли проверку:
$ wp core verify-checksums --locale=ja Warning: File doesn't verify against checksum: wp-includes/version.php Warning: File doesn't verify against checksum: readme.html Warning: File doesn't verify against checksum: wp-config-sample.php Error: WordPress installation doesn't verify against checksums.
А вот реальный пример, когда сайт заражён вирусом и проверка показывает какие файлы были добавлены и изменены:
$ wp core verify-checksums Warning: File doesn't verify against checksum: wp-includes/post.php Warning: File should not exist: wp-includes/wp-tmp.php Warning: File should not exist: wp-includes/wp-vcd.php Error: WordPress installation doesn't verify against checksums.
Удалим файл class-wp-post.php и запустим проверку:
$ wp core verify-checksums Warning: File doesn't verify against checksum: wp-includes/class-wp-post.php Error: WordPress installation doesn't verify against checksums.