admin管理员组文章数量:1129645
I have the paid Divi theme on many websites on a cPanel powered server. I use WP-CLI in a bash script to update all the plugins and themes. But Divi will never update because it only reveals an update is available when you visit wp-admin/update-core.php When you visit that main update page with a browser, you'll see the update number next to "Updates" magically grow by +1.
What I want to do is call update-core.php so it runs one time, because after that happens, WP-CLI is able to detect the Divi update without any problem. At least this is what I think I want to do. Clearly I'm open to suggestions.
What I've tried so far:
This is the php script in the public web root:
<?php
define( 'WP_ADMIN', true );
ignore_user_abort(true);
$path = $_SERVER['DOCUMENT_ROOT'];
//define( 'SHORTINIT', true );
require( $path.'/wp-load.php' );
require( $path.'/wp-admin/update-core.php' );
But calling that from a browser just goes to a login screen, because it fails the current_user_can checks at the beginning of update-core.php Should I try to create a hacked version of update-core.php that has no user checks? Am I pursuing the wrong path entirely?
There was a discussion on GitHub but I was not able to get the --require feature to work with a script containing define( 'WP_ADMIN', true );
The bash script I use to bulk update is like this--
#!/bin/bash
declare -a arr=(
"account1"
"account2"
"account3"
)
for i in "${arr[@]}"
do
echo "$i"
echo ______________________________________________________
cd /home/"$i"/www
wp core update-db --allow-root
wp core update --allow-root
wp plugin update --all --allow-root
wp theme update --all --allow-root
chown -R "$i":"$i" *
done
I have the paid Divi theme on many websites on a cPanel powered server. I use WP-CLI in a bash script to update all the plugins and themes. But Divi will never update because it only reveals an update is available when you visit wp-admin/update-core.php When you visit that main update page with a browser, you'll see the update number next to "Updates" magically grow by +1.
What I want to do is call update-core.php so it runs one time, because after that happens, WP-CLI is able to detect the Divi update without any problem. At least this is what I think I want to do. Clearly I'm open to suggestions.
What I've tried so far:
This is the php script in the public web root:
<?php
define( 'WP_ADMIN', true );
ignore_user_abort(true);
$path = $_SERVER['DOCUMENT_ROOT'];
//define( 'SHORTINIT', true );
require( $path.'/wp-load.php' );
require( $path.'/wp-admin/update-core.php' );
But calling that from a browser just goes to a login screen, because it fails the current_user_can checks at the beginning of update-core.php Should I try to create a hacked version of update-core.php that has no user checks? Am I pursuing the wrong path entirely?
There was a discussion on GitHub but I was not able to get the --require feature to work with a script containing define( 'WP_ADMIN', true );
https://github.com/wp-cli/extension-command/issues/106
The bash script I use to bulk update is like this--
#!/bin/bash
declare -a arr=(
"account1"
"account2"
"account3"
)
for i in "${arr[@]}"
do
echo "$i"
echo ______________________________________________________
cd /home/"$i"/www
wp core update-db --allow-root
wp core update --allow-root
wp plugin update --all --allow-root
wp theme update --all --allow-root
chown -R "$i":"$i" *
done
Share
Improve this question
edited Aug 29, 2019 at 5:56
leymannx
3,2213 gold badges29 silver badges35 bronze badges
asked Aug 28, 2019 at 21:52
ElkratElkrat
1381 silver badge9 bronze badges
1
|
1 Answer
Reset to default 0WP-CLI was updated to include a new global parameter that allows the execution of arbitrary PHP code before the main command runs. This allows you to pass the is_admin() check that some themes and plugins use.
wp plugin update --all --exec="define( 'WP_ADMIN', true );"
本文标签: theme developmentHow can I ping updatecorephp with a script
版权声明:本文标题:theme development - How can I ping update-core.php with a script? 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1736746993a1950834.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
'update_themes'
site transient when there is an update so you could start by searching for that string. – Rup Commented Aug 28, 2019 at 23:37