Posts: 3
Threads: 1
Joined: Apr 2012
Hello, i have 500.000 url in my site with 300 mb in the database. With automatic link creation, my database size reached to 600 mb. How can i add only commented pages . Any help will be appreciated...
Posts: 2,895
Threads: 59
Joined: Jun 2010
Hi,
Sorry for the late reply. I'm going to look into this either today or tomorrow. I will provide a solution here.
Have
you completed
the interview?
Posts: 3
Threads: 1
Joined: Apr 2012
Thanks for your interest Steven...
Posts: 2,895
Threads: 59
Joined: Jun 2010
Hi,
I've done a few tests and I think this will work.
1. What you need to do first is to create a new Commentics page which you know won't ever have any comments submitted to it. To do this you could change the $page_id in one of your existing pages to something unique like "cmtx80934853", view the page in your web browser, and then change the $page_id back to what it was.
2. In Manage -> Pages, find the page that you just created. If necessary do a search for "cmtx80934853" to find it. Make a note of the ID of the page. This will be in the left column. For example it may be "156".
3. Now in comments/includes/functions/page.php, find this bit of code (starts at line 178):
PHP Code:
<?php
} else { //create page
mysql_query("INSERT INTO `".$mysql_table_prefix."pages` (custom_id, reference, url, is_form_enabled, dated) VALUES ('$page_id', '$reference', '$url', 1, NOW())");
return mysql_insert_id();
}
And replace it with this:
PHP Code:
<?php
} else { //create page
if (isset($_POST['cmtx_submit']) || isset($_POST['cmtx_sub']) || isset($_POST['cmtx_preview']) || isset($_POST['cmtx_prev'])) { //if data submitted
mysql_query("INSERT INTO `".$cmtx_mysql_table_prefix."pages` (custom_id, reference, url, is_form_enabled, dated) VALUES ('$page_id', '$reference', '$url', 1, NOW())");
return mysql_insert_id();
} else {
return "156";
}
}
(Make sure to change "156" to the actual ID.)
What happens now is when a user views a page, if it doesn't exist then instead of creating it, it loads page 156 which has no comments. If the user either previews or submits a comment then it will create the page and it will load the correct ID from then on.