A
A
alexalexes2019-02-12 12:05:20
MODX
alexalexes, 2019-02-12 12:05:20

How do I change the post date format in the Articles add-on?

PHP Version 5.6.13-pl0-gentoo
MODX Revolution 2.7.0-pl
Using the article publishing module Articles 1.7.11-pl
1. Create a resource of type "Article" called "News". I add the first news "test" without publication.
5c627cbeca4e7469044212.png
2. Trying to publish the "test" news, updating the content page of the "News" resource.
5c627d09e02de124186747.png
The result - the news disappears from the list of articles.
The reason for this error and how it is reproduced:
1. Go to mySQL in the modx_site_content table, see that the news is in place:
5c627dcac7d4e954802623.png
2. change the publishedon attribute of the "test" entry to 0. Update the news resource view page, and the news is again in the list, and it is also available at http:
3. Again I publish the news "test".
4. I look at the core/cache/logs/error.log log
When viewing a news resource, an error is added there:

[2019-02-12 12:48:25] (ERROR @ /....../htdocs/core/model/modx/modprocessor.class.php : 264) Processor failed creating output array due to JSON error 5

5. Go to the modprocessor.class.php file to get the details:
a) Get the content that we tried to jason from $array and the $trace function call stack:
public function outputArray(array $array,$count = false) {
        if ($count === false) { $count = count($array); }
        $output = json_encode(array(
            'success' => true,
            'total' => $count,
            'results' => $array
        ));
        if ($output === false) {
            ob_start(); 
            debug_print_backtrace(); 
            $trace = ob_get_contents(); 
            ob_end_clean(); 
            $this->modx->log(modX::LOG_LEVEL_ERROR, 'Processor failed creating output array due to JSON error '.json_last_error().print_r($array, true).print_r($trace, true));
            return json_encode(array('success' => false));
        }
        return $output;
    }

6. After editing, the error log gives the following details:
[2019-02-12 12:48:25] (ERROR @ /..../htdocs/core/model/modx/modprocessor.class.php : 264) Processor failed creating output array due to JSON error 5Array
(
    [0] => Array
        (
            [id] => 54
            [type] => document
            [contentType] => text/html
            [pagetitle] => тест
            [longtitle] => 
            [description] => 
            [alias] => тест
            [alias_visible] => 1
            [link_attributes] => 
            [published] => 1
            [pub_date] => 0
            [unpub_date] => 0
            [parent] => 53
            [isfolder] => 
            [introtext] => 
            [content] => 
            [richtext] => 1
            [template] => 0
            [menuindex] => 0
            [searchable] => 1
            [cacheable] => 1
            [createdby] => 1
            [createdon] => 2019-02-12 12:46:14
            [editedby] => 1
            [editedon] => 2019-02-12 12:46:25
            [deleted] => 
            [deletedon] => 0
            [deletedby] => 0
            [publishedon] => 12.02.2019 12:12  /* тут был неверный формат даты с корокозяброй Džנ12 - сокращенное название месяца или недели*/
            [publishedby] => 1
            [menutitle] => 
            [donthit] => 
            [privateweb] => 
            [privatemgr] => 
            [content_dispo] => 0
            [hidemenu] => 1
            [class_key] => Article
            [context_key] => web
            [content_type] => 1
            [uri] => news/2019/02/12/тест/
            [uri_override] => 1
            [hide_children_in_tree] => 0
            [show_in_tree] => 0
            [properties] => Array
                (
                    [articles] => Array
                        (
                            [notificationServices] => 
                        )

                )

            [createdby_username] => admin
            [tags] => 
            [comments] => 0
            [publishedon_date] => Džנ12     /* а тут формат даты остался неправильный !!!!!! */
            [publishedon_time] => 12:12 
            [action_edit] => ?a=resource/update&action=post/update&id=54
            [preview_url] => http://мой-сайт/news/2019/02/12/тест/
            [actions] => Array
                (
                    [0] => Array
                        (
                            [className] => edit
                            [text] => Редактировать
                        )

                    [1] => Array
                        (
                            [className] => view
                            [text] => Просмотреть
                        )

                    [2] => Array
                        (
                            [className] => delete
                            [text] => Удалить
                        )

                    [3] => Array
                        (
                            [className] => unpublish
                            [text] => Снять с публикации
                        )

                )

        )

)
#0  modProcessor->outputArray(Array ([0] => Array ([id] => 54,[type] => document,[contentType] => text/html,[pagetitle] => тест,[longtitle] => ,[description] => ,[alias] => тест,[alias_visible] => 1,[link_attributes] => ,[published] => 1,[pub_date] => 0,[unpub_date] => 0,[parent] => 53,[isfolder] => ,[introtext] => ,[content] => ,[richtext] => 1,[template] => 0,[menuindex] => 0,[searchable] => 1,[cacheable] => 1,[createdby] => 1,[createdon] => 2019-02-12 12:46:14,[editedby] => 1,[editedon] => 2019-02-12 12:46:25,[deleted] => ,[deletedon] => 0,[deletedby] => 0,[publishedon] => 12.02.2019 12:12 ,[publishedby] => 1,[menutitle] => ,[donthit] => ,[privateweb] => ,[privatemgr] => ,[content_dispo] => 0,[hidemenu] => 1,[class_key] => Article,[context_key] => web,[content_type] => 1,[uri] => news/2019/02/12/тест/,[uri_override] => 1,[hide_children_in_tree] => 0,[show_in_tree] => 0,[properties] => Array ([articles] => Array ([notificationServices] => )),[createdby_username] => admin,[tags] => ,[comments] => 0,[publishedon_date] => Džנ12,[publishedon_time] => 12:12 ,[action_edit] => ?a=resource/update&action=post/update&id=54,[preview_url] => http://мой-сайт/news/2019/02/12/тест/,[actions] => Array ([0] => Array ([className] => edit,[text] => Редактировать),[1] => Array ([className] => view,[text] => Просмотреть),[2] => Array ([className] => delete,[text] => Удалить),[3] => Array ([className] => unpublish,[text] => Снять с публикации)))), 1) called at [/....../htdocs/core/model/modx/modprocessor.class.php:500]
#1  modObjectGetListProcessor->process() called at [/....../htdocs/core/model/modx/modprocessor.class.php:177]
#2  modProcessor->run() called at [/....../htdocs/core/model/modx/modx.class.php:1763]
#3  modX->runProcessor(article/getlist, Array ([start] => 0,[limit] => 20,[action] => article/getList,[parent] => 53,[HTTP_MODAUTH] => modx.......), Array ([processors_path] => /....../htdocs/core/components/articles/processors/,[location] => ,[action] => article/getlist)) called at [/......./htdocs/core/model/modx/modconnectorresponse.class.php:144]
#4  modConnectorResponse->outputContent(Array ([processors_path] => /....../htdocs/core/components/articles/processors/,[location] => ,[action] => article/getlist)) called at [/....../htdocs/core/model/modx/modconnectorrequest.class.php:86]
#5  modConnectorRequest->prepareResponse(Array ([processors_path] => /....../htdocs/core/components/articles/processors/,[location] => ,[action] => article/getlist)) called at [/....../htdocs/core/model/modx/modconnectorrequest.class.php:73]
#6  modConnectorRequest->handleRequest(Array ([processors_path] => /....../htdocs/core/components/articles/processors/,[location] => )) called at [/....../htdocs/assets/components/articles/connector.php:42]

When displaying a list of news in the admin panel, the publication date on the server side is formed with Cyrillic characters in the wrong encoding, the publication object cannot be serialized into JSON and passed to the admin panel frontend.
Continued in comment...

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alexander Kuznetsov, 2019-02-12
@DarkRaven

I recommend looking in "Advanced settings" -> "General" -> "Articles URL Format", the parameter at the very end.
There should still be parameters, I won’t say more precisely now.
UPD. You need this:
5c629b9f527e4358149005.png

A
alexalexes, 2019-02-12
@alexalexes

The solution turned out to be in the config file: \ htdocs
\core\cache\system_settings\
config.cache.php
5c6296e96d2e8706063709.png

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question