Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

Upgrading SilverStripe /

Ask questions about upgrading SilverStripe to the latest version.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Cannot access admin section after upgrading to version 2.3.2


Reply


3 Posts   2903 Views

Avatar
alexanm

Community Member, 38 Posts

8 July 2009 at 4:33pm

Edited: 08/07/2009 4:33pm

Hello,

I have just downloaded and upgraded to version 2.3.2. After this I am not able to enter the adminsection because it throws an error:

[User Error] Couldn't run query: SELECT Distinct Locale FROM SiteTree GROUP BY Locale Unknown column 'Locale' in 'field list'

Line 400 in C:\inetpub\wwwroot\government-first\sapphire\core\model\MySQLDatabase.php
Source

391    }
392    
393    function databaseError($msg, $errorLevel = E_USER_ERROR) {
394       // try to extract and format query
395       if(preg_match('/Couldn\'t run query: ([^\|]*)\|\s*(.*)/', $msg, $matches)) {
396          $formatter = new SQLFormatter();
397          $msg = "Couldn't run query: \n" . $formatter->formatPlain($matches[1]) . "\n\n" . $matches[2];
398       }
399       
400       user_error($msg, $errorLevel);
401    }
402 }
403
404 /**
405 * A result-set from a MySQL database.
406 * @package sapphire

Trace

* Couldn't run query: SELECT Distinct Locale FROM SiteTree GROUP BY Locale Unknown column 'Locale' in 'field list'
Line 400 of MySQLDatabase.php
* MySQLDatabase->databaseError(Couldn't run query: SELECT Distinct Locale FROM SiteTree GROUP BY Locale | Unknown column 'Locale' in 'field list',256)
Line 102 of MySQLDatabase.php
* MySQLDatabase->query(SELECT Distinct Locale FROM SiteTree GROUP BY Locale,256)
Line 120 of DB.php
* DB::query(SELECT Distinct Locale FROM SiteTree GROUP BY Locale)
Line 426 of SQLQuery.php
* SQLQuery->execute()
Line 1133 of Translatable.php
* Translatable::get_existing_content_languages(SiteTree)
Line 1204 of CMSMain.php
* CMSMain->MultipleLanguages()
* call_user_func_array(Array,Array)
Line 550 of ViewableData.php
* ViewableData->cachedCall(MultipleLanguages,,)
Line 591 of ViewableData.php
* ViewableData->hasValue(MultipleLanguages)
Line 314 of .cacheC..inetpub.wwwroot.government-first.cms.templates.Includes.CMSMain_left.ss
* include(C:\inetpub\wwwroot\government-first\silverstripe-cache\.cacheC..inetpub.wwwroot.government-first.cms.templates.Includes.CMSMain_left.ss)
Line 354 of SSViewer.php
* SSViewer->process(CMSMain)
Line 773 of ViewableData.php
* ViewableData->renderWith(Array)
Line 480 of LeftAndMain.php
* LeftAndMain->Left()
* call_user_func_array(Array,Array)
Line 408 of ViewableData.php
* ViewableData->XML_val(Left,,1)
Line 59 of .cacheC..inetpub.wwwroot.government-first.cms.templates.LeftAndMain.ss
* include(C:\inetpub\wwwroot\government-first\silverstripe-cache\.cacheC..inetpub.wwwroot.government-first.cms.templates.LeftAndMain.ss)
Line 354 of SSViewer.php
* SSViewer->process(CMSMain)
Line 175 of Controller.php
* Controller->handleAction(HTTPRequest)
Line 129 of RequestHandler.php
* RequestHandler->handleRequest(HTTPRequest)
Line 122 of Controller.php
* Controller->handleRequest(HTTPRequest)
Line 277 of Director.php
* Director::handleRequest(HTTPRequest,Session)
Line 121 of Director.php
* Director::direct(admin)
Line 118 of main.php

Any ideas why this happens?

TIA
Markus Alexander

Avatar
alexanm

Community Member, 38 Posts

9 July 2009 at 6:05pm

Hello,

ok I solved the problem on my side. The key element was

Object::add_extension('SiteTree', 'Translatable');

Two things I am wondering:
- I have not seen any clue about adding this line to my _config.php in the upgrade manual. Did I miss it?
- In the Translatable.php file it says ate beginning in the comment: Use

Object::add_extension('MyClass', 'Translatable');

on the classes you need the Translatable feature, but the api assumes, that you do this on the SiteTree Level. Did I miss something here, too?

TIA
Markus Alexander

Avatar
ABailey

Community Member, 8 Posts

16 July 2009 at 4:46pm

I just ran into this same exact problem. So I searched my entire site for something turning on the Translatable feature... nothing. I even added 'Object::remove_extension('SiteTree', 'Translatable');' to mysite/_config.php as suggested... no help.

multiple /dev/build&flush=1 and /dev/build... fruitless.

What DID work for me was nuking the cache folder for the site, running a /dev/build&flush=1 and voila!