Changeset 13711
- Timestamp:
- 05/16/2024 03:06:24 AM (8 months ago)
- Location:
- sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/class-plugin-directory.php
r13674 r13711 1784 1784 /** 1785 1785 * Fetch a specific release of the plugin, by tag. 1786 * 1787 * @param string $plugin Plugin slug. 1788 * @param string $tag Release tag. 1789 * @return array|bool 1786 1790 */ 1787 1791 public static function get_release( $plugin, $tag ) { … … 1799 1803 /** 1800 1804 * Add a Plugin Release to the internal storage. 1805 * 1806 * @param string $plugin Plugin slug. 1807 * @param array $data Release data. 1808 * @return bool 1801 1809 */ 1802 1810 public static function add_release( $plugin, $data ) { … … 1844 1852 1845 1853 return update_post_meta( $plugin->ID, 'releases', $releases ); 1854 } 1855 1856 /** 1857 * Remove a Plugin Release from the internal storage. 1858 * 1859 * @param string $plugin Plugin slug. 1860 * @param string $tag Release tag. 1861 * @return bool 1862 */ 1863 public static function remove_release( $plugin, $tag ) { 1864 $result = false; 1865 $plugin = self::get_plugin_post( $plugin ); 1866 $releases = self::get_releases( $plugin ); 1867 1868 // Remove the release in question. 1869 foreach ( $releases as $i => $r ) { 1870 if ( $r['tag'] === $tag && ! $r['confirmed'] ) { 1871 unset( $releases[ $i ] ); 1872 1873 $result = update_post_meta( $plugin->ID, 'releases', $releases ); 1874 } 1875 } 1876 1877 return $result; 1846 1878 } 1847 1879 -
sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/cli/class-import.php
r13637 r13711 78 78 * @param string $plugin_slug The slug of the plugin to import. 79 79 * @param array $svn_changed_tags A list of tags/trunk which the SVN change touched. Optional. 80 * @param array $svn_tags_deleted A list of tags/trunk which were deleted in the SVN change. Optional. 80 81 * @param array $svn_revision_triggered The SVN revision which this import has been triggered by. Optional. 81 82 */ 82 public function import_from_svn( $plugin_slug, $svn_changed_tags = array( 'trunk' ), $svn_ revision_triggered = 0 ) {83 public function import_from_svn( $plugin_slug, $svn_changed_tags = array( 'trunk' ), $svn_tags_deleted = array(), $svn_revision_triggered = 0 ) { 83 84 // Reset properties. 84 85 $this->warnings = []; … … 192 193 193 194 echo "Plugin release {$svn_changed_tag} not confirmed; email triggered.\n"; 195 } 196 } 197 198 // Check to see if any of the releases were deleted. 199 foreach ( $svn_tags_deleted as $svn_deleted_tag ) { 200 // Note: Confirmed releases will not be deleted, only unconfirmed ones. 201 if ( Plugin_Directory::remove_release( $plugin, $svn_deleted_tag ) ) { 202 echo "Plugin tag {$svn_deleted_tag} deleted; release removed.\n"; 194 203 } 195 204 } -
sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/jobs/class-plugin-import.php
r13234 r13711 14 14 public static function queue( $plugin_slug, $plugin_data ) { 15 15 // To avoid a situation where two imports run concurrently, if one is already scheduled, run it 1hr later (We'll trigger it after the current one finishes). 16 $when_to_run = time() + 10;16 $when_to_run = time() + 5; 17 17 if ( $next_scheduled = Manager::get_scheduled_time( "import_plugin:{$plugin_slug}", 'last' ) ) { 18 18 $when_to_run = $next_scheduled + HOUR_IN_SECONDS; … … 36 36 // Set some default values if not included from the caller. 37 37 $plugin_data['tags_touched'] ??= array( 'trunk' ); 38 $plugin_data['tags_deleted'] ??= array(); 38 39 $plugin_data['revisions'] ??= [ 0 ]; 39 40 $plugin_data['readme_touched'] ??= true; … … 42 43 43 44 $tags_touched = $plugin_data['tags_touched']; 45 $tags_deleted = $plugin_data['tags_deleted']; 44 46 $revision = max( (array) $plugin_data['revisions'] ); 45 47 46 48 $importer = new CLI\Import(); 47 49 try { 48 $importer->import_from_svn( $plugin_slug, $tags_touched, $ revision );50 $importer->import_from_svn( $plugin_slug, $tags_touched, $tags_deleted, $revision ); 49 51 } catch ( Exception $e ) { 50 52 fwrite( STDERR, "[{$plugin_slug}] Plugin Import Failed: " . $e->getMessage() . "\n" );
Note: See TracChangeset
for help on using the changeset viewer.