Jump to:

10930 Posts in 2613 Topics by 1810 members

All other Modules

SilverStripe Forums » All other Modules » Undefined variable: alterList

Discuss all other Modules here.

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

Page: 1
Go to End
Author Topic: 1495 Views
  • faraway
    Avatar
    Community Member
    1 Post

    Undefined variable: alterList Link to this post

    Hi comunity, I'm very exiting with silverstripe but as a newbie I have some problems with certain things.
    When I try to install any module I get the following error on db/build process: Undefined variable: alterList.

    Can you help me please?
    Thanks a lot

    More details here:

    http://localhost/SilverStripe-test1/db/build

    Building Database SS_mysite_test1

    Creating database tables
    # PageComment
    # CalendarDateTime
    # ICSFeed
    # RecurringDayOfMonth
    # RecurringDayOfWeek
    # RecurringException
    # SiteTree
    # Field SiteTree.ClassName: changed to enum('SiteTree','Page','GhostPage','Calendar','CalendarEvent','ErrorPage','RedirectorPage','VirtualPage') character set utf8 collate utf8_general_ci default 'SiteTree' (from enum('SiteTree','Page','GhostPage','ErrorPage','RedirectorPage','VirtualPage') character set utf8 collate utf8_general_ci default 'SiteTree')
    # Field SiteTree_Live.ClassName: changed to enum('SiteTree','Page','GhostPage','Calendar','CalendarEvent','ErrorPage','RedirectorPage','VirtualPage') character set utf8 collate utf8_general_ci default 'SiteTree' (from enum('SiteTree','Page','GhostPage','ErrorPage','RedirectorPage','VirtualPage') character set utf8 collate utf8_general_ci default 'SiteTree')
    # Field SiteTree_versions.ClassName: changed to enum('SiteTree','Page','GhostPage','Calendar','CalendarEvent','ErrorPage','RedirectorPage','VirtualPage') character set utf8 collate utf8_general_ci default 'SiteTree' (from enum('SiteTree','Page','GhostPage','ErrorPage','RedirectorPage','VirtualPage') character set utf8 collate utf8_general_ci default 'SiteTree')
    # Email_BounceRecord
    # QueuedEmail
    # File
    # Group
    # LoginAttempt
    # Member
    # MemberPassword
    # Permission
    # Widget
    # WidgetArea
    # Page
    # GhostPage
    # Calendar
    # Table Calendar: created
    # Field Calendar.ID: created as int(11) not null auto_increment
    # Field Calendar.DefaultEventDisplay: created as int(11) not null default '0'
    # Field Calendar.DefaultDateHeader: created as varchar(50) character set utf8 collate utf8_general_ci
    # Field Calendar.OtherDatesCount: created as int(11) not null default '0'
    # Table Calendar_Live: created
    # Field Calendar_Live.ID: created as int(11) not null auto_increment
    # Field Calendar_Live.DefaultEventDisplay: created as int(11) not null default '0'
    # Field Calendar_Live.DefaultDateHeader: created as varchar(50) character set utf8 collate utf8_general_ci
    # Field Calendar_Live.OtherDatesCount: created as int(11) not null default '0'
    # Table Calendar_versions: created
    # Field Calendar_versions.ID: created as int(11) not null auto_increment
    # Field Calendar_versions.RecordID: created as int(11) not null default '0'
    # Field Calendar_versions.Version: created as int(11) not null default '0'
    # Field Calendar_versions.WasPublished: created as tinyint(1) unsigned not null default '0'
    # Field Calendar_versions.AuthorID: created as int(11) not null default '0'
    # Field Calendar_versions.PublisherID: created as int(11) not null default '0'
    # Field Calendar_versions.DefaultEventDisplay: created as int(11) not null default '0'
    # Field Calendar_versions.DefaultDateHeader: created as varchar(50) character set utf8 collate utf8_general_ci
    # Field Calendar_versions.OtherDatesCount: created as int(11) not null default '0'
    # Index Calendar_versions.RecordID_Version: created as (RecordID,Version)
    # Index Calendar_versions.RecordID: created as (RecordID)
    # Index Calendar_versions.Version: created as (Version)
    # Index Calendar_versions.AuthorID: created as (AuthorID)
    # Index Calendar_versions.PublisherID: created as (PublisherID)
    # CalendarEvent
    # Table CalendarEvent: created
    # Field CalendarEvent.ID: created as int(11) not null auto_increment
    # Field CalendarEvent.Recursion: created as tinyint(1) unsigned not null default '0'
    # Field CalendarEvent.CustomRecursionType: created as int(11) not null default '0'
    # Field CalendarEvent.DailyInterval: created as int(11) not null default '0'
    # Field CalendarEvent.WeeklyInterval: created as int(11) not null default '0'
    # Field CalendarEvent.MonthlyInterval: created as int(11) not null default '0'
    # Field CalendarEvent.MonthlyRecursionType1: created as int(11) not null default '0'
    # Field CalendarEvent.MonthlyRecursionType2: created as int(11) not null default '0'
    # Field CalendarEvent.MonthlyIndex: created as int(11) not null default '0'
    # Field CalendarEvent.MonthlyDayOfWeek: created as int(11) not null default '0'
    # Field CalendarEvent.CalendarID: created as int(11) not null default '0'
    # Index CalendarEvent.CalendarID: created as (CalendarID)
    # Table CalendarEvent_RecurringDaysOfWeek: created
    # Field CalendarEvent_RecurringDaysOfWeek.ID: created as int(11) not null auto_increment
    # Field CalendarEvent_RecurringDaysOfWeek.CalendarEventID: created as int(11) not null default '0'
    # Field CalendarEvent_RecurringDaysOfWeek.RecurringDayOfWeekID: created as int(11) not null default '0'
    # Index CalendarEvent_RecurringDaysOfWeek.CalendarEventID: created as (CalendarEventID)
    # Index CalendarEvent_RecurringDaysOfWeek.RecurringDayOfWeekID: created as (RecurringDayOfWeekID)
    # Table CalendarEvent_RecurringDaysOfMonth: created
    # Field CalendarEvent_RecurringDaysOfMonth.ID: created as int(11) not null auto_increment
    # Field CalendarEvent_RecurringDaysOfMonth.CalendarEventID: created as int(11) not null default '0'
    # Field CalendarEvent_RecurringDaysOfMonth.RecurringDayOfMonthID: created as int(11) not null default '0'
    # Index CalendarEvent_RecurringDaysOfMonth.CalendarEventID: created as (CalendarEventID)
    # Index CalendarEvent_RecurringDaysOfMonth.RecurringDayOfMonthID: created as (RecurringDayOfMonthID)
    # Table CalendarEvent_Live: created
    # Field CalendarEvent_Live.ID: created as int(11) not null auto_increment
    # Field CalendarEvent_Live.Recursion: created as tinyint(1) unsigned not null default '0'
    # Field CalendarEvent_Live.CustomRecursionType: created as int(11) not null default '0'
    # Field CalendarEvent_Live.DailyInterval: created as int(11) not null default '0'
    # Field CalendarEvent_Live.WeeklyInterval: created as int(11) not null default '0'
    # Field CalendarEvent_Live.MonthlyInterval: created as int(11) not null default '0'
    # Field CalendarEvent_Live.MonthlyRecursionType1: created as int(11) not null default '0'
    # Field CalendarEvent_Live.MonthlyRecursionType2: created as int(11) not null default '0'
    # Field CalendarEvent_Live.MonthlyIndex: created as int(11) not null default '0'
    # Field CalendarEvent_Live.MonthlyDayOfWeek: created as int(11) not null default '0'
    # Field CalendarEvent_Live.CalendarID: created as int(11) not null default '0'
    # Index CalendarEvent_Live.CalendarID: created as (CalendarID)
    # Table CalendarEvent_versions: created
    # Field CalendarEvent_versions.ID: created as int(11) not null auto_increment
    # Field CalendarEvent_versions.RecordID: created as int(11) not null default '0'
    # Field CalendarEvent_versions.Version: created as int(11) not null default '0'
    # Field CalendarEvent_versions.WasPublished: created as tinyint(1) unsigned not null default '0'
    # Field CalendarEvent_versions.AuthorID: created as int(11) not null default '0'
    # Field CalendarEvent_versions.PublisherID: created as int(11) not null default '0'
    # Field CalendarEvent_versions.Recursion: created as tinyint(1) unsigned not null default '0'
    # Field CalendarEvent_versions.CustomRecursionType: created as int(11) not null default '0'
    # Field CalendarEvent_versions.DailyInterval: created as int(11) not null default '0'
    # Field CalendarEvent_versions.WeeklyInterval: created as int(11) not null default '0'
    # Field CalendarEvent_versions.MonthlyInterval: created as int(11) not null default '0'
    # Field CalendarEvent_versions.MonthlyRecursionType1: created as int(11) not null default '0'
    # Field CalendarEvent_versions.MonthlyRecursionType2: created as int(11) not null default '0'
    # Field CalendarEvent_versions.MonthlyIndex: created as int(11) not null default '0'
    # Field CalendarEvent_versions.MonthlyDayOfWeek: created as int(11) not null default '0'
    # Field CalendarEvent_versions.CalendarID: created as int(11) not null default '0'
    # Index CalendarEvent_versions.RecordID_Version: created as (RecordID,Version)
    # Index CalendarEvent_versions.RecordID: created as (RecordID)
    # Index CalendarEvent_versions.Version: created as (Version)
    # Index CalendarEvent_versions.AuthorID: created as (AuthorID)
    # Index CalendarEvent_versions.PublisherID: created as (PublisherID)
    # Index CalendarEvent_versions.CalendarID: created as (CalendarID)
    # ErrorPage
    # RedirectorPage
    # VirtualPage
    # Image
    # Folder
    # Image_Cached


    [Notice] Undefined variable: alterList
    GET /SilverStripe-test1/db/build

    Line 199 in C:\wamp\www\SilverStripe-test1\sapphire\core\model\MySQLDatabase.php
    Source

    190     * @param $newIndexes New indexes, a map of index name => index type
    191     * @param $alteredFields Updated fields, a map of field name => field schema
    192     * @param $alteredIndexes Updated indexes, a map of index name => index type
    193     */
    194    public function alterTable($tableName, $newFields = null, $newIndexes = null, $alteredFields = null, $alteredIndexes = null) {
    195       $fieldSchemas = $indexSchemas = "";
    196       
    197       if($newFields) foreach($newFields as $k => $v) $alterList[] .= "ADD `$k` $v";
    198       if($newIndexes) foreach($newIndexes as $k => $v) $alterList[] .= "ADD " . $this->getIndexSqlDefinition($k, $v);
    199       if($alteredFields) foreach($alteredFields as $k => $v) $alterList[] .= "CHANGE `$k` `$k` $v";
    200       if($alteredIndexes) foreach($alteredIndexes as $k => $v) {
    201          $alterList[] .= "DROP INDEX `$k`";
    202          $alterList[] .= "ADD ". $this->getIndexSqlDefinition($k, $v);
    203       }
    204       
    205       $alterations = implode(",\n", $alterList);

    Trace

    * MySQLDatabase->alterTable(SiteTree,Array,Array,Array,Array)
    Line 163 of Database.php
    * Database->endSchemaUpdate()
    Line 197 of DatabaseAdmin.php
    * DatabaseAdmin->doBuild(,1)
    Line 100 of DatabaseAdmin.php
    * DatabaseAdmin->build(HTTPRequest)
    Line 162 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(/db/build)
    Line 118 of main.php

  • dbeaugez
    Avatar
    Community Member
    1 Post

    Re: Undefined variable: alterList Link to this post

    That just happened to me also. It looks like there's a fix already in SVN -- one line of code. Just open the module, MySQLDatabase.php, in your editor.

    Find the alterTable function and add $alterList = array(); after $fieldSchemas = $indexSchemas = "";

    That worked for me.

  • Hour6
    Avatar
    Community Member
    1 Post

    Re: Undefined variable: alterList Link to this post

    Thanks, same thing just happened to me after updating to PHP 5.3, the fix worked like a charm.

    1495 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.