Completed
Pull Request — develop (#1554)
by Naveen
48s
created
src/wordlift/post/class-post-entities-validator.php 2 patches
Indentation   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -15,20 +15,20 @@
 block discarded – undo
15 15
 
16 16
 class Post_Entities_Validator {
17 17
 
18
-	/**
19
-	 * @param $entity_uri_service \Wordlift_Entity_Uri_Service
20
-	 * @param $ids array<string> An array of entity ids
21
-	 *
22
-	 * @return bool
23
-	 */
24
-	public static function is_local_entity_uri_exist( $entity_uri_service, $ids ) {
25
-		foreach ( $ids as $id ) {
26
-			if ( $entity_uri_service->is_internal( $id ) ) {
27
-				return true;
28
-			}
29
-		}
18
+    /**
19
+     * @param $entity_uri_service \Wordlift_Entity_Uri_Service
20
+     * @param $ids array<string> An array of entity ids
21
+     *
22
+     * @return bool
23
+     */
24
+    public static function is_local_entity_uri_exist( $entity_uri_service, $ids ) {
25
+        foreach ( $ids as $id ) {
26
+            if ( $entity_uri_service->is_internal( $id ) ) {
27
+                return true;
28
+            }
29
+        }
30 30
 
31
-		return false;
32
-	}
31
+        return false;
32
+    }
33 33
 
34 34
 }
35 35
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -21,9 +21,9 @@
 block discarded – undo
21 21
 	 *
22 22
 	 * @return bool
23 23
 	 */
24
-	public static function is_local_entity_uri_exist( $entity_uri_service, $ids ) {
25
-		foreach ( $ids as $id ) {
26
-			if ( $entity_uri_service->is_internal( $id ) ) {
24
+	public static function is_local_entity_uri_exist($entity_uri_service, $ids) {
25
+		foreach ($ids as $id) {
26
+			if ($entity_uri_service->is_internal($id)) {
27 27
 				return true;
28 28
 			}
29 29
 		}
Please login to merge, or discard this patch.
src/wordlift/vocabulary/data/term-count/class-term-count-factory.php 2 patches
Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -7,14 +7,14 @@
 block discarded – undo
7 7
  */
8 8
 class Term_Count_Factory {
9 9
 
10
-	const CACHED_TERM_COUNT = 'cached_term_count';
10
+    const CACHED_TERM_COUNT = 'cached_term_count';
11 11
 
12
-	public static function get_instance( $type ) {
13
-		if  ($type === self::CACHED_TERM_COUNT) {
14
-			return new Cached_Term_Count( new Default_Term_Count() );
15
-		}
16
-		return null;
17
-	}
12
+    public static function get_instance( $type ) {
13
+        if  ($type === self::CACHED_TERM_COUNT) {
14
+            return new Cached_Term_Count( new Default_Term_Count() );
15
+        }
16
+        return null;
17
+    }
18 18
 
19 19
 
20 20
 
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -9,9 +9,9 @@
 block discarded – undo
9 9
 
10 10
 	const CACHED_TERM_COUNT = 'cached_term_count';
11 11
 
12
-	public static function get_instance( $type ) {
13
-		if  ($type === self::CACHED_TERM_COUNT) {
14
-			return new Cached_Term_Count( new Default_Term_Count() );
12
+	public static function get_instance($type) {
13
+		if ($type === self::CACHED_TERM_COUNT) {
14
+			return new Cached_Term_Count(new Default_Term_Count());
15 15
 		}
16 16
 		return null;
17 17
 	}
Please login to merge, or discard this patch.
src/wordlift/vocabulary/data/term-count/class-term-count.php 1 patch
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -9,11 +9,11 @@
 block discarded – undo
9 9
 
10 10
 interface Term_Count {
11 11
 
12
-	/**
13
-	 * Return the term count which needs to be processed by the editor.
14
-	 * @return int
15
-	 */
16
-	public function get_term_count();
12
+    /**
13
+     * Return the term count which needs to be processed by the editor.
14
+     * @return int
15
+     */
16
+    public function get_term_count();
17 17
 
18 18
 }
19 19
 
Please login to merge, or discard this patch.
src/wordlift/vocabulary/data/term-count/class-cached-term-count.php 2 patches
Indentation   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -9,32 +9,32 @@
 block discarded – undo
9 9
  */
10 10
 class Cached_Term_Count implements Term_Count {
11 11
 
12
-	const TRANSIENT_KEY = '_wl_vocabulary_term_count_transient';
13
-	/**
14
-	 * @var Term_Count
15
-	 */
16
-	private $term_count;
17
-
18
-
19
-	/**
20
-	 * Cached_Term_Count constructor.
21
-	 *
22
-	 * @param $term_count Term_Count
23
-	 */
24
-	public function __construct( $term_count ) {
25
-		$this->term_count = $term_count;
26
-	}
27
-
28
-	public function get_term_count() {
29
-		$data = get_transient( self::TRANSIENT_KEY );
30
-
31
-		if ( ! $data ) {
32
-			$data = $this->term_count->get_term_count();
33
-			set_transient( self::TRANSIENT_KEY, $data, 8 * 60 * 60 );
34
-
35
-			return $data;
36
-		}
37
-
38
-		return $data;
39
-	}
12
+    const TRANSIENT_KEY = '_wl_vocabulary_term_count_transient';
13
+    /**
14
+     * @var Term_Count
15
+     */
16
+    private $term_count;
17
+
18
+
19
+    /**
20
+     * Cached_Term_Count constructor.
21
+     *
22
+     * @param $term_count Term_Count
23
+     */
24
+    public function __construct( $term_count ) {
25
+        $this->term_count = $term_count;
26
+    }
27
+
28
+    public function get_term_count() {
29
+        $data = get_transient( self::TRANSIENT_KEY );
30
+
31
+        if ( ! $data ) {
32
+            $data = $this->term_count->get_term_count();
33
+            set_transient( self::TRANSIENT_KEY, $data, 8 * 60 * 60 );
34
+
35
+            return $data;
36
+        }
37
+
38
+        return $data;
39
+    }
40 40
 }
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -21,16 +21,16 @@
 block discarded – undo
21 21
 	 *
22 22
 	 * @param $term_count Term_Count
23 23
 	 */
24
-	public function __construct( $term_count ) {
24
+	public function __construct($term_count) {
25 25
 		$this->term_count = $term_count;
26 26
 	}
27 27
 
28 28
 	public function get_term_count() {
29
-		$data = get_transient( self::TRANSIENT_KEY );
29
+		$data = get_transient(self::TRANSIENT_KEY);
30 30
 
31
-		if ( ! $data ) {
31
+		if ( ! $data) {
32 32
 			$data = $this->term_count->get_term_count();
33
-			set_transient( self::TRANSIENT_KEY, $data, 8 * 60 * 60 );
33
+			set_transient(self::TRANSIENT_KEY, $data, 8 * 60 * 60);
34 34
 
35 35
 			return $data;
36 36
 		}
Please login to merge, or discard this patch.
src/wordlift/vocabulary/data/term-data/class-term-data-factory.php 2 patches
Indentation   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -4,27 +4,27 @@
 block discarded – undo
4 4
 use Wordlift\Vocabulary\Analysis_Service;
5 5
 
6 6
 class Term_Data_Factory {
7
-	/**
8
-	 * @var Analysis_Service
9
-	 */
10
-	private $analysis_service;
7
+    /**
8
+     * @var Analysis_Service
9
+     */
10
+    private $analysis_service;
11 11
 
12
-	/**
13
-	 * @var Analysis_Service
14
-	 */
15
-	public function __construct( $analysis_service ) {
16
-		$this->analysis_service = $analysis_service;
17
-	}
12
+    /**
13
+     * @var Analysis_Service
14
+     */
15
+    public function __construct( $analysis_service ) {
16
+        $this->analysis_service = $analysis_service;
17
+    }
18 18
 
19
-	/**
20
-	 * @param $term \WP_Term
21
-	 *
22
-	 * @return Term_Data
23
-	 */
24
-	public function get_term_data( $term ) {
25
-		$entities = $this->analysis_service->get_entities( $term );
26
-		return new Default_Term_Data( $term, $entities );
27
-	}
19
+    /**
20
+     * @param $term \WP_Term
21
+     *
22
+     * @return Term_Data
23
+     */
24
+    public function get_term_data( $term ) {
25
+        $entities = $this->analysis_service->get_entities( $term );
26
+        return new Default_Term_Data( $term, $entities );
27
+    }
28 28
 
29 29
 
30 30
 }
31 31
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
 	/**
13 13
 	 * @var Analysis_Service
14 14
 	 */
15
-	public function __construct( $analysis_service ) {
15
+	public function __construct($analysis_service) {
16 16
 		$this->analysis_service = $analysis_service;
17 17
 	}
18 18
 
@@ -21,9 +21,9 @@  discard block
 block discarded – undo
21 21
 	 *
22 22
 	 * @return Term_Data
23 23
 	 */
24
-	public function get_term_data( $term ) {
25
-		$entities = $this->analysis_service->get_entities( $term );
26
-		return new Default_Term_Data( $term, $entities );
24
+	public function get_term_data($term) {
25
+		$entities = $this->analysis_service->get_entities($term);
26
+		return new Default_Term_Data($term, $entities);
27 27
 	}
28 28
 
29 29
 
Please login to merge, or discard this patch.
src/wordlift/vocabulary/data/term-data/class-term-data.php 1 patch
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -8,10 +8,10 @@
 block discarded – undo
8 8
 
9 9
 interface Term_Data {
10 10
 
11
-	/**
12
-	 * Should return an array which can be used by ui components.
13
-	 * @return array
14
-	 */
15
-	public function get_data();
11
+    /**
12
+     * Should return an array which can be used by ui components.
13
+     * @return array
14
+     */
15
+    public function get_data();
16 16
 
17 17
 }
18 18
\ No newline at end of file
Please login to merge, or discard this patch.
src/wordlift/vocabulary/api/class-api-config.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -15,10 +15,10 @@
 block discarded – undo
15 15
 		$settings            = array();
16 16
 		$settings['restUrl'] = get_rest_url(
17 17
 			null,
18
-			Api_Config::REST_NAMESPACE . '/tags'
18
+			Api_Config::REST_NAMESPACE.'/tags'
19 19
 		);
20
-		$settings['baseUrl'] = get_rest_url( null, Api_Config::REST_NAMESPACE );
21
-		$settings['nonce']   = wp_create_nonce( 'wp_rest' );
20
+		$settings['baseUrl'] = get_rest_url(null, Api_Config::REST_NAMESPACE);
21
+		$settings['nonce']   = wp_create_nonce('wp_rest');
22 22
 
23 23
 		return $settings;
24 24
 	}
Please login to merge, or discard this patch.
Indentation   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -8,19 +8,19 @@
 block discarded – undo
8 8
  */
9 9
 class Api_Config {
10 10
 
11
-	const REST_NAMESPACE = 'cafemediakg/v1';
11
+    const REST_NAMESPACE = 'cafemediakg/v1';
12 12
 
13
-	public static function get_api_config() {
14
-		// Create ui settings array to be used by js client.
15
-		$settings            = array();
16
-		$settings['restUrl'] = get_rest_url(
17
-			null,
18
-			Api_Config::REST_NAMESPACE . '/tags'
19
-		);
20
-		$settings['baseUrl'] = get_rest_url( null, Api_Config::REST_NAMESPACE );
21
-		$settings['nonce']   = wp_create_nonce( 'wp_rest' );
13
+    public static function get_api_config() {
14
+        // Create ui settings array to be used by js client.
15
+        $settings            = array();
16
+        $settings['restUrl'] = get_rest_url(
17
+            null,
18
+            Api_Config::REST_NAMESPACE . '/tags'
19
+        );
20
+        $settings['baseUrl'] = get_rest_url( null, Api_Config::REST_NAMESPACE );
21
+        $settings['nonce']   = wp_create_nonce( 'wp_rest' );
22 22
 
23
-		return $settings;
24
-	}
23
+        return $settings;
24
+    }
25 25
 
26 26
 }
Please login to merge, or discard this patch.
src/wordlift/vocabulary/api/class-background-analysis-endpoint.php 2 patches
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
 	 */
24 24
 	private $cache_service;
25 25
 
26
-	public function __construct( $background_service, $cache_service ) {
26
+	public function __construct($background_service, $cache_service) {
27 27
 		$this->background_service = $background_service;
28 28
 		$this->cache_service = $cache_service;
29 29
 		$this->register_routes();
@@ -31,8 +31,8 @@  discard block
 block discarded – undo
31 31
 
32 32
 	public function register_routes() {
33 33
 		$that = $this;
34
-		add_action( 'rest_api_init',
35
-			function () use ( $that ) {
34
+		add_action('rest_api_init',
35
+			function() use ($that) {
36 36
 				$that->register_start_route();
37 37
 				$that->register_stop_route();
38 38
 				$that->register_stats_route();
@@ -46,9 +46,9 @@  discard block
 block discarded – undo
46 46
 			'/background_analysis/start',
47 47
 			array(
48 48
 				'methods'             => WP_REST_Server::CREATABLE,
49
-				'callback'            => array( $this, 'start' ),
50
-				'permission_callback' => function () {
51
-					return current_user_can( 'manage_options' );
49
+				'callback'            => array($this, 'start'),
50
+				'permission_callback' => function() {
51
+					return current_user_can('manage_options');
52 52
 				},
53 53
 			)
54 54
 		);
@@ -60,9 +60,9 @@  discard block
 block discarded – undo
60 60
 			'/background_analysis/stop',
61 61
 			array(
62 62
 				'methods'             => WP_REST_Server::CREATABLE,
63
-				'callback'            => array( $this, 'stop' ),
64
-				'permission_callback' => function () {
65
-					return current_user_can( 'manage_options' );
63
+				'callback'            => array($this, 'stop'),
64
+				'permission_callback' => function() {
65
+					return current_user_can('manage_options');
66 66
 				},
67 67
 			)
68 68
 		);
@@ -74,9 +74,9 @@  discard block
 block discarded – undo
74 74
 			'/background_analysis/stats',
75 75
 			array(
76 76
 				'methods'             => WP_REST_Server::CREATABLE,
77
-				'callback'            => array( $this, 'get_stats' ),
78
-				'permission_callback' => function () {
79
-					return current_user_can( 'manage_options' );
77
+				'callback'            => array($this, 'get_stats'),
78
+				'permission_callback' => function() {
79
+					return current_user_can('manage_options');
80 80
 				},
81 81
 			)
82 82
 		);
@@ -89,9 +89,9 @@  discard block
 block discarded – undo
89 89
 			'/background_analysis/restart',
90 90
 			array(
91 91
 				'methods'             => WP_REST_Server::CREATABLE,
92
-				'callback'            => array( $this, 'restart' ),
93
-				'permission_callback' => function () {
94
-					return current_user_can( 'manage_options' );
92
+				'callback'            => array($this, 'restart'),
93
+				'permission_callback' => function() {
94
+					return current_user_can('manage_options');
95 95
 				},
96 96
 			)
97 97
 		);
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
 		/**
103 103
 		 * @var $state Sync_State
104 104
 		 */
105
-		$state = get_option( Analysis_Background_Process::WL_CMKG_ANALYSIS_BACKGROUND_PROCESS, Sync_State::unknown() );
105
+		$state = get_option(Analysis_Background_Process::WL_CMKG_ANALYSIS_BACKGROUND_PROCESS, Sync_State::unknown());
106 106
 
107 107
 		return $state->get_array();
108 108
 	}
@@ -122,16 +122,16 @@  discard block
 block discarded – undo
122 122
 DELETE FROM $wpdb->termmeta WHERE meta_key=%s OR meta_key=%s
123 123
 EOF;
124 124
 		// Remove the flags, if the tag is already accepted we wont remove that ui flag.
125
-		$query = $wpdb->prepare( $query, array(
125
+		$query = $wpdb->prepare($query, array(
126 126
 			Analysis_Background_Service::ANALYSIS_DONE_FLAG,
127 127
 			Analysis_Background_Service::ENTITIES_PRESENT_FOR_TERM
128
-		) );
129
-		$wpdb->query( $query );
128
+		));
129
+		$wpdb->query($query);
130 130
 		// clear the cache
131 131
 		$this->cache_service->flush_all();
132 132
 		$this->background_service->start();
133 133
 
134
-		return array( 'status' => 'restart_complete' );
134
+		return array('status' => 'restart_complete');
135 135
 	}
136 136
 
137 137
 
Please login to merge, or discard this patch.
Indentation   +120 added lines, -120 removed lines patch added patch discarded remove patch
@@ -14,132 +14,132 @@
 block discarded – undo
14 14
 
15 15
 class Background_Analysis_Endpoint {
16 16
 
17
-	/**
18
-	 * @var Analysis_Background_Service
19
-	 */
20
-	private $background_service;
21
-	/**
22
-	 * @var Cache
23
-	 */
24
-	private $cache_service;
25
-
26
-	public function __construct( $background_service, $cache_service ) {
27
-		$this->background_service = $background_service;
28
-		$this->cache_service = $cache_service;
29
-		$this->register_routes();
30
-	}
31
-
32
-	public function register_routes() {
33
-		$that = $this;
34
-		add_action( 'rest_api_init',
35
-			function () use ( $that ) {
36
-				$that->register_start_route();
37
-				$that->register_stop_route();
38
-				$that->register_stats_route();
39
-				$that->register_restart_route();
40
-			} );
41
-	}
42
-
43
-	private function register_start_route() {
44
-		register_rest_route(
45
-			Api_Config::REST_NAMESPACE,
46
-			'/background_analysis/start',
47
-			array(
48
-				'methods'             => WP_REST_Server::CREATABLE,
49
-				'callback'            => array( $this, 'start' ),
50
-				'permission_callback' => function () {
51
-					return current_user_can( 'manage_options' );
52
-				},
53
-			)
54
-		);
55
-	}
56
-
57
-	private function register_stop_route() {
58
-		register_rest_route(
59
-			Api_Config::REST_NAMESPACE,
60
-			'/background_analysis/stop',
61
-			array(
62
-				'methods'             => WP_REST_Server::CREATABLE,
63
-				'callback'            => array( $this, 'stop' ),
64
-				'permission_callback' => function () {
65
-					return current_user_can( 'manage_options' );
66
-				},
67
-			)
68
-		);
69
-	}
70
-
71
-	private function register_stats_route() {
72
-		register_rest_route(
73
-			Api_Config::REST_NAMESPACE,
74
-			'/background_analysis/stats',
75
-			array(
76
-				'methods'             => WP_REST_Server::CREATABLE,
77
-				'callback'            => array( $this, 'get_stats' ),
78
-				'permission_callback' => function () {
79
-					return current_user_can( 'manage_options' );
80
-				},
81
-			)
82
-		);
83
-	}
84
-
85
-
86
-	private function register_restart_route() {
87
-		register_rest_route(
88
-			Api_Config::REST_NAMESPACE,
89
-			'/background_analysis/restart',
90
-			array(
91
-				'methods'             => WP_REST_Server::CREATABLE,
92
-				'callback'            => array( $this, 'restart' ),
93
-				'permission_callback' => function () {
94
-					return current_user_can( 'manage_options' );
95
-				},
96
-			)
97
-		);
98
-	}
99
-
100
-
101
-	public function get_stats() {
102
-		/**
103
-		 * @var $state Sync_State
104
-		 */
105
-		$state = get_option( Analysis_Background_Process::WL_CMKG_ANALYSIS_BACKGROUND_PROCESS, Sync_State::unknown() );
106
-
107
-		return $state->get_array();
108
-	}
109
-
110
-	public function start() {
111
-		$this->background_service->start();
112
-
113
-		return true;
114
-	}
115
-
116
-
117
-	public function restart() {
118
-		$this->background_service->cancel();
119
-		// clear the flags and restart again.
120
-		global $wpdb;
121
-		$query = <<<EOF
17
+    /**
18
+     * @var Analysis_Background_Service
19
+     */
20
+    private $background_service;
21
+    /**
22
+     * @var Cache
23
+     */
24
+    private $cache_service;
25
+
26
+    public function __construct( $background_service, $cache_service ) {
27
+        $this->background_service = $background_service;
28
+        $this->cache_service = $cache_service;
29
+        $this->register_routes();
30
+    }
31
+
32
+    public function register_routes() {
33
+        $that = $this;
34
+        add_action( 'rest_api_init',
35
+            function () use ( $that ) {
36
+                $that->register_start_route();
37
+                $that->register_stop_route();
38
+                $that->register_stats_route();
39
+                $that->register_restart_route();
40
+            } );
41
+    }
42
+
43
+    private function register_start_route() {
44
+        register_rest_route(
45
+            Api_Config::REST_NAMESPACE,
46
+            '/background_analysis/start',
47
+            array(
48
+                'methods'             => WP_REST_Server::CREATABLE,
49
+                'callback'            => array( $this, 'start' ),
50
+                'permission_callback' => function () {
51
+                    return current_user_can( 'manage_options' );
52
+                },
53
+            )
54
+        );
55
+    }
56
+
57
+    private function register_stop_route() {
58
+        register_rest_route(
59
+            Api_Config::REST_NAMESPACE,
60
+            '/background_analysis/stop',
61
+            array(
62
+                'methods'             => WP_REST_Server::CREATABLE,
63
+                'callback'            => array( $this, 'stop' ),
64
+                'permission_callback' => function () {
65
+                    return current_user_can( 'manage_options' );
66
+                },
67
+            )
68
+        );
69
+    }
70
+
71
+    private function register_stats_route() {
72
+        register_rest_route(
73
+            Api_Config::REST_NAMESPACE,
74
+            '/background_analysis/stats',
75
+            array(
76
+                'methods'             => WP_REST_Server::CREATABLE,
77
+                'callback'            => array( $this, 'get_stats' ),
78
+                'permission_callback' => function () {
79
+                    return current_user_can( 'manage_options' );
80
+                },
81
+            )
82
+        );
83
+    }
84
+
85
+
86
+    private function register_restart_route() {
87
+        register_rest_route(
88
+            Api_Config::REST_NAMESPACE,
89
+            '/background_analysis/restart',
90
+            array(
91
+                'methods'             => WP_REST_Server::CREATABLE,
92
+                'callback'            => array( $this, 'restart' ),
93
+                'permission_callback' => function () {
94
+                    return current_user_can( 'manage_options' );
95
+                },
96
+            )
97
+        );
98
+    }
99
+
100
+
101
+    public function get_stats() {
102
+        /**
103
+         * @var $state Sync_State
104
+         */
105
+        $state = get_option( Analysis_Background_Process::WL_CMKG_ANALYSIS_BACKGROUND_PROCESS, Sync_State::unknown() );
106
+
107
+        return $state->get_array();
108
+    }
109
+
110
+    public function start() {
111
+        $this->background_service->start();
112
+
113
+        return true;
114
+    }
115
+
116
+
117
+    public function restart() {
118
+        $this->background_service->cancel();
119
+        // clear the flags and restart again.
120
+        global $wpdb;
121
+        $query = <<<EOF
122 122
 DELETE FROM $wpdb->termmeta WHERE meta_key=%s OR meta_key=%s
123 123
 EOF;
124
-		// Remove the flags, if the tag is already accepted we wont remove that ui flag.
125
-		$query = $wpdb->prepare( $query, array(
126
-			Analysis_Background_Service::ANALYSIS_DONE_FLAG,
127
-			Analysis_Background_Service::ENTITIES_PRESENT_FOR_TERM
128
-		) );
129
-		$wpdb->query( $query );
130
-		// clear the cache
131
-		$this->cache_service->flush_all();
132
-		$this->background_service->start();
124
+        // Remove the flags, if the tag is already accepted we wont remove that ui flag.
125
+        $query = $wpdb->prepare( $query, array(
126
+            Analysis_Background_Service::ANALYSIS_DONE_FLAG,
127
+            Analysis_Background_Service::ENTITIES_PRESENT_FOR_TERM
128
+        ) );
129
+        $wpdb->query( $query );
130
+        // clear the cache
131
+        $this->cache_service->flush_all();
132
+        $this->background_service->start();
133 133
 
134
-		return array( 'status' => 'restart_complete' );
135
-	}
134
+        return array( 'status' => 'restart_complete' );
135
+    }
136 136
 
137 137
 
138
-	public function stop() {
139
-		$this->background_service->stop();
138
+    public function stop() {
139
+        $this->background_service->stop();
140 140
 
141
-		return true;
142
-	}
141
+        return true;
142
+    }
143 143
 
144 144
 
145 145
 }
146 146
\ No newline at end of file
Please login to merge, or discard this patch.
src/wordlift/vocabulary/class-sync-state.php 2 patches
Indentation   +51 added lines, -51 removed lines patch added patch discarded remove patch
@@ -4,56 +4,56 @@
 block discarded – undo
4 4
 
5 5
 class Sync_State {
6 6
 
7
-	public $started;
8
-	public $index;
9
-	public $count;
10
-	public $last_update;
11
-	public $state;
12
-
13
-	/**
14
-	 * Sync_Model constructor.
15
-	 *
16
-	 * @param $started
17
-	 * @param $index
18
-	 * @param $count
19
-	 * @param $last_update
20
-	 * @param $state
21
-	 */
22
-	public function __construct( $started, $index, $count, $last_update, $state ) {
23
-		$this->started     = $started;
24
-		$this->index       = $index;
25
-		$this->count       = (int) $count;
26
-		$this->last_update = $last_update;
27
-		$this->state       = $state;
28
-	}
29
-
30
-	public function increment_index( $count ) {
31
-		$this->index       += $count;
32
-		$this->last_update = time();
33
-
34
-		return $this;
35
-	}
36
-
37
-	public function set_state( $value ) {
38
-		$this->state       = $value;
39
-		$this->last_update = time();
40
-
41
-		return $this;
42
-	}
43
-
44
-	public function get_array() {
45
-		return array(
46
-			'started'     => $this->started,
47
-			'index'       => $this->index,
48
-			'count'       => $this->count,
49
-			'last_update' => $this->last_update,
50
-			'state'       => $this->state
51
-		);
52
-	}
53
-
54
-	public static function unknown() {
55
-
56
-		return new self( time(), 0, 0, time(), 'unknown' );
57
-	}
7
+    public $started;
8
+    public $index;
9
+    public $count;
10
+    public $last_update;
11
+    public $state;
12
+
13
+    /**
14
+     * Sync_Model constructor.
15
+     *
16
+     * @param $started
17
+     * @param $index
18
+     * @param $count
19
+     * @param $last_update
20
+     * @param $state
21
+     */
22
+    public function __construct( $started, $index, $count, $last_update, $state ) {
23
+        $this->started     = $started;
24
+        $this->index       = $index;
25
+        $this->count       = (int) $count;
26
+        $this->last_update = $last_update;
27
+        $this->state       = $state;
28
+    }
29
+
30
+    public function increment_index( $count ) {
31
+        $this->index       += $count;
32
+        $this->last_update = time();
33
+
34
+        return $this;
35
+    }
36
+
37
+    public function set_state( $value ) {
38
+        $this->state       = $value;
39
+        $this->last_update = time();
40
+
41
+        return $this;
42
+    }
43
+
44
+    public function get_array() {
45
+        return array(
46
+            'started'     => $this->started,
47
+            'index'       => $this->index,
48
+            'count'       => $this->count,
49
+            'last_update' => $this->last_update,
50
+            'state'       => $this->state
51
+        );
52
+    }
53
+
54
+    public static function unknown() {
55
+
56
+        return new self( time(), 0, 0, time(), 'unknown' );
57
+    }
58 58
 
59 59
 }
60 60
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
19 19
 	 * @param $last_update
20 20
 	 * @param $state
21 21
 	 */
22
-	public function __construct( $started, $index, $count, $last_update, $state ) {
22
+	public function __construct($started, $index, $count, $last_update, $state) {
23 23
 		$this->started     = $started;
24 24
 		$this->index       = $index;
25 25
 		$this->count       = (int) $count;
@@ -27,14 +27,14 @@  discard block
 block discarded – undo
27 27
 		$this->state       = $state;
28 28
 	}
29 29
 
30
-	public function increment_index( $count ) {
31
-		$this->index       += $count;
30
+	public function increment_index($count) {
31
+		$this->index += $count;
32 32
 		$this->last_update = time();
33 33
 
34 34
 		return $this;
35 35
 	}
36 36
 
37
-	public function set_state( $value ) {
37
+	public function set_state($value) {
38 38
 		$this->state       = $value;
39 39
 		$this->last_update = time();
40 40
 
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
 
44 44
 	public static function unknown() {
45 45
 
46
-		return new self( time(), 0, 0, time(), 'unknown' );
46
+		return new self(time(), 0, 0, time(), 'unknown');
47 47
 	}
48 48
 
49 49
 }
50 50
\ No newline at end of file
Please login to merge, or discard this patch.