Edit File by line

Deprecated: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in /home/sportsfever/public_html/filemanger/function.php on line 93

Warning: Undefined array key "page_file_edit_line" in /home/sportsfever/public_html/filemanger/edit_text_line.php on line 32
/home/sportsfe.../httpdocs/wp-admin/includes
File: class-wp-automatic-updater.php
[1500] Fix | Delete
$email = compact( 'to', 'subject', 'body', 'headers' );
[1501] Fix | Delete
[1502] Fix | Delete
/**
[1503] Fix | Delete
* Filters the email sent following an automatic background update for plugins and themes.
[1504] Fix | Delete
*
[1505] Fix | Delete
* @since 5.5.0
[1506] Fix | Delete
*
[1507] Fix | Delete
* @param array $email {
[1508] Fix | Delete
* Array of email arguments that will be passed to wp_mail().
[1509] Fix | Delete
*
[1510] Fix | Delete
* @type string $to The email recipient. An array of emails
[1511] Fix | Delete
* can be returned, as handled by wp_mail().
[1512] Fix | Delete
* @type string $subject The email's subject.
[1513] Fix | Delete
* @type string $body The email message body.
[1514] Fix | Delete
* @type string $headers Any email headers, defaults to no headers.
[1515] Fix | Delete
* }
[1516] Fix | Delete
* @param string $type The type of email being sent. Can be one of 'success', 'fail', 'mixed'.
[1517] Fix | Delete
* @param array $successful_updates A list of updates that succeeded.
[1518] Fix | Delete
* @param array $failed_updates A list of updates that failed.
[1519] Fix | Delete
*/
[1520] Fix | Delete
$email = apply_filters( 'auto_plugin_theme_update_email', $email, $type, $successful_updates, $failed_updates );
[1521] Fix | Delete
[1522] Fix | Delete
$result = wp_mail( $email['to'], wp_specialchars_decode( $email['subject'] ), $email['body'], $email['headers'] );
[1523] Fix | Delete
[1524] Fix | Delete
if ( $result ) {
[1525] Fix | Delete
update_option( 'auto_plugin_theme_update_emails', $past_failure_emails );
[1526] Fix | Delete
}
[1527] Fix | Delete
}
[1528] Fix | Delete
[1529] Fix | Delete
/**
[1530] Fix | Delete
* Prepares and sends an email of a full log of background update results, useful for debugging and geekery.
[1531] Fix | Delete
*
[1532] Fix | Delete
* @since 3.7.0
[1533] Fix | Delete
*/
[1534] Fix | Delete
protected function send_debug_email() {
[1535] Fix | Delete
$update_count = 0;
[1536] Fix | Delete
foreach ( $this->update_results as $type => $updates ) {
[1537] Fix | Delete
$update_count += count( $updates );
[1538] Fix | Delete
}
[1539] Fix | Delete
[1540] Fix | Delete
$body = array();
[1541] Fix | Delete
$failures = 0;
[1542] Fix | Delete
[1543] Fix | Delete
/* translators: %s: Network home URL. */
[1544] Fix | Delete
$body[] = sprintf( __( 'WordPress site: %s' ), network_home_url( '/' ) );
[1545] Fix | Delete
[1546] Fix | Delete
// Core.
[1547] Fix | Delete
if ( isset( $this->update_results['core'] ) ) {
[1548] Fix | Delete
$result = $this->update_results['core'][0];
[1549] Fix | Delete
[1550] Fix | Delete
if ( $result->result && ! is_wp_error( $result->result ) ) {
[1551] Fix | Delete
/* translators: %s: WordPress version. */
[1552] Fix | Delete
$body[] = sprintf( __( 'SUCCESS: WordPress was successfully updated to %s' ), $result->name );
[1553] Fix | Delete
} else {
[1554] Fix | Delete
/* translators: %s: WordPress version. */
[1555] Fix | Delete
$body[] = sprintf( __( 'FAILED: WordPress failed to update to %s' ), $result->name );
[1556] Fix | Delete
++$failures;
[1557] Fix | Delete
}
[1558] Fix | Delete
[1559] Fix | Delete
$body[] = '';
[1560] Fix | Delete
}
[1561] Fix | Delete
[1562] Fix | Delete
// Plugins, Themes, Translations.
[1563] Fix | Delete
foreach ( array( 'plugin', 'theme', 'translation' ) as $type ) {
[1564] Fix | Delete
if ( ! isset( $this->update_results[ $type ] ) ) {
[1565] Fix | Delete
continue;
[1566] Fix | Delete
}
[1567] Fix | Delete
[1568] Fix | Delete
$success_items = wp_list_filter( $this->update_results[ $type ], array( 'result' => true ) );
[1569] Fix | Delete
[1570] Fix | Delete
if ( $success_items ) {
[1571] Fix | Delete
$messages = array(
[1572] Fix | Delete
'plugin' => __( 'The following plugins were successfully updated:' ),
[1573] Fix | Delete
'theme' => __( 'The following themes were successfully updated:' ),
[1574] Fix | Delete
'translation' => __( 'The following translations were successfully updated:' ),
[1575] Fix | Delete
);
[1576] Fix | Delete
[1577] Fix | Delete
$body[] = $messages[ $type ];
[1578] Fix | Delete
foreach ( wp_list_pluck( $success_items, 'name' ) as $name ) {
[1579] Fix | Delete
/* translators: %s: Name of plugin / theme / translation. */
[1580] Fix | Delete
$body[] = ' * ' . sprintf( __( 'SUCCESS: %s' ), $name );
[1581] Fix | Delete
}
[1582] Fix | Delete
}
[1583] Fix | Delete
[1584] Fix | Delete
if ( $success_items !== $this->update_results[ $type ] ) {
[1585] Fix | Delete
// Failed updates.
[1586] Fix | Delete
$messages = array(
[1587] Fix | Delete
'plugin' => __( 'The following plugins failed to update:' ),
[1588] Fix | Delete
'theme' => __( 'The following themes failed to update:' ),
[1589] Fix | Delete
'translation' => __( 'The following translations failed to update:' ),
[1590] Fix | Delete
);
[1591] Fix | Delete
[1592] Fix | Delete
$body[] = $messages[ $type ];
[1593] Fix | Delete
[1594] Fix | Delete
foreach ( $this->update_results[ $type ] as $item ) {
[1595] Fix | Delete
if ( ! $item->result || is_wp_error( $item->result ) ) {
[1596] Fix | Delete
/* translators: %s: Name of plugin / theme / translation. */
[1597] Fix | Delete
$body[] = ' * ' . sprintf( __( 'FAILED: %s' ), $item->name );
[1598] Fix | Delete
++$failures;
[1599] Fix | Delete
}
[1600] Fix | Delete
}
[1601] Fix | Delete
}
[1602] Fix | Delete
[1603] Fix | Delete
$body[] = '';
[1604] Fix | Delete
}
[1605] Fix | Delete
[1606] Fix | Delete
if ( '' !== get_bloginfo( 'name' ) ) {
[1607] Fix | Delete
$site_title = wp_specialchars_decode( get_bloginfo( 'name' ), ENT_QUOTES );
[1608] Fix | Delete
} else {
[1609] Fix | Delete
$site_title = parse_url( home_url(), PHP_URL_HOST );
[1610] Fix | Delete
}
[1611] Fix | Delete
[1612] Fix | Delete
if ( $failures ) {
[1613] Fix | Delete
$body[] = trim(
[1614] Fix | Delete
__(
[1615] Fix | Delete
"BETA TESTING?
[1616] Fix | Delete
=============
[1617] Fix | Delete
[1618] Fix | Delete
This debugging email is sent when you are using a development version of WordPress.
[1619] Fix | Delete
[1620] Fix | Delete
If you think these failures might be due to a bug in WordPress, could you report it?
[1621] Fix | Delete
* Open a thread in the support forums: https://wordpress.org/support/forum/alphabeta
[1622] Fix | Delete
* Or, if you're comfortable writing a bug report: https://core.trac.wordpress.org/
[1623] Fix | Delete
[1624] Fix | Delete
Thanks! -- The WordPress Team"
[1625] Fix | Delete
)
[1626] Fix | Delete
);
[1627] Fix | Delete
$body[] = '';
[1628] Fix | Delete
[1629] Fix | Delete
/* translators: Background update failed notification email subject. %s: Site title. */
[1630] Fix | Delete
$subject = sprintf( __( '[%s] Background Update Failed' ), $site_title );
[1631] Fix | Delete
} else {
[1632] Fix | Delete
/* translators: Background update finished notification email subject. %s: Site title. */
[1633] Fix | Delete
$subject = sprintf( __( '[%s] Background Update Finished' ), $site_title );
[1634] Fix | Delete
}
[1635] Fix | Delete
[1636] Fix | Delete
$body[] = trim(
[1637] Fix | Delete
__(
[1638] Fix | Delete
'UPDATE LOG
[1639] Fix | Delete
=========='
[1640] Fix | Delete
)
[1641] Fix | Delete
);
[1642] Fix | Delete
$body[] = '';
[1643] Fix | Delete
[1644] Fix | Delete
foreach ( array( 'core', 'plugin', 'theme', 'translation' ) as $type ) {
[1645] Fix | Delete
if ( ! isset( $this->update_results[ $type ] ) ) {
[1646] Fix | Delete
continue;
[1647] Fix | Delete
}
[1648] Fix | Delete
[1649] Fix | Delete
foreach ( $this->update_results[ $type ] as $update ) {
[1650] Fix | Delete
$body[] = $update->name;
[1651] Fix | Delete
$body[] = str_repeat( '-', strlen( $update->name ) );
[1652] Fix | Delete
[1653] Fix | Delete
foreach ( $update->messages as $message ) {
[1654] Fix | Delete
$body[] = ' ' . html_entity_decode( str_replace( '…', '...', $message ) );
[1655] Fix | Delete
}
[1656] Fix | Delete
[1657] Fix | Delete
if ( is_wp_error( $update->result ) ) {
[1658] Fix | Delete
$results = array( 'update' => $update->result );
[1659] Fix | Delete
[1660] Fix | Delete
// If we rolled back, we want to know an error that occurred then too.
[1661] Fix | Delete
if ( 'rollback_was_required' === $update->result->get_error_code() ) {
[1662] Fix | Delete
$results = (array) $update->result->get_error_data();
[1663] Fix | Delete
}
[1664] Fix | Delete
[1665] Fix | Delete
foreach ( $results as $result_type => $result ) {
[1666] Fix | Delete
if ( ! is_wp_error( $result ) ) {
[1667] Fix | Delete
continue;
[1668] Fix | Delete
}
[1669] Fix | Delete
[1670] Fix | Delete
if ( 'rollback' === $result_type ) {
[1671] Fix | Delete
/* translators: 1: Error code, 2: Error message. */
[1672] Fix | Delete
$body[] = ' ' . sprintf( __( 'Rollback Error: [%1$s] %2$s' ), $result->get_error_code(), $result->get_error_message() );
[1673] Fix | Delete
} else {
[1674] Fix | Delete
/* translators: 1: Error code, 2: Error message. */
[1675] Fix | Delete
$body[] = ' ' . sprintf( __( 'Error: [%1$s] %2$s' ), $result->get_error_code(), $result->get_error_message() );
[1676] Fix | Delete
}
[1677] Fix | Delete
[1678] Fix | Delete
if ( $result->get_error_data() ) {
[1679] Fix | Delete
$body[] = ' ' . implode( ', ', (array) $result->get_error_data() );
[1680] Fix | Delete
}
[1681] Fix | Delete
}
[1682] Fix | Delete
}
[1683] Fix | Delete
[1684] Fix | Delete
$body[] = '';
[1685] Fix | Delete
}
[1686] Fix | Delete
}
[1687] Fix | Delete
[1688] Fix | Delete
$email = array(
[1689] Fix | Delete
'to' => get_site_option( 'admin_email' ),
[1690] Fix | Delete
'subject' => $subject,
[1691] Fix | Delete
'body' => implode( "\n", $body ),
[1692] Fix | Delete
'headers' => '',
[1693] Fix | Delete
);
[1694] Fix | Delete
[1695] Fix | Delete
/**
[1696] Fix | Delete
* Filters the debug email that can be sent following an automatic
[1697] Fix | Delete
* background core update.
[1698] Fix | Delete
*
[1699] Fix | Delete
* @since 3.8.0
[1700] Fix | Delete
*
[1701] Fix | Delete
* @param array $email {
[1702] Fix | Delete
* Array of email arguments that will be passed to wp_mail().
[1703] Fix | Delete
*
[1704] Fix | Delete
* @type string $to The email recipient. An array of emails
[1705] Fix | Delete
* can be returned, as handled by wp_mail().
[1706] Fix | Delete
* @type string $subject Email subject.
[1707] Fix | Delete
* @type string $body Email message body.
[1708] Fix | Delete
* @type string $headers Any email headers. Default empty.
[1709] Fix | Delete
* }
[1710] Fix | Delete
* @param int $failures The number of failures encountered while upgrading.
[1711] Fix | Delete
* @param mixed $results The results of all attempted updates.
[1712] Fix | Delete
*/
[1713] Fix | Delete
$email = apply_filters( 'automatic_updates_debug_email', $email, $failures, $this->update_results );
[1714] Fix | Delete
[1715] Fix | Delete
wp_mail( $email['to'], wp_specialchars_decode( $email['subject'] ), $email['body'], $email['headers'] );
[1716] Fix | Delete
}
[1717] Fix | Delete
[1718] Fix | Delete
/**
[1719] Fix | Delete
* Performs a loopback request to check for potential fatal errors.
[1720] Fix | Delete
*
[1721] Fix | Delete
* Fatal errors cannot be detected unless maintenance mode is enabled.
[1722] Fix | Delete
*
[1723] Fix | Delete
* @since 6.6.0
[1724] Fix | Delete
*
[1725] Fix | Delete
* @global int $upgrading The Unix timestamp marking when upgrading WordPress began.
[1726] Fix | Delete
*
[1727] Fix | Delete
* @return bool Whether a fatal error was detected.
[1728] Fix | Delete
*/
[1729] Fix | Delete
protected function has_fatal_error() {
[1730] Fix | Delete
global $upgrading;
[1731] Fix | Delete
[1732] Fix | Delete
$maintenance_file = ABSPATH . '.maintenance';
[1733] Fix | Delete
if ( ! file_exists( $maintenance_file ) ) {
[1734] Fix | Delete
return false;
[1735] Fix | Delete
}
[1736] Fix | Delete
[1737] Fix | Delete
require $maintenance_file;
[1738] Fix | Delete
if ( ! is_int( $upgrading ) ) {
[1739] Fix | Delete
return false;
[1740] Fix | Delete
}
[1741] Fix | Delete
[1742] Fix | Delete
$scrape_key = md5( $upgrading );
[1743] Fix | Delete
$scrape_nonce = (string) $upgrading;
[1744] Fix | Delete
$transient = 'scrape_key_' . $scrape_key;
[1745] Fix | Delete
set_transient( $transient, $scrape_nonce, 30 );
[1746] Fix | Delete
[1747] Fix | Delete
$cookies = wp_unslash( $_COOKIE );
[1748] Fix | Delete
$scrape_params = array(
[1749] Fix | Delete
'wp_scrape_key' => $scrape_key,
[1750] Fix | Delete
'wp_scrape_nonce' => $scrape_nonce,
[1751] Fix | Delete
);
[1752] Fix | Delete
$headers = array(
[1753] Fix | Delete
'Cache-Control' => 'no-cache',
[1754] Fix | Delete
);
[1755] Fix | Delete
[1756] Fix | Delete
/** This filter is documented in wp-includes/class-wp-http-streams.php */
[1757] Fix | Delete
$sslverify = apply_filters( 'https_local_ssl_verify', false );
[1758] Fix | Delete
[1759] Fix | Delete
// Include Basic auth in the loopback request.
[1760] Fix | Delete
if ( isset( $_SERVER['PHP_AUTH_USER'] ) && isset( $_SERVER['PHP_AUTH_PW'] ) ) {
[1761] Fix | Delete
$headers['Authorization'] = 'Basic ' . base64_encode( wp_unslash( $_SERVER['PHP_AUTH_USER'] ) . ':' . wp_unslash( $_SERVER['PHP_AUTH_PW'] ) );
[1762] Fix | Delete
}
[1763] Fix | Delete
[1764] Fix | Delete
// Time to wait for loopback request to finish.
[1765] Fix | Delete
$timeout = 50; // 50 seconds.
[1766] Fix | Delete
[1767] Fix | Delete
$is_debug = WP_DEBUG && WP_DEBUG_LOG;
[1768] Fix | Delete
if ( $is_debug ) {
[1769] Fix | Delete
error_log( ' Scraping home page...' );
[1770] Fix | Delete
}
[1771] Fix | Delete
[1772] Fix | Delete
$needle_start = "###### wp_scraping_result_start:$scrape_key ######";
[1773] Fix | Delete
$needle_end = "###### wp_scraping_result_end:$scrape_key ######";
[1774] Fix | Delete
$url = add_query_arg( $scrape_params, home_url( '/' ) );
[1775] Fix | Delete
$response = wp_remote_get( $url, compact( 'cookies', 'headers', 'timeout', 'sslverify' ) );
[1776] Fix | Delete
[1777] Fix | Delete
if ( is_wp_error( $response ) ) {
[1778] Fix | Delete
if ( $is_debug ) {
[1779] Fix | Delete
error_log( 'Loopback request failed: ' . $response->get_error_message() );
[1780] Fix | Delete
}
[1781] Fix | Delete
return true;
[1782] Fix | Delete
}
[1783] Fix | Delete
[1784] Fix | Delete
// If this outputs `true` in the log, it means there were no fatal errors detected.
[1785] Fix | Delete
if ( $is_debug ) {
[1786] Fix | Delete
error_log( var_export( substr( $response['body'], strpos( $response['body'], '###### wp_scraping_result_start:' ) ), true ) );
[1787] Fix | Delete
}
[1788] Fix | Delete
[1789] Fix | Delete
$body = wp_remote_retrieve_body( $response );
[1790] Fix | Delete
$scrape_result_position = strpos( $body, $needle_start );
[1791] Fix | Delete
$result = null;
[1792] Fix | Delete
[1793] Fix | Delete
if ( false !== $scrape_result_position ) {
[1794] Fix | Delete
$error_output = substr( $body, $scrape_result_position + strlen( $needle_start ) );
[1795] Fix | Delete
$error_output = substr( $error_output, 0, strpos( $error_output, $needle_end ) );
[1796] Fix | Delete
$result = json_decode( trim( $error_output ), true );
[1797] Fix | Delete
}
[1798] Fix | Delete
[1799] Fix | Delete
delete_transient( $transient );
[1800] Fix | Delete
[1801] Fix | Delete
// Only fatal errors will result in a 'type' key.
[1802] Fix | Delete
return isset( $result['type'] );
[1803] Fix | Delete
}
[1804] Fix | Delete
}
[1805] Fix | Delete
[1806] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function