From 6c66b1b24d581d1fa11fb7c65fde922b1deb404e Mon Sep 17 00:00:00 2001
From: Morgan Estes <morgan.estes@gmail.com>
Date: Mon, 22 Dec 2014 22:30:12 -0500
Subject: [PATCH] Update PHP docblocks for upgrade methods.
- Add short and long descriptions where missing.
- Remove an extra "@since" in a block.
- Punctuation added where required.
---
src/wp-admin/includes/upgrade.php | 29 +++++++++++++++++------------
1 file changed, 17 insertions(+), 12 deletions(-)
diff --git a/src/wp-admin/includes/upgrade.php b/src/wp-admin/includes/upgrade.php
index b72303a..608cde2 100644
|
a
|
b
|
|
| 2 | 2 | /** |
| 3 | 3 | * WordPress Upgrade API |
| 4 | 4 | * |
| 5 | | * Most of the functions are pluggable and can be overwritten |
| | 5 | * Most of the functions are pluggable and can be overwritten. |
| 6 | 6 | * |
| 7 | 7 | * @package WordPress |
| 8 | 8 | * @subpackage Administration |
| … |
… |
require_once(ABSPATH . 'wp-admin/includes/schema.php'); |
| 20 | 20 | |
| 21 | 21 | if ( !function_exists('wp_install') ) : |
| 22 | 22 | /** |
| 23 | | * Installs the blog |
| | 23 | * Installs the blog. |
| 24 | 24 | * |
| 25 | | * {@internal Missing Long Description}} |
| | 25 | * Runs the required functions to set up and populate the database, |
| | 26 | * including primary admin user and initial options. |
| 26 | 27 | * |
| 27 | 28 | * @since 2.1.0 |
| 28 | 29 | * |
| … |
… |
endif; |
| 108 | 109 | |
| 109 | 110 | if ( !function_exists('wp_install_defaults') ) : |
| 110 | 111 | /** |
| 111 | | * {@internal Missing Short Description}} |
| | 112 | * Creates the initial content for a newly-installed site. |
| 112 | 113 | * |
| 113 | | * {@internal Missing Long Description}} |
| | 114 | * Adds the default "Uncategorized" category, the first post (with comment), |
| | 115 | * first page, and default widgets for default theme for the current version. |
| 114 | 116 | * |
| 115 | 117 | * @since 2.1.0 |
| 116 | 118 | * |
| … |
… |
endif; |
| 262 | 264 | |
| 263 | 265 | if ( !function_exists('wp_new_blog_notification') ) : |
| 264 | 266 | /** |
| 265 | | * {@internal Missing Short Description}} |
| | 267 | * Notify the site admin that the setup is complete. |
| 266 | 268 | * |
| 267 | | * {@internal Missing Long Description}} |
| | 269 | * Sends an email with {@link wp_mail} to the new administrator that the site |
| | 270 | * setup is complete, and provides them with a record of their login credentials. |
| 268 | 271 | * |
| 269 | 272 | * @since 2.1.0 |
| 270 | 273 | * |
| … |
… |
if ( !function_exists('wp_upgrade') ) : |
| 302 | 305 | /** |
| 303 | 306 | * Run WordPress Upgrade functions. |
| 304 | 307 | * |
| 305 | | * {@internal Missing Long Description}} |
| | 308 | * Upgrades the database if needed during a site update. |
| 306 | 309 | * |
| 307 | 310 | * @since 2.1.0 |
| 308 | 311 | * |
| 309 | | * @return null |
| | 312 | * @return null If no update is necessary or site isn't completely installed. |
| 310 | 313 | */ |
| 311 | 314 | function wp_upgrade() { |
| 312 | 315 | global $wp_current_db_version, $wp_db_version, $wpdb; |
| … |
… |
endif; |
| 351 | 354 | /** |
| 352 | 355 | * Functions to be called in install and upgrade scripts. |
| 353 | 356 | * |
| 354 | | * {@internal Missing Long Description}} |
| | 357 | * Contains conditional checks to determine which upgrade scripts to run, based on |
| | 358 | * database version and WP version we're updating to. |
| 355 | 359 | * |
| 356 | 360 | * @since 1.0.1 |
| | 361 | * |
| | 362 | * @return null If no update is necessary. |
| 357 | 363 | */ |
| 358 | 364 | function upgrade_all() { |
| 359 | 365 | global $wp_current_db_version, $wp_db_version; |
| … |
… |
function upgrade_370() { |
| 1290 | 1296 | * Execute changes made in WordPress 3.7.2. |
| 1291 | 1297 | * |
| 1292 | 1298 | * @since 3.7.2 |
| 1293 | | * @since 3.8.0 |
| 1294 | 1299 | */ |
| 1295 | 1300 | function upgrade_372() { |
| 1296 | 1301 | global $wp_current_db_version; |
| … |
… |
function upgrade_400() { |
| 1329 | 1334 | } |
| 1330 | 1335 | |
| 1331 | 1336 | /** |
| 1332 | | * Execute network level changes |
| | 1337 | * Execute network level changes. |
| 1333 | 1338 | * |
| 1334 | 1339 | * @since 3.0.0 |
| 1335 | 1340 | */ |
--
2.2.1
From ef1cc4e4faa26edcbc0872e279651d80e1aa1d23 Mon Sep 17 00:00:00 2001
From: Morgan Estes <morgan.estes@gmail.com>
Date: Mon, 22 Dec 2014 23:35:28 -0500
Subject: [PATCH] Update docblocks with descriptions and updated parameter and
return info.
---
src/wp-admin/includes/upgrade.php | 66 ++++++++++++++++++++++-----------------
1 file changed, 37 insertions(+), 29 deletions(-)
diff --git a/src/wp-admin/includes/upgrade.php b/src/wp-admin/includes/upgrade.php
index 608cde2..a983c57 100644
|
a
|
b
|
function upgrade_network() { |
| 1436 | 1436 | // General |
| 1437 | 1437 | |
| 1438 | 1438 | /** |
| 1439 | | * {@internal Missing Short Description}} |
| | 1439 | * Create a table in the database if it doesn't already exist. |
| 1440 | 1440 | * |
| 1441 | | * {@internal Missing Long Description}} |
| | 1441 | * This method checks for an existing database and creates a new one if it's not |
| | 1442 | * already present. It doesn't rely on MySQL's "IF NOT EXISTS" statement, but chooses |
| | 1443 | * to query all tables first and then run the SQL statement creating the table. |
| 1442 | 1444 | * |
| 1443 | 1445 | * @since 1.0.0 |
| 1444 | 1446 | * |
| … |
… |
function maybe_create_table($table_name, $create_ddl) { |
| 1466 | 1468 | } |
| 1467 | 1469 | |
| 1468 | 1470 | /** |
| 1469 | | * {@internal Missing Short Description}} |
| | 1471 | * Drop a specified index from a table. |
| 1470 | 1472 | * |
| 1471 | 1473 | * {@internal Missing Long Description}} |
| 1472 | 1474 | * |
| … |
… |
function drop_index($table, $index) { |
| 1489 | 1491 | } |
| 1490 | 1492 | |
| 1491 | 1493 | /** |
| 1492 | | * {@internal Missing Short Description}} |
| | 1494 | * Add an index to a specified table. |
| 1493 | 1495 | * |
| 1494 | 1496 | * {@internal Missing Long Description}} |
| 1495 | 1497 | * |
| … |
… |
function get_alloptions_110() { |
| 1553 | 1555 | } |
| 1554 | 1556 | |
| 1555 | 1557 | /** |
| 1556 | | * Version of get_option that is private to install/upgrade. |
| | 1558 | * Version of {@link get_option} that is private to install/upgrade. |
| 1557 | 1559 | * |
| 1558 | 1560 | * @since 1.5.1 |
| 1559 | 1561 | * @access private |
| … |
… |
function __get_option($setting) { |
| 1582 | 1584 | } |
| 1583 | 1585 | |
| 1584 | 1586 | /** |
| 1585 | | * {@internal Missing Short Description}} |
| | 1587 | * Filter for content to remove unnecessary slashes. |
| 1586 | 1588 | * |
| 1587 | 1589 | * {@internal Missing Long Description}} |
| 1588 | 1590 | * |
| 1589 | 1591 | * @since 1.5.0 |
| 1590 | 1592 | * |
| 1591 | | * @param string $content |
| 1592 | | * @return string |
| | 1593 | * @param string $content The content to modify. |
| | 1594 | * @return string The de-slashed content. |
| 1593 | 1595 | */ |
| 1594 | 1596 | function deslash($content) { |
| 1595 | 1597 | // Note: \\\ inside a regex denotes a single backslash. |
| … |
… |
function deslash($content) { |
| 1613 | 1615 | } |
| 1614 | 1616 | |
| 1615 | 1617 | /** |
| 1616 | | * {@internal Missing Short Description}} |
| | 1618 | * Modify the database based on specified SQL statements. |
| 1617 | 1619 | * |
| 1618 | | * {@internal Missing Long Description}} |
| | 1620 | * Useful for creating new tables, and updating existing tables to a new structure. |
| 1619 | 1621 | * |
| 1620 | 1622 | * @since 1.5.0 |
| 1621 | 1623 | * |
| 1622 | | * @param string $queries |
| 1623 | | * @param bool $execute |
| 1624 | | * @return array |
| | 1624 | * @param string|array $queries The query to run. Can be multiple queries in an array, |
| | 1625 | * or a string of queries separated by semicolons. |
| | 1626 | * @param bool $execute Whether or not to execute the query right away. |
| | 1627 | * @return array Strings containing the results of the various update queries. |
| 1625 | 1628 | */ |
| 1626 | 1629 | function dbDelta( $queries = '', $execute = true ) { |
| 1627 | 1630 | global $wpdb; |
| … |
… |
function dbDelta( $queries = '', $execute = true ) { |
| 1864 | 1867 | } |
| 1865 | 1868 | |
| 1866 | 1869 | /** |
| 1867 | | * {@internal Missing Short Description}} |
| | 1870 | * Update the database tables to a new schema. |
| 1868 | 1871 | * |
| 1869 | | * {@internal Missing Long Description}} |
| | 1872 | * By default, updates all the tables to use the latest defined schema, but can also |
| | 1873 | * be used to update a specific set of tables in {@see wp_get_db_schema()}. |
| 1870 | 1874 | * |
| 1871 | 1875 | * @since 1.5.0 |
| | 1876 | * @uses dbDelta |
| | 1877 | * |
| | 1878 | * @param string $tables Optional. Which set of tables to update. Default is 'all'. |
| 1872 | 1879 | */ |
| 1873 | 1880 | function make_db_current( $tables = 'all' ) { |
| 1874 | 1881 | $alterations = dbDelta( $tables ); |
| … |
… |
function make_db_current( $tables = 'all' ) { |
| 1878 | 1885 | } |
| 1879 | 1886 | |
| 1880 | 1887 | /** |
| 1881 | | * {@internal Missing Short Description}} |
| | 1888 | * Update the database tables to a new schema, but without displaying results. |
| 1882 | 1889 | * |
| 1883 | | * {@internal Missing Long Description}} |
| | 1890 | * By default, updates all the tables to use the latest defined schema, but can also |
| | 1891 | * be used to update a specific set of tables in {@see wp_get_db_schema()}. |
| 1884 | 1892 | * |
| 1885 | 1893 | * @since 1.5.0 |
| | 1894 | * @see make_db_current() |
| | 1895 | * |
| | 1896 | * @param string $tables Optional. Which set of tables to update. Default is 'all'. |
| 1886 | 1897 | */ |
| 1887 | 1898 | function make_db_current_silent( $tables = 'all' ) { |
| 1888 | 1899 | dbDelta( $tables ); |
| 1889 | 1900 | } |
| 1890 | 1901 | |
| 1891 | 1902 | /** |
| 1892 | | * {@internal Missing Short Description}} |
| | 1903 | * Create a site theme from an existing theme. |
| 1893 | 1904 | * |
| 1894 | 1905 | * {@internal Missing Long Description}} |
| 1895 | 1906 | * |
| 1896 | 1907 | * @since 1.5.0 |
| 1897 | 1908 | * |
| 1898 | | * @param string $theme_name |
| 1899 | | * @param string $template |
| | 1909 | * @param string $theme_name The name of the theme. |
| | 1910 | * @param string $template The directory name of the theme. |
| 1900 | 1911 | * @return bool |
| 1901 | 1912 | */ |
| 1902 | 1913 | function make_site_theme_from_oldschool($theme_name, $template) { |
| … |
… |
function make_site_theme_from_oldschool($theme_name, $template) { |
| 1972 | 1983 | } |
| 1973 | 1984 | |
| 1974 | 1985 | /** |
| 1975 | | * {@internal Missing Short Description}} |
| | 1986 | * Create a site theme from the default theme. |
| 1976 | 1987 | * |
| 1977 | 1988 | * {@internal Missing Long Description}} |
| 1978 | 1989 | * |
| 1979 | 1990 | * @since 1.5.0 |
| 1980 | 1991 | * |
| 1981 | | * @param string $theme_name |
| 1982 | | * @param string $template |
| | 1992 | * @param string $theme_name The name of the theme. |
| | 1993 | * @param string $template The directory name of the theme. |
| 1983 | 1994 | * @return null|false |
| 1984 | 1995 | */ |
| 1985 | 1996 | function make_site_theme_from_default($theme_name, $template) { |
| … |
… |
function make_site_theme_from_default($theme_name, $template) { |
| 2036 | 2047 | @closedir($images_dir); |
| 2037 | 2048 | } |
| 2038 | 2049 | |
| 2039 | | // Create a site theme from the default theme. |
| 2040 | 2050 | /** |
| 2041 | | * {@internal Missing Short Description}} |
| | 2051 | * Create a site theme. |
| 2042 | 2052 | * |
| 2043 | 2053 | * {@internal Missing Long Description}} |
| 2044 | 2054 | * |
| … |
… |
function translate_level_to_role($level) { |
| 2117 | 2127 | } |
| 2118 | 2128 | |
| 2119 | 2129 | /** |
| 2120 | | * {@internal Missing Short Description}} |
| 2121 | | * |
| 2122 | | * {@internal Missing Long Description}} |
| | 2130 | * Check the version of the installed MySQL binary. |
| 2123 | 2131 | * |
| 2124 | 2132 | * @since 2.1.0 |
| 2125 | 2133 | */ |
| … |
… |
function maybe_disable_automattic_widgets() { |
| 2148 | 2156 | } |
| 2149 | 2157 | |
| 2150 | 2158 | /** |
| 2151 | | * Disables the Link Manager on upgrade, if at the time of upgrade, no links exist in the DB. |
| | 2159 | * Disables the Link Manager on upgrade if, at the time of upgrade, no links exist in the DB. |
| 2152 | 2160 | * |
| 2153 | 2161 | * @since 3.5.0 |
| 2154 | 2162 | */ |
--
2.2.1
From bee03fa40602c85701a0820b24030162a3c9c473 Mon Sep 17 00:00:00 2001
From: Morgan Estes <morgan.estes@gmail.com>
Date: Mon, 22 Dec 2014 23:36:35 -0500
Subject: [PATCH] Added docblock for a method that existed since 1.3, but
didn't have inline documentation consistent with current standards.
---
src/wp-admin/includes/upgrade.php | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/src/wp-admin/includes/upgrade.php b/src/wp-admin/includes/upgrade.php
index a983c57..595b426 100644
|
a
|
b
|
function add_clean_index($table, $index) { |
| 1509 | 1509 | } |
| 1510 | 1510 | |
| 1511 | 1511 | /** |
| 1512 | | ** maybe_add_column() |
| 1513 | | ** Add column to db table if it doesn't exist. |
| 1514 | | ** Returns: true if already exists or on successful completion |
| 1515 | | ** false on error |
| | 1512 | * Add column to a database table if it doesn't already exist. |
| | 1513 | * |
| | 1514 | * @since 1.3.0 |
| | 1515 | * |
| | 1516 | * @param string $table_name The table name to modify. |
| | 1517 | * @param string $column_name The column name to add to the table. |
| | 1518 | * @param string $create_ddl The SQL statement used to add the column. |
| | 1519 | * @return True if already exists or on successful completion, false on error. |
| 1516 | 1520 | */ |
| 1517 | 1521 | function maybe_add_column($table_name, $column_name, $create_ddl) { |
| 1518 | 1522 | global $wpdb; |
--
2.2.1
From 9dc70fff031667e64811569f1d8dfd257b661b2c Mon Sep 17 00:00:00 2001
From: Morgan Estes <morgan.estes@gmail.com>
Date: Mon, 22 Dec 2014 23:38:25 -0500
Subject: [PATCH] Removed long description stubs where no long description is
needed for a method.
---
src/wp-admin/includes/upgrade.php | 14 ++++----------
1 file changed, 4 insertions(+), 10 deletions(-)
diff --git a/src/wp-admin/includes/upgrade.php b/src/wp-admin/includes/upgrade.php
index 595b426..325c7ed 100644
|
a
|
b
|
function maybe_create_table($table_name, $create_ddl) { |
| 1470 | 1470 | /** |
| 1471 | 1471 | * Drop a specified index from a table. |
| 1472 | 1472 | * |
| 1473 | | * {@internal Missing Long Description}} |
| 1474 | | * |
| 1475 | 1473 | * @since 1.0.1 |
| 1476 | 1474 | * |
| 1477 | 1475 | * @param string $table Database table name. |
| … |
… |
function drop_index($table, $index) { |
| 1493 | 1491 | /** |
| 1494 | 1492 | * Add an index to a specified table. |
| 1495 | 1493 | * |
| 1496 | | * {@internal Missing Long Description}} |
| 1497 | | * |
| 1498 | 1494 | * @since 1.0.1 |
| 1499 | 1495 | * |
| 1500 | 1496 | * @param string $table Database table name. |
| … |
… |
function add_clean_index($table, $index) { |
| 1510 | 1506 | |
| 1511 | 1507 | /** |
| 1512 | 1508 | * Add column to a database table if it doesn't already exist. |
| 1513 | | * |
| | 1509 | * |
| 1514 | 1510 | * @since 1.3.0 |
| 1515 | | * |
| | 1511 | * |
| 1516 | 1512 | * @param string $table_name The table name to modify. |
| 1517 | 1513 | * @param string $column_name The column name to add to the table. |
| 1518 | 1514 | * @param string $create_ddl The SQL statement used to add the column. |
| … |
… |
function __get_option($setting) { |
| 1590 | 1586 | /** |
| 1591 | 1587 | * Filter for content to remove unnecessary slashes. |
| 1592 | 1588 | * |
| 1593 | | * {@internal Missing Long Description}} |
| 1594 | | * |
| 1595 | 1589 | * @since 1.5.0 |
| 1596 | 1590 | * |
| 1597 | 1591 | * @param string $content The content to modify. |
| … |
… |
function dbDelta( $queries = '', $execute = true ) { |
| 1878 | 1872 | * |
| 1879 | 1873 | * @since 1.5.0 |
| 1880 | 1874 | * @uses dbDelta |
| 1881 | | * |
| | 1875 | * |
| 1882 | 1876 | * @param string $tables Optional. Which set of tables to update. Default is 'all'. |
| 1883 | 1877 | */ |
| 1884 | 1878 | function make_db_current( $tables = 'all' ) { |
| … |
… |
function make_db_current( $tables = 'all' ) { |
| 1896 | 1890 | * |
| 1897 | 1891 | * @since 1.5.0 |
| 1898 | 1892 | * @see make_db_current() |
| 1899 | | * |
| | 1893 | * |
| 1900 | 1894 | * @param string $tables Optional. Which set of tables to update. Default is 'all'. |
| 1901 | 1895 | */ |
| 1902 | 1896 | function make_db_current_silent( $tables = 'all' ) { |