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