Silverstripe /admin/ suddenly stopped working
-
13-12-2019 - |
Question
Currently I am working on a SilverStripe project, and everything seems to be running smooth. But then things changed.. This morning I tried to login and I got the message that an error occured. Running in development mode gave the following errormessage:
[User Error] Couldn't run query: SELECT "SiteTree_Live"."ClassName", "SiteTree_Live"."Created", "SiteTree_Live"."LastEdited", "SiteTree_Live"."URLSegment", "SiteTree_Live"."Title", "SiteTree_Live"."MenuTitle", "SiteTree_Live"."Content", "SiteTree_Live"."MetaTitle", "SiteTree_Live"."MetaDescription", "SiteTree_Live"."MetaKeywords", "SiteTree_Live"."ExtraMeta", "SiteTree_Live"."ShowInMenus", "SiteTree_Live"."ShowInSearch", "SiteTree_Live"."HomepageForDomain", "SiteTree_Live"."ProvideComments", "SiteTree_Live"."Sort", "SiteTree_Live"."HasBrokenFile", "SiteTree_Live"."HasBrokenLink", "SiteTree_Live"."Status", "SiteTree_Live"."ReportClass", "SiteTree_Live"."CanViewType", "SiteTree_Live"."CanEditType", "SiteTree_Live"."ToDo", "SiteTree_Live"."Version", "SiteTree_Live"."ParentID",
Read full error message: http://pastebin.com/TrjrEzUn
... WHERE ("SiteTree_Live"."ClassName" IN ('Page','BlogEntry','BlogTree','DienstHolder','DienstPage','FaqHolder','FaqPage','FrontPage','MemberPage','TeamPage','ErrorPage','RedirectorPage','VirtualPage','UserDefinedForm','BlogHolder')) AND (ParentID = ) ORDER BY "Sort" You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ') ORDER BY "Sort"' at line 1
GET /Security/login?BackURL=%2Fadmin
Line 525 in /home/admin/domains/stargroup.nl/public_html/sapphire/core/model/MySQLDatabase.php
I checked mysql on empty classnames, some where found but got their proper classname. Anyone has any suggestions on how to overcome this error and get the login back to working again?
Thnx in advance!
Solution 2
Bug is fixxed thanks to Bollig|DesignCity in the SilverStripe IRC Channel.
It all had to do with some code in page.php
Wrong code
function Siblings() {
$whereStatement = "ParentID = ".$this->ParentID;
return DataObject::get("Page", $whereStatement);
}
Fixed Code Note to self: Always be aware of small mistakes like this..
function Siblings() {
$whereStatement = "ParentID = '".$this->ParentID."'";
return DataObject::get("Page", $whereStatement);
}
OTHER TIPS
The problem in the posted query is that one of the parameters is missing a value - right at the end:
AND (ParentID = ) ORDER BY "Sort"
Without knowing silverstripe, I'd guess one of your articles/posts is somehow missing an ID or ParentID.