| 793 | |
| 794 | /** |
| 795 | * Stores array of symlinked plugins upon update of 'active_plugins' into 'symlinked_plugins' option. |
| 796 | * |
| 797 | * The array stored for 'symlinked_plugins' will be in the following form assuming that $plugin_virtual_path contains |
| 798 | * an array of full virtual plugin paths where each is in the form WP_PLUGIN_DIR . "/{plugin_slug}": |
| 799 | * |
| 800 | * array( |
| 801 | * realpath( $plugin_virtual_path[1] ) => $plugin_virtual_path[1], |
| 802 | * realpath( $plugin_virtual_path[2] ) => $plugin_virtual_path[2], |
| 803 | * realpath( $plugin_virtual_path[3] ) => $plugin_virtual_path[3], |
| 804 | * ); |
| 805 | * |
| 806 | * @package WordPress |
| 807 | * @subpackage Plugin |
| 808 | * @access private |
| 809 | * @since 3.6 |
| 810 | * @link http://core.trac.wordpress.org/ticket/16953 |
| 811 | * |
| 812 | * @param mixed $plugin_slugs The newly changed array of 'active_plugins' being saved. |
| 813 | * @return mixed Array of full plugin filepaths where key is realpath( $virtual_path ) and value is $virtual_path. |
| 814 | */ |
| 815 | function _wp_pre_update_option_active_plugins( $plugin_slugs ) { |
| 816 | $symlinked_plugins = array(); |
| 817 | foreach( $plugin_slugs as $plugin_slug ) { |
| 818 | $real_path = realpath( $virtual_path = WP_PLUGIN_DIR . "/{$plugin_slug}" ); |
| 819 | if ( $real_path != $virtual_path ) |
| 820 | $symlinked_plugins[$real_path] = $virtual_path; |
| 821 | } |
| 822 | if ( count( $symlinked_plugins ) ) |
| 823 | update_option( 'symlinked_plugins', $symlinked_plugins ); |
| 824 | else |
| 825 | delete_option( 'symlinked_plugins' ); |
| 826 | return $plugin_slugs; |
| 827 | } |
| 828 | add_filter( 'pre_update_option_active_plugins', '_wp_pre_update_option_active_plugins' ); |