Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
WP Plugins
Cron-Control
Commits
cf0f077a
Commit
cf0f077a
authored
Sep 10, 2017
by
Erick Hitter
Browse files
PHPCS fixes
parent
611a0708
Changes
1
Hide whitespace changes
Inline
Side-by-side
includes/wp-cli/class-one-time-fixers.php
View file @
cf0f077a
...
...
@@ -36,6 +36,7 @@ class One_Time_Fixers extends \WP_CLI_Command {
$count
=
(
int
)
$wpdb
->
get_var
(
"SELECT COUNT(ID) FROM
{
$table_name
}
"
);
// Cannot prepare table name. @codingStandardsIgnoreLine
if
(
$count
>
1
)
{
/* translators: 1: Event count */
\
WP_CLI
::
log
(
sprintf
(
__
(
'Found %s total items'
,
'automattic-cron-control'
),
number_format_i18n
(
$count
)
)
.
"
\n\n
"
);
if
(
$dry_run
)
{
...
...
@@ -63,6 +64,7 @@ class One_Time_Fixers extends \WP_CLI_Command {
// Remove the now-stale cache when actively run.
if
(
!
$dry_run
)
{
\
Automattic\WP\Cron_Control\_flush_internal_caches
();
/* translators: 1: Plugin name */
\
WP_CLI
::
log
(
"
\n
"
.
sprintf
(
__
(
'Cleared the %s cache'
,
'automattic-cron-control'
),
'Cron Control'
)
);
}
...
...
@@ -97,6 +99,7 @@ class One_Time_Fixers extends \WP_CLI_Command {
$count
=
(
int
)
$wpdb
->
get_var
(
$wpdb
->
prepare
(
"SELECT COUNT(ID) FROM
{
$wpdb
->
posts
}
WHERE post_type = %s;"
,
'a8c_cron_ctrl_event'
)
);
if
(
$count
>
0
)
{
/* translators: 1: Event count */
\
WP_CLI
::
log
(
sprintf
(
_n
(
'Found %s item'
,
'Found %s total items'
,
$count
,
'automattic-cron-control'
),
number_format_i18n
(
$count
)
)
.
"
\n\n
"
);
\
WP_CLI
::
confirm
(
__
(
'Proceed?'
,
'automattic-cron-control'
)
);
}
else
{
...
...
@@ -116,6 +119,8 @@ class One_Time_Fixers extends \WP_CLI_Command {
}
else
{
$page_size
=
250
;
}
/* translators: 1: Batch size */
\
WP_CLI
::
log
(
sprintf
(
__
(
'Processing in batches of %s'
,
'automattic-cron-control'
),
number_format_i18n
(
$page_size
)
)
.
"
\n\n
"
);
$pages
=
1
;
...
...
@@ -127,6 +132,7 @@ class One_Time_Fixers extends \WP_CLI_Command {
// Let's get on with it.
do
{
/* translators: 1: Current page, 2: total pages */
\
WP_CLI
::
log
(
"
\n\n
"
.
sprintf
(
__
(
'Processing page %1$s of %2$s'
,
'automattic-cron-control'
),
number_format_i18n
(
$page
),
number_format_i18n
(
$pages
)
)
.
"
\n
"
);
$items
=
$wpdb
->
get_results
(
$wpdb
->
prepare
(
"SELECT ID, post_title FROM
{
$wpdb
->
posts
}
WHERE post_type = %s LIMIT %d,%d"
,
'a8c_cron_ctrl_event'
,
absint
(
(
$page
-
1
)
*
$page_size
),
$page_size
)
);
...
...
@@ -137,6 +143,7 @@ class One_Time_Fixers extends \WP_CLI_Command {
break
;
}
/* translators: 1: Event count for this batch */
\
WP_CLI
::
log
(
sprintf
(
__
(
'Found %s items in this batch'
),
number_format_i18n
(
count
(
$items
)
)
)
);
foreach
(
$items
as
$item
)
{
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment