/**
 * Checks plugin version against db and updates
 *
 * @uses buddydrive_is_install() to see if first install
 * @uses buddydrive_get_db_version() to get db version
 * @uses buddydrive_get_version() to get BuddyDrive plugin version
 */
function buddydrive_check_version()
{
    // Bail if config does not match what we need
    if (buddydrive::bail()) {
        return;
    }
    if (version_compare(buddydrive_get_db_version(), buddydrive_get_version(), '=')) {
        return;
    }
    if (buddydrive_is_install()) {
        // Do installation routine
    } else {
        if (buddydrive_is_update()) {
            // Do upgrade routine
        }
    }
    // Finally upgrade plugin version
    update_option('_buddydrive_version', buddydrive_get_version());
}
Beispiel #2
0
 /**
  * Setup the admin hooks, actions and filters
  *
  * @since version (1.0)
  * @access private
  *
  * @uses add_action() To add various actions
  * @uses bp_core_admin_hook() to hook the right menu (network or not)
  * @uses add_filter() To add various filters
  */
 private function setup_actions()
 {
     // Bail if config does not match what we need
     if (buddydrive::bail()) {
         return;
     }
     /** General Actions ***************************************************/
     add_action(bp_core_admin_hook(), array($this, 'admin_menus'));
     // Add menu item to settings menu
     add_action('buddydrive_admin_head', array($this, 'admin_head'));
     // Add some general styling to the admin area
     add_action($this->notice_hook, array($this, 'activation_notice'));
     // Checks for BuddyDrive Upload directory once activated
     add_action('buddydrive_admin_register_settings', array($this, 'register_admin_settings'));
     // Add settings
     add_action('admin_enqueue_scripts', array($this, 'enqueue_scripts'), 10, 1);
     // Add enqueued JS and CSS
     /** Filters ***********************************************************/
     // Modify BuddyDrive's admin links
     add_filter('plugin_action_links', array($this, 'modify_plugin_action_links'), 10, 2);
     add_filter('network_admin_plugin_action_links', array($this, 'modify_plugin_action_links'), 10, 2);
     // Filters the user space left output to strip html tags
     add_filter('buddydrive_get_user_space_left', 'buddydrive_filter_user_space_left', 10, 2);
     // Allow plugins to modify these actions
     do_action_ref_array('buddydrive_admin_loaded', array(&$this));
 }