ryancramerdesign / ProcessWire

Our repository has moved to https://github.com/processwire – please head there for the latest version.
https://processwire.com
Other
727 stars 199 forks source link

Database error adding a new language #957

Closed verdeandrea closed 9 years ago

verdeandrea commented 9 years ago

Adding a new language i have this error

Error: Exception: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'pages.name1020' in 'where clause' (in /Users/andrea/Dropbox/Sites/htdocs/pw/wire/core/PageFinder.php line 292)

#0 [internal function]: PageFinder->___find(Object(Selectors), Array)
#1 /Users/andrea/Dropbox/Sites/htdocs/pw/wire/core/Wire.php(365): call_user_func_array(Array, Array)
#2 /Users/andrea/Dropbox/Sites/htdocs/pw/wire/core/Wire.php(320): Wire->runHooks('find', Array)
#3 /Users/andrea/Dropbox/Sites/htdocs/pw/wire/core/Pages.php(199): Wire->__call('find', Array)
#4 /Users/andrea/Dropbox/Sites/htdocs/pw/wire/core/Pages.php(199): PageFinder->find(Object(Selectors), Array)
#5 [internal function]: Pages->___find('path=/admin/set...', Array)
#6 /Users/andrea/Dropbox/Sites/htdocs/pw/wire/core/Wire.php(365): call_user_func_array(Array, Array)
#7 /Users/andrea/Dropbox/Sites/htdocs/pw/wire/core/Wire.php(320): Wire->runHooks('find', Array)
#8 /Users/andrea/Dropbox/Sites/htdocs/pw/wire/core/Pages.php(299): Wire->__call('find', Array)
#9 /Users/and
This error message was shown because you are logged in as a Superuser. Error has been logged.

and I can't access to the admin page anymore

adrianbj commented 9 years ago

This has come up before with some MySQL server settings. I'll let Ryan come back with a solution, but in the meantime, you can get things working again by simply creating a new field (column) in the pages database table called "name1020".

ryancramerdesign commented 9 years ago

This one was fixed awhile ago, unless this is something different (though the error message is the same). What version of ProcessWire?

brightdroid commented 9 years ago

Same problem with dev branch @84be3e4

Error: Exception: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'pages.name1025' in 'where clause' (in processwire/wire/core/PageFinder.php line 292)

#0 [internal function]: PageFinder->___find(Object(Selectors), Array)
#1 processwire/wire/core/Wire.php(366): call_user_func_array(Array, Array)
#2 processwire/wire/core/Wire.php(321): Wire->runHooks('find', Array)
#3 processwire/wire/core/Pages.php(199): Wire->__call('find', Array)
#4 processwire/wire/core/Pages.php(199): PageFinder->find(Object(Selectors), Array)
#5 [internal function]: Pages->___find('path=/admin/, s...', Array)
#6 processwire/wire/core/Wire.php(366): call_user_func_array(Array, Array)
#7 processwire/wire/core/Wire.php(321): Wire->runHooks('find', Array)
#8 processwire/wire/core/Pages.php(299): Wire->__call('find', Array)
#9 processwire/wire/core/Pages.p
This error message was shown because you are logged in as a Superuser. Error has been logged.
ryancramerdesign commented 9 years ago

What version of MySQL are you running? Thanks.

ryancramerdesign commented 9 years ago

This one was already fixed awhile back, I assumed it was a report for an older version of PW. But since you mention it occurring on the latest commit, it sounds like maybe there is a new/different issue. The first set in tracking it down is for me to be able to duplicate it. Since I know your PW version, I'd next need to know MySQL version (and possibly PHP version).

ryancramerdesign commented 9 years ago

@brightdroid I'm wondering if you could also check your /site/assets/errors.txt to see if there are any database errors that occurred about the time you added the language? If you find something, please paste in here. Thanks.

brightdroid commented 9 years ago

I'm using the MySQL 5.5.41-0ubuntu0.14.10.1 The error.log contains this after adding a new language:

2015-03-13 13:43:16     admin   http://.../processwire/admin/setup/languages/        Error:  Exception: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'field_title.data1026' in 'field list' (in processwire/wire/core/DatabaseQuery.php line 106)  #0 processwire/wire/core/Pages.php(518): DatabaseQuery->execute() #1 processwire/wire/modules/Fieldtype/FieldtypePage.module(170): Pages->getById(Array, NULL) #2 [internal function]: FieldtypePage->___wakeupValue(Object(User), Object(Field), Array) #3 processwire/wire/core/Wire.php(366): call_user_func_array(Array, Array) #4 processwire/wire/core/Wire.php(321): Wire->runHooks('wakeupValue', Array) #5 processwire/wire/core/Page.php(831): Wire->__call('wakeupValue', Array) #6 processwire/wire/core/Page.php(831): FieldtypePage->wakeupValue(Object(User), Object(Field), Array) #7 processwire/wire/core/User.php(332): Page->getFieldValue('language') #8 processwire/wire/core
ryancramerdesign commented 9 years ago

Thanks. Would it be possible for me to see your full /site/assets/errors.txt log? If so, please email to ryan@rc-d.net and I'll see what I can find.

On Fri, Mar 13, 2015 at 8:45 AM, Christoph Roeder notifications@github.com wrote:

I'm using the MySQL 5.5.41-0ubuntu0.14.10.1 The error.log contains this after adding a new language:

2015-03-13 13:43:16 admin http://.../processwire/admin/setup/languages/ Error: Exception: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'field_title.data1026' in 'field list' (in processwire/wire/core/DatabaseQuery.php line 106) #0 processwire/wire/core/Pages.php(518): DatabaseQuery->execute() #1 processwire/wire/modules/Fieldtype/FieldtypePage.module(170): Pages->getById(Array, NULL) #2 [internal function]: FieldtypePage->_wakeupValue(Object(User), Object(Field), Array) #3 processwire/wire/core/Wire.php(366): call_user_func_array(Array, Array) #4 processwire/wire/core/Wire.php(321): Wire->runHooks('wakeupValue', Array) #5 processwire/wire/core/Page.php(831): Wire->call('wakeupValue', Array) #6 processwire/wire/core/Page.php(831): FieldtypePage->wakeupValue(Object(User), Object(Field), Array) #7 processwire/wire/core/User.php(332): Page->getFieldValue('language') #8 processwire/wire/core

— Reply to this email directly or view it on GitHub https://github.com/ryancramerdesign/ProcessWire/issues/957#issuecomment-78955447 .

brightdroid commented 9 years ago

There's just one more line when I access the admin:

2015-03-13 14:23:34     admin   http://.../?/        Error:  Exception: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'pages.name1027' in 'where clause' (in processwire/wire/core/PageFinder.php line 292)  #0 [internal function]: PageFinder->___find(Object(Selectors), Array) #1 processwire/wire/core/Wire.php(366): call_user_func_array(Array, Array) #2 processwire/wire/core/Wire.php(321): Wire->runHooks('find', Array) #3 processwire/wire/core/Pages.php(199): Wire->__call('find', Array) #4 processwire/wire/core/Pages.php(199): PageFinder->find(Object(Selectors), Array) #5 [internal function]: Pages->___find('path=/admin/, s...', Array) #6 processwire/wire/core/Wire.php(366): call_user_func_array(Array, Array) #7 processwire/wire/core/Wire.php(321): Wire->runHooks('find', Array) #8 processwire/wire/core/Pages.php(299): Wire->__call('find', Array) #9 processwire/wire/core/Pages.p

PS: the id is different, cause I had deleted the wrong page-entry and had to add a new language

ryancramerdesign commented 9 years ago

The column not found errors are just a symptom not the source. They will continue to appear. What we're looking for actually is an error indicating something about a failed "alter table" statement.

brightdroid commented 9 years ago

Mhh, tried again with $config->debug = true;, but still nothing more than this message:

Fatal error: Exception: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'field_title.data1028' in 'field list' (in processwire/wire/core/DatabaseQuery.php line 106) #0 processwire/wire/core/Pages.php(518): DatabaseQuery->execute() #1 processwire/wire/modules/Fieldtype/FieldtypePage.module(170): Pages->getById(Array, NULL) #2 [internal function]: FieldtypePage->___wakeupValue(Object(User), Object(Field), Array) #3 processwire/wire/core/Wire.php(366): call_user_func_array(Array, Array) #4 processwire/wire/core/Wire.php(321): Wire->runHooks('wakeupValue', Array) #5 processwire/wire/core/Page.php(831): Wire->__call('wakeupValue', Array) #6 processwire/wire/core/Page.php(831): FieldtypePage->wakeupValue(Object(User), Object(Field), Array) #7 processwire/wire/core/User.php(332): Page->getFieldValue('language') #8 processwire/wire/core in processwire/index.php on line 252

Anything else I can do to research the issue?

ryancramerdesign commented 9 years ago

I don't think there's anything we can tell from now unless you can find the original source of it in your logs. The "column not found" messages don't mean anything other than that there's a missing column in the DB table, but we need to track down why. Presumably the reason why would be in the /site/assets/logs/errors.txt file, but I can't say for certain what it would say since I don't know what the error is. But it would likely be the first error mentioning either pages.name1025, pages.status1025 or field_title.data1025. If it says anything about "column not found" that's not the error we'd be looking for.

ryancramerdesign commented 9 years ago

I've gone ahead and made some changes to anticipate the error. I don't think it corrects whatever was causing it in the first place. But without the ability to reproduce it, I think the best I can do is to just put in code that looks for and attempts to correct the error. It does this by adding backup methods of making sure the column got created and refreshing internal caches of languages.

brightdroid commented 9 years ago

Here are the logs from bb82a76

PHP error.log:

[13-Mar-2015 20:50:13 Europe/Berlin] PHP Fatal error:  Exception: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'field_title.data1020' in 'field list' (in processwire/wire/core/DatabaseQuery.php line 106)

#0 processwire/wire/core/Pages.php(518): DatabaseQuery->execute()
#1 processwire/wire/modules/Fieldtype/FieldtypePage.module(170): Pages->getById(Array, NULL)
#2 [internal function]: FieldtypePage->___wakeupValue(Object(User), Object(Field), Array)
#3 processwire/wire/core/Wire.php(366): call_user_func_array(Array, Array)
#4 processwire/wire/core/Wire.php(321): Wire->runHooks('wakeupValue', Array)
#5 processwire/wire/core/Page.php(831): Wire->__call('wakeupValue', Array)
#6 processwire/wire/core/Page.php(831): FieldtypePage->wakeupValue(Object(User), Object(Field), Array)
#7 processwire/wire/core/User.php(332): Page->getFieldValue('language')
#8 processwire/wire/core/Page.php(693): User->getFieldValue('language in processwire/index.php on line 252
[13-Mar-2015 20:51:12 Europe/Berlin] PHP Fatal error:  Exception: Unknown column 'pages.name1020' in 'where clause' - SQLSTATE[42S22]: Column not found: 1054 Unknown column 'pages.name1020' in 'where clause' (in processwire/wire/core/PageFinder.php line 300)

#0 [internal function]: PageFinder->___find(Object(Selectors), Array)
#1 processwire/wire/core/Wire.php(366): call_user_func_array(Array, Array)
#2 processwire/wire/core/Wire.php(321): Wire->runHooks('find', Array)
#3 processwire/wire/core/Pages.php(199): Wire->__call('find', Array)
#4 processwire/wire/core/Pages.php(199): PageFinder->find(Object(Selectors), Array)
#5 [internal function]: Pages->___find('path=/admin/, s...', Array)
#6 processwire/wire/core/Wire.php(366): call_user_func_array(Array, Array)
#7 processwire/wire/core/Wire.php(321): Wire->runHooks('find', Array)
#8 processwire/wire/core/Pages.php(299): Wire->__call('find', Array)
#9 processwire/wire/core/ in processwire/index.php on line 252

Processwire error.log:

2015-03-13 20:50:13 admin   http://chris/processwire/admin/setup/languages/ Error:  Exception: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'field_title.data1020' in 'field list' (in processwire/wire/core/DatabaseQuery.php line 106)  #0 processwire/wire/core/Pages.php(518): DatabaseQuery->execute() #1 processwire/wire/modules/Fieldtype/FieldtypePage.module(170): Pages->getById(Array, NULL) #2 [internal function]: FieldtypePage->___wakeupValue(Object(User), Object(Field), Array) #3 processwire/wire/core/Wire.php(366): call_user_func_array(Array, Array) #4 processwire/wire/core/Wire.php(321): Wire->runHooks('wakeupValue', Array) #5 processwire/wire/core/Page.php(831): Wire->__call('wakeupValue', Array) #6 processwire/wire/core/Page.php(831): FieldtypePage->wakeupValue(Object(User), Object(Field), Array) #7 processwire/wire/core/User.php(332): Page->getFieldValue('language') #8 processwire/wire/core/Page.php(693): User->getFieldValue('language
2015-03-13 20:51:12 admin   http://chris/?/ Error:  Exception: Unknown column 'pages.name1020' in 'where clause' - SQLSTATE[42S22]: Column not found: 1054 Unknown column 'pages.name1020' in 'where clause' (in processwire/wire/core/PageFinder.php line 300)  #0 [internal function]: PageFinder->___find(Object(Selectors), Array) #1 processwire/wire/core/Wire.php(366): call_user_func_array(Array, Array) #2 processwire/wire/core/Wire.php(321): Wire->runHooks('find', Array) #3 processwire/wire/core/Pages.php(199): Wire->__call('find', Array) #4 processwire/wire/core/Pages.php(199): PageFinder->find(Object(Selectors), Array) #5 [internal function]: Pages->___find('path=/admin/, s...', Array) #6 processwire/wire/core/Wire.php(366): call_user_func_array(Array, Array) #7 processwire/wire/core/Wire.php(321): Wire->runHooks('find', Array) #8 processwire/wire/core/Pages.php(299): Wire->__call('find', Array) #9 processwire/wire/core/
brightdroid commented 9 years ago

I think the problem has to do with not calling fieldLanguageAdded / ___fieldLanguageAdded (wire/modules/LanguageSupport/LanguageSupportFields.module) to add the new columns.

phlppschrr commented 9 years ago

I have the same problem. Fresh install of latest dev (2.5.25) with multilanguage profile. I am running the site in my local MAMP environment with PHP 5.6.6 and mySQL 5.5.42.

EDIT START: Edit: It is the same with PHP 5.5.22 Edit 2: Creating an new language in the latest stable version works fine. Edit 3: creating the language works fine in 2.5.16 dev. I see the error since 2.5.17 dev Edit 4: Disabeling the ___updated method in /wire/modules/LanguageSupport/Languages.php seeems to fix this issue. At least I can create the new language without problems. Let's see if any other problems appear:

public function ___updated(Page $language, $what) {
//      $this->reloadLanguages();
//      $this->message("Updated language $language->name ($what)", Notice::debug); 
    }

EDIT END

After trying to create a new language I see a blank page. After reloading a get this error message:

language fr is missing column pages.name1020
Error: Exception: Unknown column 'pages.name1020' in 'where clause' - SQLSTATE[42S22]: Column not found: 1054 Unknown column 'pages.name1020' in 'where clause' (in /XXX/wire/core/PageFinder.php line 300)

#0 [internal function]: PageFinder->___find(Object(Selectors), Array)
#1 /XXX/wire/core/Wire.php(366): call_user_func_array(Array, Array)
#2 /XXX/wire/core/Wire.php(321): Wire->runHooks('find', Array)
#3 /XXX/wire/core/Pages.php(199): Wire->__call('find', Array)
#4 /XXX/wire/core/Pages.php(199): PageFinder->find(Object(Selectors), Array)
#5 [internal function]: Pages->___find('path=/cms/setup...', Array)
#6 /XXX/wire/core/Wire.php(366): call_user_func_array(Array, Array)
#7 /XXX/wire/core/Wire.php(321): Wire->runHooks('find', Array)

This error message was shown because you are logged in as a Superuser. Error has been logged.

in my errors.txt logfile I have only this:

2015-04-07 12:21:31 philipp http://xxx.dev/cms/setup/languages/ Error:  Exception: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'field_title.data1020' in 'field list' (in /XXX/wire/core/DatabaseQuery.php line 106)  #0 /XXX/wire/core/Pages.php(518): DatabaseQuery->execute() #1 /XXX/wire/modules/Fieldtype/FieldtypePage.module(170): Pages->getById(Array, NULL) #2 [internal function]: FieldtypePage->___wakeupValue(Object(User), Object(Field), Array) #3 /XXX/wire/core/Wire.php(366): call_user_func_array(Array, Array) #4 /XXX/wire/core/Wire.php(321): Wire->runHooks('wakeupValue', Array) #5 /XXX/wire/core/Page.php(831): Wire->__call('wakeupValue', Array) #6 /XXX/wire/core/Page.php(831): FieldtypePage->wakeupValue(Object(User), Object(Field), Array) #7 /XXX
2015-04-07 12:21:44 philipp http://xxx.dev/?/   Error:  Exception: Unknown column 'pages.name1020' in 'where clause' - SQLSTATE[42S22]: Column not found: 1054 Unknown column 'pages.name1020' in 'where clause' (in /XXX/wire/core/PageFinder.php line 300)  #0 [internal function]: PageFinder->___find(Object(Selectors), Array) #1 /XXX/wire/core/Wire.php(366): call_user_func_array(Array, Array) #2 /XXX/wire/core/Wire.php(321): Wire->runHooks('find', Array) #3 /XXX/wire/core/Pages.php(199): Wire->__call('find', Array) #4 /XXX/wire/core/Pages.php(199): PageFinder->find(Object(Selectors), Array) #5 [internal function]: Pages->___find('path=/cms/setup...', Array) #6 /XXX/wire/core/Wire.php(366): call_user_func_array(Array, Array) #7 /XXX/wire/core/Wire.php(321): Wire->runHooks('find', Array)
isellsoap commented 9 years ago

@verdeandrea Has this issue been fixed? If yes it would be cool if you’d close it. Thanks, it’s much appreciated!

verdeandrea commented 9 years ago

@isellsoap You are welcome