Changeset 4214 for sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/class-tools.php
- Timestamp:
- 10/11/2016 08:27:15 AM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/class-tools.php
r3830 r4214 122 122 123 123 /** 124 * Syncs the list of committers from the svn_access table to a taxonomy. 125 * 126 * @static 127 * @param string $plugin_slug The Plugin Slug to sync. 128 */ 129 public static function sync_plugin_committers_with_taxonomy( $plugin_slug ) { 130 $post = Plugin_Directory::get_plugin_post( $plugin_slug ); 131 if ( ! $post ) { 132 return false; 133 } 134 135 $committer_slugs = array(); 136 foreach ( Tools::get_plugin_committers( $plugin_slug ) as $committer ) { 137 $user = get_user_by( 'login', $committer ); 138 if ( $user ) { 139 $committer_slugs[] = $user->user_nicename; 140 } 141 } 142 143 wp_set_post_terms( $post->ID, $committer_slugs, 'plugin_committers' ); 144 } 145 146 /** 124 147 * Grant a user RW access to a plugin. 125 148 * … … 149 172 } 150 173 151 wp_cache_delete( "{$plugin_slug}_committer", 'wporg-plugins' ); 152 wp_cache_delete( "{$user->user_login}_committer", 'wporg-plugins' ); 153 154 return (bool) $wpdb->insert( PLUGINS_TABLE_PREFIX . 'svn_access', array( 174 $result = (bool) $wpdb->insert( PLUGINS_TABLE_PREFIX . 'svn_access', array( 155 175 'path' => "/{$plugin_slug}", 156 176 'user' => $user->user_login, 157 177 'access' => 'rw', 158 178 ) ); 179 180 wp_cache_delete( "{$plugin_slug}_committer", 'wporg-plugins' ); 181 wp_cache_delete( "{$user->user_login}_committer", 'wporg-plugins' ); 182 Tools::sync_plugin_committers_with_taxonomy( $plugin_slug ); 183 184 return $result; 159 185 } 160 186 … … 180 206 } 181 207 182 wp_cache_delete( "{$plugin_slug}_committer", 'wporg-plugins' ); 183 wp_cache_delete( "{$user->user_login}_committer", 'wporg-plugins' ); 184 185 return $wpdb->delete( PLUGINS_TABLE_PREFIX . 'svn_access', array( 208 $result = (bool) $wpdb->delete( PLUGINS_TABLE_PREFIX . 'svn_access', array( 186 209 'path' => "/{$plugin_slug}", 187 210 'user' => $user->user_login, 188 211 ) ); 212 213 wp_cache_delete( "{$plugin_slug}_committer", 'wporg-plugins' ); 214 wp_cache_delete( "{$user->user_login}_committer", 'wporg-plugins' ); 215 Tools::sync_plugin_committers_with_taxonomy( $plugin_slug ); 216 217 return $result; 189 218 } 190 219
Note: See TracChangeset
for help on using the changeset viewer.