Changeset 6579 for trunk/bp-core/bp-core-update.php
- Timestamp:
- 12/10/2012 06:50:12 AM (14 years ago)
- File:
-
- 1 edited
-
trunk/bp-core/bp-core-update.php (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/bp-core/bp-core-update.php
r6436 r6579 12 12 13 13 /** 14 * Compare the BuddyPress version to the DB version to determine if updating15 * 16 * @since BuddyPress (1. 6)14 * If there is no raw DB version, this is the first installation 15 * 16 * @since BuddyPress (1.7) 17 17 * 18 18 * @uses get_option() … … 20 20 * @return bool True if update, False if not 21 21 */ 22 function bp_is_install() { 23 return ! bp_get_db_version_raw(); 24 } 25 26 /** 27 * Compare the BuddyPress version to the DB version to determine if updating 28 * 29 * @since BuddyPress (1.6) 30 * 31 * @uses get_option() 32 * @uses bp_get_db_version() To get BuddyPress's database version 33 * @return bool True if update, False if not 34 */ 22 35 function bp_is_update() { 23 36 … … 42 55 */ 43 56 function bp_is_activation( $basename = '' ) { 44 $bp = buddypress(); 45 57 $bp = buddypress(); 46 58 $action = false; 47 if ( ! empty( $_REQUEST['action'] ) && ( '-1' != $_REQUEST['action'] ) ) 59 60 if ( ! empty( $_REQUEST['action'] ) && ( '-1' != $_REQUEST['action'] ) ) { 48 61 $action = $_REQUEST['action']; 49 elseif ( ! empty( $_REQUEST['action2'] ) && ( '-1' != $_REQUEST['action2'] ) )62 } elseif ( ! empty( $_REQUEST['action2'] ) && ( '-1' != $_REQUEST['action2'] ) ) { 50 63 $action = $_REQUEST['action2']; 64 } 51 65 52 66 // Bail if not activating 53 if ( empty( $action ) || !in_array( $action, array( 'activate', 'activate-selected' ) ) ) 54 return false; 67 if ( empty( $action ) || !in_array( $action, array( 'activate', 'activate-selected' ) ) ) { 68 return false; 69 } 55 70 56 71 // The plugin(s) being activated 57 if ( $action == 'activate' ) 72 if ( $action == 'activate' ) { 58 73 $plugins = isset( $_GET['plugin'] ) ? array( $_GET['plugin'] ) : array(); 59 else74 } else { 60 75 $plugins = isset( $_POST['checked'] ) ? (array) $_POST['checked'] : array(); 76 } 61 77 62 78 // Set basename if empty 63 if ( empty( $basename ) && !empty( $bp->basename ) ) 79 if ( empty( $basename ) && !empty( $bp->basename ) ) { 64 80 $basename = $bp->basename; 81 } 65 82 66 83 // Bail if no basename 67 if ( empty( $basename ) ) 68 return false; 84 if ( empty( $basename ) ) { 85 return false; 86 } 69 87 70 88 // Is BuddyPress being activated? … … 81 99 */ 82 100 function bp_is_deactivation( $basename = '' ) { 83 $bp = buddypress(); 84 101 $bp = buddypress(); 85 102 $action = false; 86 if ( ! empty( $_REQUEST['action'] ) && ( '-1' != $_REQUEST['action'] ) ) 103 104 if ( ! empty( $_REQUEST['action'] ) && ( '-1' != $_REQUEST['action'] ) ) { 87 105 $action = $_REQUEST['action']; 88 elseif ( ! empty( $_REQUEST['action2'] ) && ( '-1' != $_REQUEST['action2'] ) )106 } elseif ( ! empty( $_REQUEST['action2'] ) && ( '-1' != $_REQUEST['action2'] ) ) { 89 107 $action = $_REQUEST['action2']; 108 } 90 109 91 110 // Bail if not deactivating 92 if ( empty( $action ) || !in_array( $action, array( 'deactivate', 'deactivate-selected' ) ) ) 93 return false; 111 if ( empty( $action ) || !in_array( $action, array( 'deactivate', 'deactivate-selected' ) ) ) { 112 return false; 113 } 94 114 95 115 // The plugin(s) being deactivated 96 if ( $action == 'deactivate' )116 if ( 'deactivate' == $action ) { 97 117 $plugins = isset( $_GET['plugin'] ) ? array( $_GET['plugin'] ) : array(); 98 else118 } else { 99 119 $plugins = isset( $_POST['checked'] ) ? (array) $_POST['checked'] : array(); 120 } 100 121 101 122 // Set basename if empty 102 if ( empty( $basename ) && !empty( $bp->basename ) ) 123 if ( empty( $basename ) && !empty( $bp->basename ) ) { 103 124 $basename = $bp->basename; 125 } 104 126 105 127 // Bail if no basename 106 if ( empty( $basename ) ) 107 return false; 128 if ( empty( $basename ) ) { 129 return false; 130 } 108 131 109 132 // Is bbPress being deactivated? … … 135 158 136 159 // Are we running an outdated version of BuddyPress? 137 if ( bp_is_update() ) { 138 139 // Bump the version 140 bp_version_bump(); 141 142 // Run the deactivation function to wipe roles, caps, and rewrite rules 143 bp_deactivation(); 144 145 // Run the activation function to reset roles, caps, and rewrite rules 146 bp_activation(); 147 } 160 if ( ! bp_is_update() ) 161 return; 162 163 bp_version_updater(); 164 } 165 166 /** 167 * bbPress's version updater looks at what the current database version is, and 168 * runs whatever other code is needed. 169 * 170 * This is most-often used when the data schema changes, but should also be used 171 * to correct issues with bbPress meta-data silently on software update. 172 * 173 * @since bbPress (r4104) 174 */ 175 function bp_version_updater() { 176 177 // Get the raw database version 178 $raw_db_version = (int) bp_get_db_version_raw(); 179 180 /** 1.6 Branch ************************************************************/ 181 182 // 1.6 183 if ( $raw_db_version < 6067 ) { 184 // Do nothing 185 } 186 187 /** All done! *************************************************************/ 188 189 // Bump the version 190 bp_version_bump(); 191 } 192 193 /** 194 * Redirect user to BuddyPress's What's New page on activation 195 * 196 * @since BuddyPress (1.7) 197 * 198 * @internal Used internally to redirect BuddyPress to the about page on activation 199 * 200 * @uses set_transient() To drop the activation transient for 30 seconds 201 * 202 * @return If bulk activation 203 */ 204 function bp_add_activation_redirect() { 205 206 // Bail if activating from network, or bulk 207 if ( isset( $_GET['activate-multi'] ) ) 208 return; 209 210 // Add the transient to redirect 211 set_transient( '_bp_activation_redirect', true, 30 ); 148 212 } 149 213
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)