25 June 2018

Google Play warning: Your app contains a SQL Injection issue

If you get Google Play warning on your Google Play Developer Console, than maybe there is simple solution. In your AndroidManifest.xml file just set :

<provider
        android:exported="false"
/>

and than recompile project, rebuild APK, and reupload new version to Google Play Developer Console.

18 June 2018

FreshRSS: Delete duplicate entries by title

If you have duplicate entries in your FreshRSS database, here is method for delete duplicate entries by title via phpMyAdmin:

Next SQL statement SELECT ALL duplicate entries by title:

SELECT * FROM `freshrss_slpadmin_entry` AS a
 INNER JOIN (
   SELECT title
     FROM `freshrss_slpadmin_entry`
     GROUP BY title
   HAVING COUNT( * ) > 1
 ) AS b ON b.title = a.title
ORDER BY a.title

Next SQL statement SELECT duplicate entries by title with higher id:

SELECT * FROM `freshrss_slpadmin_entry` AS a
 INNER JOIN (
   SELECT title, MIN(id) AS min_id
     FROM `freshrss_slpadmin_entry`
     GROUP BY title
   HAVING COUNT( * ) > 1
 ) AS b ON b.title = a.title
AND b.min_id <> a.id
ORDER BY a.title

Next SQL statement DELETE duplicate entries by title with DIFFERENT id:

DELETE a.* FROM `freshrss_slpadmin_entry` AS a
 INNER JOIN (
   SELECT title, MIN(id) AS min_id
     FROM `freshrss_slpadmin_entry`
     GROUP BY title
   HAVING COUNT( * ) > 1
 ) AS b ON b.title = a.title
AND b.min_id <> a.id 

14 June 2018

Wordpress SQL cleanup database for duplicate and old data

If you want to cleanup your Wordpress database for some duplicate and old data there is SQL commands to do it via phpMyAdmin :

This SQL command will DELETE data for month condition :

DELETE FROM `wp_posts` WHERE `post_type` = "attachment" AND post_modified LIKE '2018-04-%'
DELETE FROM `wp_posts` WHERE `post_type` = "post" AND post_modified LIKE '2018-04-%'

This SQL command will SELECT data with duplicate title :

SELECT a.ID, a.post_title, a.post_type, a.post_status
FROM wp_posts AS a
 INNER JOIN (
   SELECT post_title, MIN( id ) AS min_id
   FROM wp_posts
   WHERE post_type = 'post'
   AND post_status = 'publish'
   GROUP BY post_title
   HAVING COUNT( * ) > 1
 ) AS b ON b.post_title = a.post_title
AND b.min_id <> a.id
AND a.post_type = 'post'
AND a.post_status = 'publish'


This SQL command will DELETE data with duplicate title :


DELETE a.*
FROM wp_posts AS a
   INNER JOIN (
      SELECT post_title, MIN( id ) AS min_id
      FROM wp_posts
      WHERE post_type = 'post'
      AND post_status = 'publish'
      GROUP BY post_title
      HAVING COUNT( * ) > 1
   ) AS b ON b.post_title = a.post_title
AND b.min_id <> a.id
AND a.post_type = 'post'
AND a.post_status = 'publish'

This SQL command will DELETE Trash data:

DELETE wp_posts,wp_term_relationships,wp_postmeta,wp_term_taxonomy FROM wp_posts LEFT JOIN wp_term_relationships ON ( wp_posts.ID = wp_term_relationships.object_id ) LEFT JOIN wp_postmeta ON ( wp_posts.ID = wp_postmeta.post_id ) LEFT JOIN wp_term_taxonomy ON ( wp_term_taxonomy.term_taxonomy_id = wp_term_relationships.term_taxonomy_id ) WHERE wp_posts.post_status='trash'

This SQL command will DELETE orphaned postmeta data:

DELETE pm
FROM wp_postmeta pm
LEFT JOIN wp_posts wp ON wp.ID = pm.post_id
WHERE wp.ID IS NULL

This SQL command will DELETE orphaned relation data:

DELETE wp_term_relationships FROM wp_term_relationships
LEFT JOIN wp_posts ON wp_term_relationships.object_id = wp_posts.ID
WHERE wp_posts.ID is NULL;

After that do Optimize of all table throw phpmyadmin.

Off course, backup your data, before this commands.