equal
deleted
inserted
replaced
145 * Dies if requirements are not met. |
145 * Dies if requirements are not met. |
146 * |
146 * |
147 * @since 3.0.0 |
147 * @since 3.0.0 |
148 * @access private |
148 * @access private |
149 * |
149 * |
150 * @global string $required_php_version The required PHP version string. |
150 * @global string $required_php_version The required PHP version string. |
151 * @global string $wp_version The WordPress version string. |
151 * @global string[] $required_php_extensions The names of required PHP extensions. |
|
152 * @global string $wp_version The WordPress version string. |
152 */ |
153 */ |
153 function wp_check_php_mysql_versions() { |
154 function wp_check_php_mysql_versions() { |
154 global $required_php_version, $wp_version; |
155 global $required_php_version, $required_php_extensions, $wp_version; |
155 |
156 |
156 $php_version = PHP_VERSION; |
157 $php_version = PHP_VERSION; |
157 |
158 |
158 if ( version_compare( $required_php_version, $php_version, '>' ) ) { |
159 if ( version_compare( $required_php_version, $php_version, '>' ) ) { |
159 $protocol = wp_get_server_protocol(); |
160 $protocol = wp_get_server_protocol(); |
166 $required_php_version |
167 $required_php_version |
167 ); |
168 ); |
168 exit( 1 ); |
169 exit( 1 ); |
169 } |
170 } |
170 |
171 |
|
172 $missing_extensions = array(); |
|
173 |
|
174 if ( isset( $required_php_extensions ) && is_array( $required_php_extensions ) ) { |
|
175 foreach ( $required_php_extensions as $extension ) { |
|
176 if ( extension_loaded( $extension ) ) { |
|
177 continue; |
|
178 } |
|
179 |
|
180 $missing_extensions[] = sprintf( |
|
181 'WordPress %1$s requires the <code>%2$s</code> PHP extension.', |
|
182 $wp_version, |
|
183 $extension |
|
184 ); |
|
185 } |
|
186 } |
|
187 |
|
188 if ( count( $missing_extensions ) > 0 ) { |
|
189 $protocol = wp_get_server_protocol(); |
|
190 header( sprintf( '%s 500 Internal Server Error', $protocol ), true, 500 ); |
|
191 header( 'Content-Type: text/html; charset=utf-8' ); |
|
192 echo implode( '<br>', $missing_extensions ); |
|
193 exit( 1 ); |
|
194 } |
|
195 |
171 // This runs before default constants are defined, so we can't assume WP_CONTENT_DIR is set yet. |
196 // This runs before default constants are defined, so we can't assume WP_CONTENT_DIR is set yet. |
172 $wp_content_dir = defined( 'WP_CONTENT_DIR' ) ? WP_CONTENT_DIR : ABSPATH . 'wp-content'; |
197 $wp_content_dir = defined( 'WP_CONTENT_DIR' ) ? WP_CONTENT_DIR : ABSPATH . 'wp-content'; |
173 |
198 |
174 if ( ! function_exists( 'mysqli_connect' ) |
199 if ( ! function_exists( 'mysqli_connect' ) |
175 && ! file_exists( $wp_content_dir . '/db.php' ) |
200 && ! file_exists( $wp_content_dir . '/db.php' ) |
450 return true; |
475 return true; |
451 } |
476 } |
452 |
477 |
453 /** |
478 /** |
454 * Gets the time elapsed so far during this PHP script. |
479 * Gets the time elapsed so far during this PHP script. |
455 * |
|
456 * Uses REQUEST_TIME_FLOAT that appeared in PHP 5.4.0. |
|
457 * |
480 * |
458 * @since 5.8.0 |
481 * @since 5.8.0 |
459 * |
482 * |
460 * @return float Seconds since the PHP script started. |
483 * @return float Seconds since the PHP script started. |
461 */ |
484 */ |
876 'blog-details', |
899 'blog-details', |
877 'blog-id-cache', |
900 'blog-id-cache', |
878 'blog-lookup', |
901 'blog-lookup', |
879 'blog_meta', |
902 'blog_meta', |
880 'global-posts', |
903 'global-posts', |
|
904 'image_editor', |
881 'networks', |
905 'networks', |
882 'network-queries', |
906 'network-queries', |
883 'sites', |
907 'sites', |
884 'site-details', |
908 'site-details', |
885 'site-options', |
909 'site-options', |
1428 |
1452 |
1429 return false; |
1453 return false; |
1430 } |
1454 } |
1431 |
1455 |
1432 /** |
1456 /** |
|
1457 * Converts a value to non-negative integer. |
|
1458 * |
|
1459 * @since 2.5.0 |
|
1460 * |
|
1461 * @param mixed $maybeint Data you wish to have converted to a non-negative integer. |
|
1462 * @return int A non-negative integer. |
|
1463 */ |
|
1464 function absint( $maybeint ) { |
|
1465 return abs( (int) $maybeint ); |
|
1466 } |
|
1467 |
|
1468 /** |
1433 * Retrieves the current site ID. |
1469 * Retrieves the current site ID. |
1434 * |
1470 * |
1435 * @since 3.1.0 |
1471 * @since 3.1.0 |
1436 * |
1472 * |
1437 * @global int $blog_id |
1473 * @global int $blog_id |
1679 if ( function_exists( 'ini_get_all' ) ) { |
1715 if ( function_exists( 'ini_get_all' ) ) { |
1680 $ini_all = ini_get_all(); |
1716 $ini_all = ini_get_all(); |
1681 } |
1717 } |
1682 } |
1718 } |
1683 |
1719 |
1684 // Bit operator to workaround https://bugs.php.net/bug.php?id=44936 which changes access level to 63 in PHP 5.2.6 - 5.2.17. |
|
1685 if ( isset( $ini_all[ $setting ]['access'] ) |
1720 if ( isset( $ini_all[ $setting ]['access'] ) |
1686 && ( INI_ALL === ( $ini_all[ $setting ]['access'] & 7 ) || INI_USER === ( $ini_all[ $setting ]['access'] & 7 ) ) |
1721 && ( INI_ALL === $ini_all[ $setting ]['access'] || INI_USER === $ini_all[ $setting ]['access'] ) |
1687 ) { |
1722 ) { |
1688 return true; |
1723 return true; |
1689 } |
1724 } |
1690 |
1725 |
1691 // If we were unable to retrieve the details, fail gracefully to assume it's changeable. |
1726 // If we were unable to retrieve the details, fail gracefully to assume it's changeable. |
1807 return; |
1842 return; |
1808 } |
1843 } |
1809 |
1844 |
1810 $key = substr( sanitize_key( wp_unslash( $_REQUEST['wp_scrape_key'] ) ), 0, 32 ); |
1845 $key = substr( sanitize_key( wp_unslash( $_REQUEST['wp_scrape_key'] ) ), 0, 32 ); |
1811 $nonce = wp_unslash( $_REQUEST['wp_scrape_nonce'] ); |
1846 $nonce = wp_unslash( $_REQUEST['wp_scrape_nonce'] ); |
1812 |
1847 if ( empty( $key ) || empty( $nonce ) ) { |
1813 if ( get_transient( 'scrape_key_' . $key ) !== $nonce ) { |
1848 return; |
|
1849 } |
|
1850 |
|
1851 $transient = get_transient( 'scrape_key_' . $key ); |
|
1852 if ( false === $transient ) { |
|
1853 return; |
|
1854 } |
|
1855 |
|
1856 if ( $transient !== $nonce ) { |
|
1857 if ( ! headers_sent() ) { |
|
1858 header( 'X-Robots-Tag: noindex' ); |
|
1859 nocache_headers(); |
|
1860 } |
1814 echo "###### wp_scraping_result_start:$key ######"; |
1861 echo "###### wp_scraping_result_start:$key ######"; |
1815 echo wp_json_encode( |
1862 echo wp_json_encode( |
1816 array( |
1863 array( |
1817 'code' => 'scrape_nonce_failure', |
1864 'code' => 'scrape_nonce_failure', |
1818 'message' => __( 'Scrape key check failed. Please try again.' ), |
1865 'message' => __( 'Scrape key check failed. Please try again.' ), |