• Resolved samoreen

    (@samoreen)


    Hi,

    I don’t know how this happened but I find myself with 4 images in the “unorganized” folder and the count icon beside the folder name says 6.

    I actually found in the database 6 lines for folder -1. 2 of them had IDs referring to non existing images. I removed these 2 lines but the count icon still says 6.

    How can I force RML to re-scan this folder and show teh correct count ?

    Thanks.

    Patrick

Viewing 15 replies - 1 through 15 (of 18 total)
  • Plugin Contributor Matthias Günter

    (@mguenter)

    Hey @samoreen !

    You can reset the count cache in Settings > Media > Tab “Reset” > “clear count cache”.

    How have you deleted this files?

    Regards,
    Matthew 🙂

    Thread Starter samoreen

    (@samoreen)

    Thanks, but the counter still says 6 even after a refresh.

    > How have you deleted this files?

    Actually, it’s one of the site authors who did this and she can’t explain. :-((

    Patrick.

    Thread Starter samoreen

    (@samoreen)

    I looked again at the database and it doesn’t seem that the “Unorganized” folder is affected by the counter reset operations. It’s not an actual virtual folder and there’s no trace of it in xxxxxx_realmedialibrary. It seems to be handled differently.

    I have moved the 4 files residing here to another subfolder and now the counter says 2 while there’s no file in the folder. So, RML is counting something that doesn’t exist OR it works by substracting the count of moved or deleted files that were stored in Unorganized from a value that is stored somewhere and that is supposed to be correct.

    If you could tell me where this value is stored or where the counter cache is stored, I could probably fix this myself.

    Patrick

    Thread Starter samoreen

    (@samoreen)

    The “All files” counter is also showing 2 files in excess. It says 439 while the sum of all counters of all subfolders in RML (excluding the 2 ghost files in Uncategorized) is 437. And the the xxxx_realmedialibrary_posts table has only 437 entries, not 439. Also, the sum of all cnt values in the xxx_realmedialibrary table is 437.

    It’s a wonder that RML can show a count of 439 and 2 for “all files” and Unorganized respectively 🙂 .

    Patrick

    • This reply was modified 2 years, 11 months ago by samoreen.
    • This reply was modified 2 years, 11 months ago by samoreen.
    Thread Starter samoreen

    (@samoreen)

    I should have mentioned that I’m using WP/LR.

    Patrick

    Plugin Contributor Matthias Günter

    (@mguenter)

    Hey @samoreen !

    Thanks for your follow-up.

    Can you please try the following:

    SELECT * FROM wp_realmedialibrary_posts rmlp LEFT JOIN wp_posts p ON p.ID = rmlp.attachment

    This shows entries which are no longer available in wp_posts.

    You can delete this ones with:

    DELETE rmlp FROM wp_realmedialibrary_posts rmlp LEFT JOIN wp_posts p ON p.ID = rmlp.attachment WHERE p.ID IS NULL

    Regards,
    Matthew 🙂

    Thread Starter samoreen

    (@samoreen)

    Hallo Matthias,

    It seems that I can’t execute this request. I get an error message from my hosting service saying :

    Erreur dans le traitement de la requête
    Code d’erreur : 500
    Texte de l’erreur : TypeError (rejected)
    Il semble que la connexion au serveur ait été perdue => connection lost

    Merci de vérifier la connectivité réseau et l’état du serveur => please check network connectivity.

    However, another request like “SELECT * FROM wp_realmedialibrary_posts” works. It seems that I can’t access the wp_posts table.

    Patrick

    • This reply was modified 2 years, 11 months ago by samoreen.
    • This reply was modified 2 years, 11 months ago by samoreen.
    Thread Starter samoreen

    (@samoreen)

    > It seems that I can’t access the wp_posts table.

    Wrong. I can execute “SELECT * FROM Em0k5Bx_posts”. Problem with JOIN ?

    Patrick

    Thread Starter samoreen

    (@samoreen)

    Or a problem with the PHP settings which I can’t control very well since I’m using a shared hosting.

    Patrick

    Thread Starter samoreen

    (@samoreen)

    I have asked my hosting service about the SQL problem. Waiting for an answer.

    Meanwhile, I have checked the counter of all folders. They are OK. That is, for all folders and subfolders in RML, except “Unorganized”, the counter is OK. This is consistent with the wp_realmedialibrary_posts table itself : the number of lines in this table corresponds exactly to the sum of all counters if I exclude “Unorganized”. So, nothing is missing there and there is no reference in that table to something that no longer exists. Each line corresponds to an actual image. I checked each folder one by one.

    So, If I understand you well, there are 2 entries in wp_posts that RML is taking into account and that are referring to 2 non existing images ?

    Patrick

    Thread Starter samoreen

    (@samoreen)

    SELECT ID FROM wp_posts WHERE post_type = ‘attachment’

    returns 437 lines not 439. So, the problem appears to be elsewhere.

    Patrick

    Thread Starter samoreen

    (@samoreen)

    Matthias,

    OK. Problem spotted although I don’t who is the culprit.

    I compared the result of

    SELECT * FROM wp_posts WHERE post_type = ‘attachment’ with the contents of wp_realmedialibrary_posts and I found that there were 2 more records in the wp_posts table. This records are related to Elementor. See screen capture here.

    I deleted these 2 records and everything is back to normal.

    Maybe the code resetting the counter “cache” should check this kind of inconsistencies ?

    Ende gut, alles gut.

    MfG.

    Patrick

    Plugin Contributor Matthias Günter

    (@mguenter)

    HI again @samoreen !

    Thanks for your detailed explanation and nice to hear that all is working now.

    > Maybe the code resetting the counter “cache” should check this kind of inconsistencies ?

    Yeah, we could for sure check if a post generally exists and remove the item from wp_realmedialibrary_posts. I have added this to our backlog.

    Regards,
    Matthew 🙂

    Thread Starter samoreen

    (@samoreen)

    Hallo MAtthias,

    In this case, reversely, the 2 Elementor related posts existed in wp_posts as attachments but not in wp_realmedialibrary_posts. So, the problem was that the code of RML was unduly counting them. There was nothing to remove from wp_realmedialibrary_posts which was OK but rather from wp_posts.

    IT’s probably the way RML is counting the images that should be reviewed. RML has retrieved the total number of images by computing the total number of posts of type attachment and then, it assumed that the excess count was probably representing images that were Unorganized. So, I guess that the global count is computed from wp_posts and each individual folder count from wp_realmedialibrary_posts. The mismatch was not detected.

    Patrick

    Thread Starter samoreen

    (@samoreen)

    Hallo Matthias,

    The problem appeared again. It is related to the issue reported here :

    https://github.com/elementor/elementor/issues/12304

    Which is apparently not solved. When RML is counting, it should disregard entries in wp_posts having a title starting with “Elementor-post-screenshot…..”.

    MfG.

    Patrick

Viewing 15 replies - 1 through 15 (of 18 total)
  • The topic ‘Image number Mismatch’ is closed to new replies.