legacyKeys() as $key ) { delete_site_option( $key ); } delete_site_transient( self::LEGACY_IDENTIFIER . '_process_lock' ); wp_clear_scheduled_hook( self::LEGACY_IDENTIFIER . '_cron' ); } /** * {@inheritDoc} * * @since 4.0.4 * * @return bool */ public function verify() { if ( wp_next_scheduled( self::LEGACY_IDENTIFIER . '_cron' ) ) { return false; } return [] === $this->legacyKeys(); } /** * Every batch key the retired queue still has on disk. * * Read straight off the table because each key carries a random suffix. The table mirrors the * library's own resolution: network installs kept the queue in sitemeta, single sites in options. * * @since 4.0.4 * * @return array */ private function legacyKeys() { $db = aioseo404To301()->core->db->db; $prefix = $db->esc_like( self::LEGACY_IDENTIFIER . '_batch_' ) . '%'; // Spelled out per branch rather than interpolated: the batch keys are the only thing that // varies, and a literal table/column keeps the query legible to the wp.org scanners. if ( is_multisite() ) { $keys = $db->get_col( // phpcs:ignore WordPress.DB.DirectDatabaseQuery $db->prepare( "SELECT meta_key FROM {$db->sitemeta} WHERE meta_key LIKE %s", $prefix ) ); } else { $keys = $db->get_col( // phpcs:ignore WordPress.DB.DirectDatabaseQuery $db->prepare( "SELECT option_name FROM {$db->options} WHERE option_name LIKE %s", $prefix ) ); } return array_map( 'strval', (array) $keys ); } }