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.

General Questions

General questions about getting started with SilverStripe that don't fit in any of the categories above.

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

Siteconfig error


Reply

412 Views

Avatar
dompie

9 November 2010 at 12:27am (Last edited: 9 November 2010 12:28am), Community Member, 88 Posts

I'm getting a strange error when pressing on 'Save' button on the SiteConfig page (Site root).
Here is what i did:
CustomSiteConfig.php

class CustomSiteConfig extends DataObjectDecorator {

   function extraStatics() {
      return array('db' => array(
//         'Season' => "enum('Winter,Summer','Winter')"
      ));
   }
   public function updateCMSFields(FieldSet $fields) {
      $season = new DropdownField('Season', _t('CustomSiteConfig.SET_SEASON'), array(
         'Winter' => _t('CustomSiteConfig.WINTER'),
         'Summer' => _t('CustomSiteConfig.SUMMER')),
         'Winter'
      );
      $fields->addFieldToTab('Root.Main', $season);
   }
}

_config.php

:
Object::add_extension('SiteConfig', 'CustomSiteConfig');
:

And here is the JavaScript Error SilverStripe throws:

993:
missing ) after argument list

Debug (Versioned::get_latest_version() in line 880 of Versioned.php)
SELECT "SiteTree_versions"."ClassName", "SiteTree_versions"."Created", "SiteTree_versions"."LastEdited", "SiteTree_versions"."URLSegment", "SiteTree_versions"."Title", "SiteTree_versions"."MenuTitle", "SiteTree_versions"."Content", "SiteTree_versions"."MetaTitle", "SiteTree_versions"."MetaDescription", "SiteTree_versions"."MetaKeywords", "SiteTree_versions"."ExtraMeta", "SiteTree_versions"."ShowInMenus", "SiteTree_versions"."ShowInSearch", "SiteTree_versions"."HomepageForDomain", "SiteTree_versions"."ProvideComments", "SiteTree_versions"."Sort", "SiteTree_versions"."HasBrokenFile", "SiteTree_versions"."HasBrokenLink", "SiteTree_versions"."Status", "SiteTree_versions"."ReportClass", "SiteTree_versions"."CanViewType", "SiteTree_versions"."CanEditType", "SiteTree_versions"."ToDo", "SiteTree_versions"."Version", "SiteTree_versions"."Locale", "SiteTree_versions"."ParentID", "SiteTree_versions"."SubsiteID", "SiteTree_versions"."MasterPageID", "Page_versions"."LogoID", "ErrorPage_versions"."ErrorCode", "RedirectorPage_versions"."RedirectionType", "RedirectorPage_versions"."ExternalURL", "RedirectorPage_versions"."LinkToID", "VirtualPage_versions"."VersionID", "VirtualPage_versions"."CopyContentFromID", "DefaultPage_versions"."LayoutView", "DefaultPage_versions"."ShortText", "DefaultPage_versions"."MarginalText", "DestinationPage_versions"."defaultZoom", "DestinationPage_versions"."centerLat", "DestinationPage_versions"."centerLng", "HomePage_versions"."Claim", "HomePage_versions"."WinterWelcomeText", "HomePage_versions"."WinterBannerText", "HomePage_versions"."SummerWelcomeText", "HomePage_versions"."SummerBannerText", "HomePage_versions"."Teaser1Text", "HomePage_versions"."Teaser1Link", "HomePage_versions"."WinterBannerImageID", "HomePage_versions"."SummerBannerImageID", "SubsitesVirtualPage_versions"."CustomMetaTitle", "SubsitesVirtualPage_versions"."CustomMetaKeywords", "SubsitesVirtualPage_versions"."CustomMetaDescription", "SubsitesVirtualPage_versions"."CustomExtraMeta", "SiteTree_versions"."ID", CASE WHEN "SiteTree_versions"."ClassName" IS NOT NULL THEN "SiteTree_versions"."ClassName" ELSE 'SiteTree' END AS "RecordClassName", "SiteTree_versions"."RecordID", "SiteTree_versions"."Version", "SiteTree_versions"."WasPublished", "SiteTree_versions"."AuthorID", "SiteTree_versions"."PublisherID", "SiteTree_versions"."RecordID" AS "ID" FROM "SiteTree_versions" LEFT JOIN "Page_versions" ON "Page_versions"."RecordID" = "SiteTree_versions"."RecordID" AND "Page_versions"."Version" = "SiteTree_versions"."Version" LEFT JOIN "ErrorPage_versions" ON "ErrorPage_versions"."RecordID" = "SiteTree_versions"."RecordID" AND "ErrorPage_versions"."Version" = "SiteTree_versions"."Version" LEFT JOIN "RedirectorPage_versions" ON "RedirectorPage_versions"."RecordID" = "SiteTree_versions"."RecordID" AND "RedirectorPage_versions"."Version" = "SiteTree_versions"."Version" LEFT JOIN "VirtualPage_versions" ON "VirtualPage_versions"."RecordID" = "SiteTree_versions"."RecordID" AND "VirtualPage_versions"."Version" = "SiteTree_versions"."Version" LEFT JOIN "DefaultPage_versions" ON "DefaultPage_versions"."RecordID" = "SiteTree_versions"."RecordID" AND "DefaultPage_versions"."Version" = "SiteTree_versions"."Version" LEFT JOIN "DestinationPage_versions" ON "DestinationPage_versions"."RecordID" = "SiteTree_versions"."RecordID" AND "DestinationPage_versions"."Version" = "SiteTree_versions"."Version" LEFT JOIN "HomePage_versions" ON "HomePage_versions"."RecordID" = "SiteTree_versions"."RecordID" AND "HomePage_versions"."Version" = "SiteTree_versions"."Version" LEFT JOIN "SubsitesVirtualPage_versions" ON "SubsitesVirtualPage_versions"."RecordID" = "SiteTree_versions"."RecordID" AND "SubsitesVirtualPage_versions"."Version" = "SiteTree_versions"."Version" WHERE ("SiteTree_versions"."RecordID" = 1) AND ("SiteTree_versions"."SubsiteID" IN (0)) AND ("SiteTree_versions"."Locale" = 'en_US') ORDER BY "SiteTree_versions"."Version" DESC LIMIT 1

Debug (Versioned::get_latest_version() in line 881 of Versioned.php)
<ul>
<li>ClassName = </li>
<li>Created = 2010-11-02 16:31:43</li>
<li>LastEdited = 2010-11-03 17:52:59</li>
<li>URLSegment = home</li>
<li>Title = Home</li>
<li>MenuTitle = </li>
<li>Content = <p>Welcome to SilverStripe! This is the default homepage. You can edit this page by opening <a href="admin/">the CMS</a>. You can now access the <a href="http://doc.silverstripe.org">developer documentation</a>, or begin <a href="http://doc.silverstripe.org/doku.php?id=tutorials">the tutorials.</a></p></li>
<li>MetaTitle = </li>
<li>MetaDescription = </li>
<li>MetaKeywords = </li>
<li>ExtraMeta = </li>
<li>ShowInMenus = 1</li>
<li>ShowInSearch = 1</li>
<li>HomepageForDomain = </li>
<li>ProvideComments = 0</li>
<li>Sort = 1</li>
<li>HasBrokenFile = 0</li>
<li>HasBrokenLink = 0</li>
<li>Status = Saved (update)</li>
<li>ReportClass = </li>
<li>CanViewType = Inherit</li>
<li>CanEditType = Inherit</li>
<li>ToDo = </li>
<li>Version = 4</li>
<li>Locale = en_US</li>
<li>ParentID = 0</li>
<li>SubsiteID = 0</li>
<li>MasterPageID = 0</li>
<li>LogoID = </li>
<li>ErrorCode = </li>
<li>RedirectionType = </li>
<li>ExternalURL = </li>
<li>LinkToID = </li>
<li>VersionID = </li>
<li>CopyContentFromID = </li>
<li>LayoutView = </li>
<li>ShortText = </li>
<li>MarginalText = </li>
<li>defaultZoom = </li>
<li>centerLat = </li>
<li>centerLng = </li>
<li>Claim = </li>
<li>WinterWelcomeText = </li>
<li>WinterBannerText = </li>
<li>SummerWelcomeText = </li>
<li>SummerBannerText = </li>
<li>Teaser1Text = </li>
<li>Teaser1Link = </li>
<li>WinterBannerImageID = 0</li>
<li>SummerBannerImageID = 0</li>
<li>CustomMetaTitle = </li>
<li>CustomMetaKeywords = </li>
<li>CustomMetaDescription = </li>
<li>CustomExtraMeta = </li>
<li>ID = 1</li>
<li>RecordClassName = </li>
<li>RecordID = 1</li>
<li>WasPublished = 1</li>
<li>AuthorID = 1</li>
<li>PublisherID = 1</li>
</ul>

ERROR [User Error]: Versioned::get_version: Couldn't get SiteTree.1
IN POST /site/admin/RootForm
Line 882 in /home/dpiekarski/public_html/silverstripe_base/sapphire/core/model/Versioned.php

Source
======
873:       $query = singleton($class)->buildVersionSQL("\"{$baseTable}\".\"RecordID\" = $id",
"\"{$baseTable}\".\"Version\" DESC");
874:       $query->limit = 1;
875:       $record = $query->execute()->record();
876:       if(!$record) return;
877:       
878:       $className = $record['ClassName'];
879:       if(!$className) {
880:          Debug::show($query->sql());
881:          Debug::show($record);
* 882:          user_error("Versioned::get_version: Couldn't get $class.$id", E_USER_ERROR);
883:       }
884:
885:       Versioned::set_reading_mode($oldMode);
886:
887:       return new $className($record);
888:    }

Trace
=====
<ul>user_error(Versioned::get_version: Couldn't get SiteTree.1,256)
line 882 of Versioned.php

Versioned::get_latest_version(SiteTree,1)
line 417 of CMSMain.php

CMSMain->getRecord(1)
line 1069 of LeftAndMain.php

LeftAndMain->currentPage()
line 120 of LeftAndMainSubsites.php

LeftAndMainSubsites->alternateAccessCheck()

call_user_func_array(Array,Array)
line 693 of Object.php

Object->__call(alternateAccessCheck,Array)

CMSMain->alternateAccessCheck()
line 81 of LeftAndMain.php

LeftAndMain->canView()
line 122 of LeftAndMain.php

LeftAndMain->init()
line 87 of CMSMain.php

CMSMain->init()
line 137 of Controller.php

Controller->handleRequest(SS_HTTPRequest)
line 281 of Director.php

Director::handleRequest(SS_HTTPRequest,Session)
line 124 of Director.php

Director::direct(/admin/RootForm)
line 127 of main.php

</ul>
http://ss.site.de/site/sapphire/thirdparty/prototype/prototype.js?m=1288885253
Line 658

It seems like Silverstripe tries to load version 1 of SiteTree, that does not exist in Database, right? How can I fix this, any suggestions? Someone stumbled upon this problem already ? I'm using SS 2.4.1