Plugin Directory

Changeset 2011075


Ignore:
Timestamp:
01/12/2019 08:57:21 AM (7 years ago)
Author:
ryotsun
Message:

release version 1.6

Location:
wp-slack-logbot/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • wp-slack-logbot/trunk/class-wp-slack-logbot.php

    r2000958 r2011075  
    88 * Text Domain:     wp-slack-logbot
    99 * Domain Path:     /languages
    10  * Version:         1.5
     10 * Version:         1.6
    1111 *
    1212 * @package         Wp_Slack_Logbot
     
    4444     * @var string $slack_logbot_version
    4545     */
    46     var $slack_logbot_version = '1.4';
     46    var $slack_logbot_version = '1.6';
    4747
    4848    /**
     
    6767        // uninstall hook.
    6868        register_uninstall_hook( __FILE__, 'WP_Slack_Logbot::uninstall' );
     69
     70        add_action( 'upgrader_process_complete', array( $this, 'upgrade' ), 9, 2 );
     71    }
     72
     73    /**
     74     * Upgrade Plugin.
     75     *
     76     * @param string $object  object.
     77     * @param array  $options Options.
     78     */
     79    public function upgrade( $object, $options ) {
     80        $current_plugin = plugin_basename( __FILE__ );
     81        if ( 'update' === $options['action'] && 'plugin' === $options['type'] ) {
     82            foreach ( $options['plugins'] as $plugin ) {
     83                if ( $plugin === $current_plugin ) {
     84                    $this->install();
     85                    break;
     86                }
     87            }
     88        }
    6989    }
    7090
     
    83103            // Delete duplicated event_id rows except for min id.
    84104            $wpdb->query( "DELETE FROM {$wpdb->prefix}slack_logbot WHERE {$wpdb->prefix}slack_logbot.id NOT IN (SELECT * FROM (SELECT MIN(id) FROM {$wpdb->prefix}slack_logbot GROUP BY event_id HAVING COUNT(event_id) > 1) sl1) AND {$wpdb->prefix}slack_logbot.event_id IN (SELECT * FROM (SELECT event_id FROM {$wpdb->prefix}slack_logbot GROUP BY event_id HAVING COUNT(event_id) > 1) sl2)" );
     105            // Drop index.
     106            $wpdb->query( "ALTER TABLE {$wpdb->prefix}slack_logbot DROP INDEX message" );
     107            // Add a new index.
     108            $wpdb->query( "ALTER TABLE {$wpdb->prefix}slack_logbot ADD UNIQUE message(event_id)" );
    85109        }
    86110
     
    111135
    112136        update_option( 'slack_logbot_version', $this->slack_logbot_version );
     137        remove_action( 'upgrader_process_complete', array( $this, 'install' ), 9 );
    113138    }
    114139
  • wp-slack-logbot/trunk/includes/class-slack-logbot.php

    r2000958 r2011075  
    165165        }
    166166
    167         $msg_id = $data['event_client_msg_id'];
    168 
    169         // System message will be null.
    170         if ( $msg_id ) {
    171             $post_content .= '<li id="' . $msg_id . '">';
     167        $event_id = $data['event_id'];
     168
     169        if ( $event_id ) {
     170            $post_content .= '<li id="' . $event_id . '">';
    172171        } else {
    173172            $post_content .= '<li>';
     
    253252        $count = preg_match_all( '/\&lt;(?P<url>http.*?)\&gt;/', $ret_str, $match );
    254253        for ( $i = 0; $i < $count; $i++ ) {
    255             $pattern = '{\&lt;' . $match['url'][ $i ] . '\&gt;}';
    256             $ret_str = preg_replace( $pattern, make_clickable( $match['url'][ $i ] ), $ret_str );
     254            $pattern = '&lt;' . $match['url'][ $i ] . '&gt;';
     255            $ret_str = str_replace( $pattern, make_clickable( $match['url'][ $i ] ), $ret_str );
    257256        }
    258257
     
    266265        }
    267266
     267        // Replace mention strings to @channel or @here.
     268        $ret_str = str_replace( '&lt;!channel&gt;', '@channel', $ret_str );
     269        $ret_str = str_replace( '&lt;!here&gt;', '@here', $ret_str );
     270
    268271        return $ret_str;
    269272    }
  • wp-slack-logbot/trunk/readme.txt

    r2000958 r2011075  
    66Tested up to: 5.1-alpha-20181015.143023
    77Requires PHP: 5.3
    8 Stable tag: 1.5.0
     8Stable tag: 1.6.0
    99License: GPLv2 or later
    1010License URI: LICENSE
     
    7878== Changelog ==
    7979
     80= 1.6 =
     81* Minor bug fixes
     82
    8083= 1.5 =
    8184* Minor bug fixes
Note: See TracChangeset for help on using the changeset viewer.