[FIXED OK]: Suddenly can't edit any pages!

For questions and problems with the CMS core. This board is NOT for any 3rd party modules, addons, PHP scripts or anything NOT distributed with the CMS made simple package itself.
Post Reply
martin42
Forum Members
Forum Members
Posts: 126
Joined: Sat Aug 20, 2005 11:35 pm

[FIXED OK]: Suddenly can't edit any pages!

Post by martin42 »

All of a sudden, the "main/content/pages" menu does not display any pages, so I can't edit my site!  The site is still working, thankfully...

This came after just clicking on the expand/collapse button.  This is using CMSMS 0.13 with PostgreSQL 8.1.4, PHP 4.4.2, FreeeBSD 6.1, mathopd 1.5p5.    The PHP error log says:

[11-Jun-2006 11:22:34] PHP Fatal error:  Call to a member function on a non-object in /home/website/lib/classes/class.content.inc.php on line 2139

Lline 2139 is the 'while' at the bottom of this chunk:

Code: Select all

              $query = "SELECT * FROM ".cms_db_prefix()."content $expanded
                        ORDER BY hierarchy";
                $dbresult =& $db->Execute($query);

                if ($dbresult && $dbresult->RecordCount() > 0)
                {
                        while ($row = $dbresult->FetchRow())
                        {
                                #Make sure the type exists.  If so, instantiate and load
                                if (in_array($row['type'],
                                                        array_keys(@ContentManager::ListContentTypes())))
                                {
          $contentobj = &new $row['type'];
                                        $contentobj->LoadFromData($row, $loadprops);
                                        if (isset($childrenCount[$contentobj->Id()])) {
                                                $contentobj->mChildCount = $childrenCount[$contentobj->Id()];
                                        }

                                        $curlevel = substr_count($contentobj->Hierarchy(),".")+1;
                                        if ($curlevel>$level) { // going farther in hierarchy
            $level = $curlevel;
                                        $node = &new ContentNode();
                                        $node->init($contentobj,$currentNode);
                                        $currentNode->addChild($node);
                  $next = &$node;
                                        } else if ($curlevel<$level) { // going upper
            while ($currentNode->getLevel()!=$curlevel) {
                                                        $currentNode = &$currentNode->getParentNode();
                                                }
Any thoughts how to recover?
Last edited by martin42 on Sun Jun 11, 2006 3:24 pm, edited 1 time in total.
martin42
Forum Members
Forum Members
Posts: 126
Joined: Sat Aug 20, 2005 11:35 pm

Re: Help! Suddenly can't edit any pages!

Post by martin42 »

OK, I've got my pages menu back by adding the line:

Code: Select all

$expanded = "";
just above where the SELECT query is set up (line 2113).  It all seems to be working, but I don't understand this code!
tsw
Power Poster
Power Poster
Posts: 1408
Joined: Tue Dec 13, 2005 10:50 pm

Re: Help! Suddenly can't edit any pages!

Post by tsw »

running 0.13?

If you have *lots* of pages user preference which holds status of expanded pages on page list is too short. its corrected in svn.

try emptying that preference

UPDATE cms_userprefs SET value="" WHERE preference="collapse";

then changing its type to text

ALTER TABLE cms_userprefs MODIFY value text;
martin42
Forum Members
Forum Members
Posts: 126
Joined: Sat Aug 20, 2005 11:35 pm

Re: Help! Suddenly can't edit any pages!

Post by martin42 »

Thanks! 

I've tweaked the database as you suggested (see below), and commented out my kludge in class.content.inc.php. 

Seems to be working OK.

Cheers,

- Martin.

Code: Select all

# select * from cms_userprefs;
 user_id |      preference      |     value     | type
---------+----------------------+---------------+------
       1 | use_wysiwyg          | 1             |
       1 | wysiwyg              | TinyMCE       |
       1 | default_cms_language |               |
       1 | admintheme           | default       |
       1 | bookmarks            | on            |
       1 | recent               | on            |
       2 | recent               | on            |
       3 | wysiwyg              | TinyMCE       |
       3 | default_cms_language | en_US         |
       3 | admintheme           | default       |
       3 | bookmarks            | on            |
       3 | recent               | on            |
       4 | wysiwyg              | TinyMCE       |
       4 | default_cms_language | en_US         |
       4 | admintheme           | default       |
       4 | bookmarks            | on            |
       4 | recent               | on            |
       2 | wysiwyg              | FCKeditorX    |
       2 | default_cms_language | en_US         |
       2 | admintheme           | default       |
       2 | bookmarks            | on            |
       2 | indent               | on            |
       2 | paging               | 0             |
       2 | collapse             | 0=1.8=1.13=1. |
(24 rows)

# UPDATE cms_userprefs SET value='' WHERE preference='collapse';
UPDATE 1

# select * from cms_userprefs;
 user_id |      preference      |   value    | type
---------+----------------------+------------+------
       1 | use_wysiwyg          | 1          |
       1 | wysiwyg              | TinyMCE    |
       1 | default_cms_language |            |
       1 | admintheme           | default    |
       1 | bookmarks            | on         |
       1 | recent               | on         |
       2 | recent               | on         |
       3 | wysiwyg              | TinyMCE    |
       3 | default_cms_language | en_US      |
       3 | admintheme           | default    |
       3 | bookmarks            | on         |
       3 | recent               | on         |
       4 | wysiwyg              | TinyMCE    |
       4 | default_cms_language | en_US      |
       4 | admintheme           | default    |
       4 | bookmarks            | on         |
       4 | recent               | on         |
       2 | wysiwyg              | FCKeditorX |
       2 | default_cms_language | en_US      |
       2 | admintheme           | default    |
       2 | bookmarks            | on         |
       2 | indent               | on         |
       2 | paging               | 0          |
       2 | collapse             |            |
(24 rows)

# alter table cms_userprefs alter column value type text;
ALTER TABLE

# 

climberusa
Forum Members
Forum Members
Posts: 126
Joined: Sun Feb 26, 2006 7:10 pm

Re: [FIXED OK]: Suddenly can't edit any pages!

Post by climberusa »

Thank for experiencing the same thing as me and then resolving it. All that was necessary was to run this sql:

UPDATE cms_userprefs SET value='' WHERE preference='collapse';

Thanks
martin42
Forum Members
Forum Members
Posts: 126
Joined: Sat Aug 20, 2005 11:35 pm

Re: [FIXED OK]: Suddenly can't edit any pages!

Post by martin42 »

Hehe, yes I did have a small panic when that happened...

I guess the ALTER definition should stop it happening again.  So far so good.
Post Reply

Return to “CMSMS Core”