Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+2 votes
587 views
in Q2A Core by

Issue: https://github.com/NoahY/q2a-badges/issues/49

qa-db.php line 196/197: 

for ($attempt = 0; $attempt < 100; $attempt++) {
            $result = $db->query($query);

Any hack to overcome the memory issue? Reducing the $attempt to a lower number (I tried 50) did not work.

Q2A version: 1.7
by
What is the query that's being executed? I don't think it's anything to do with that loop in qa-db.php (it should only run once anyway). Possibly the SQL query is trying to fetch too much data at once.
by
"Possibly the SQL query is trying to fetch too much data at once." - I think so too. I still need to find time to dig into the source code of the badge plugin.

1 Answer

+3 votes
by
Problem was in qa-badge-admin.php, line 546:

            $temp = qa_db_query_sub(
                'SELECT * FROM ^posts'
            );

which obviously also selected the posts' content and led to the memory explosion :)

Just replace it by:

            // get post data from table posts
            $temp = qa_db_query_sub(
                'SELECT postid, type, userid, netvotes, parentid, created, views FROM ^posts'
            );

Then it works.
by
nice! this will help someone.
...