Page 1 of 1

Articles missing?

Posted: Sat 1. Jan 2011, 12:56
by Oliver Georgi
If you have an older install or an install of phpwcms which has a long history your article can end with 01/01/2011 or just 10 years after it was created. When phpwcms was developed, who could imagine that websites would live longer than 10 years.

[UPDATE 4]
If none of the following solutions helps you are free to [mailto=contact@phpwcms.org?subject=phpwcms%20article%20end%20date]contact me[/mailto] to solve this for you very fast. Please, I cannot help for free but usually it takes 5-10 minutes only.

[UPDATE 4]
The simplest solution, but perhaps the most time consuming (if you have a lot of articles), is to go through each article in your installation and set its end date to one in the (far) future.

[UPDATE 3]
For those of you having no FTP access it might help to create a new CP HTML in the backend containing the following in the [PHP] inline tag. Run the article once in frontend. It should return a bool(true). The article in which the new CP HTML is created must have a valid end date. Check that first, otherwise the [PHP] is not processed!!!.
Use this snippet if you have the same fixed end date for every article — replace the date in the WHERE clause by your end date WHERE article_end='2010-12-31 23:59:59':

Code: Select all

[PHP]
$r = @mysql_query("UPDATE ".DB_PREPEND."phpwcms_article SET article_tstamp=article_tstamp, article_end='2030-12-31 23:59:59' WHERE article_end='2010-12-31 23:59:59' AND article_deleted=0", $GLOBALS['db']);
var_dump($r);
[/PHP]
Use this code snippet if you have different end dates. Be careful – also manually ended articles might be live again after running this:

Code: Select all

[PHP]
$r = @mysql_query("UPDATE ".DB_PREPEND."phpwcms_article SET article_tstamp=article_tstamp, article_end='2030-12-31 23:59:59' WHERE article_deleted=0", $GLOBALS['db']);
var_dump($r);
[/PHP]
If everything is fine then, you can delete the CP HTML again or just disable it.


[UPDATE 2]
I have released a patch file which can be downloaded on GitHub. This fix will update the fixed article end date (2010-12-31 23:59:59 problem) by adding additional 20 years. It works with every install of phpwcms. Download the fix, unzip it and put it in the web install root directory of your phpwcms installation (in the same level as login.php, index.php and phpwcms.php). Upload the script by ftp then point your browser to http://%yourphpwcms.com%/phpwcmsfixarticledate.php.

[UPDATE 1]
To solve that behavior (sorry for that) you have to update article end dates. I have prepared a short screencast how you can do this using phpMyAdmin or equivalent tool. http://flic.kr/p/96Hv8s

Check this upgrade script which corrects article end date. But be warned — better you know what it is for:
https://github.com/slackero/phpwcms/blo ... ledate.php

Re: You miss your articles

Posted: Sat 1. Jan 2011, 17:38
by Oliver Georgi
You can also change the article end date using phpMyAdmin or other DB tool:

Code: Select all

UPDATE phpwcms_article SET article_end='2030-12-31 23:59:59' WHERE article_end='2010-12-31 23:59:59' AND article_deleted=0
Set DB prefix if you use one for the concerned install: %your-db-prefix%_phpwcms_article.

Watch the screencast

Re: You miss your articles

Posted: Thu 6. Jan 2011, 11:10
by sciint
Hi, I would like some help on how to fix the problem with the fixed article end date. I have read all the information you have put up, and watched the screencast but I am none the wiser. Please could you give me further information as I do not want to have to go through every article individually.Thank you.

Re: You miss your articles

Posted: Tue 11. Jan 2011, 15:59
by frenzal
Hadn't touched phpwcms for ages and then suddenly none of the content was displaying on an old site. Glad it was an easy fix but still

Re: You miss your articles

Posted: Tue 11. Jan 2011, 16:09
by Oliver Georgi
frenzal wrote:Glad it was an easy fix but still
What do you mean?

Re: You miss your articles

Posted: Tue 11. Jan 2011, 16:35
by frenzal
That all I had to do was an update query, I was worried at first something more serious had gone wrong.