Changeset 13876
- Timestamp:
- 07/04/2024 03:47:24 AM (5 weeks ago)
- Location:
- sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/class-plugin-directory.php
r13778 r13876 1729 1729 // Meta doesn't exist yet? Lets fill it out. 1730 1730 if ( false === $releases || ! is_array( $releases ) ) { 1731 update_post_meta( $plugin->ID, 'releases', [] ); 1732 1733 $tags = get_post_meta( $plugin->ID, 'tags', true ); 1734 if ( $tags ) { 1735 foreach ( $tags as $tag_version => $tag ) { 1736 self::add_release( $plugin, [ 1737 'date' => strtotime( $tag['date'] ), 1738 'tag' => $tag['tag'], 1739 'version' => $tag_version, 1740 'committer' => [ $tag['author'] ], 1741 'zips_built' => true, // Old release, assume they were built. 1742 'confirmations_required' => 0, // Old release, assume it's released. 1743 ] ); 1744 } 1745 } else { 1746 // Pull from SVN directly. 1747 $svn_tags = Tools\SVN::ls( "https://plugins.svn.wordpress.org/{$plugin->post_name}/tags/", true ) ?: []; 1748 foreach ( $svn_tags as $entry ) { 1749 // Discard files 1750 if ( 'dir' !== $entry['kind'] ) { 1751 continue; 1752 } 1753 1754 $tag = $entry['filename']; 1755 1756 // Prefix the 0 for plugin versions like 0.1 1757 if ( '.' == substr( $tag, 0, 1 ) ) { 1758 $tag = "0{$tag}"; 1759 } 1760 1761 self::add_release( $plugin, [ 1762 'date' => strtotime( $entry['date'] ), 1763 'tag' => $entry['filename'], 1764 'version' => $tag, 1765 'committer' => [ $entry['author'] ], 1766 'zips_built' => true, // Old release, assume they were built. 1767 'confirmations_required' => 0, // Old release, assume it's released. 1768 ] ); 1769 } 1770 } 1771 1772 $releases = get_post_meta( $plugin->ID, 'releases', true ) ?: []; 1731 $releases = self::prefill_releses_meta( $plugin ); 1773 1732 } 1774 1733 … … 1789 1748 1790 1749 /** 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1791 1803 * Fetch a specific release of the plugin, by tag. 1792 1804 * 1793 * @param string $plugin Plugin slug.1794 * @param string $ tagRelease tag.1805 * @param string $plugin Plugin slug. 1806 * @param string $ Release tag. 1795 1807 * @return array|bool 1796 1808 */ 1797 public static function get_release( $plugin, $ tag) {1809 public static function get_release( $plugin, $ ) { 1798 1810 $releases = self::get_releases( $plugin ); 1799 1811 1812 1800 1813 $filtered = wp_list_filter( $releases, compact( 'tag' ) ); 1801 1814 if ( $filtered ) { 1815 return array_shift( $filtered ); 1816 } 1817 1818 // Look for the tag as a trunk version. 1819 $filtered = wp_list_filter( $releases, [ 'tag' => "trunk@{$tag}", 'version' => $tag ] ); 1802 1820 if ( $filtered ) { 1803 1821 return array_shift( $filtered ); … … 1836 1854 // Fill the $release with the newish data. This could/should use wp_parse_args()? 1837 1855 foreach ( $data as $k => $v ) { 1838 $release[ $k ] = $v; 1856 if ( is_array( $release[ $k ] ) ) { 1857 $release[ $k ] = array_unique( array_merge( $release[ $k ], $v ) ); 1858 } else { 1859 $release[ $k ] = $v; 1860 } 1839 1861 } 1840 1862 -
sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/cli/class-import.php
r13875 r13876 454 454 [ 455 455 'tag' => $stable_tag, 456 457 458 459 460 461 462 463 464 465 466 456 467 'version' => $version, 457 468 'committer' => [ $last_committer ],
Note: See TracChangeset
for help on using the changeset viewer.