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.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

General Questions /

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

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

Admin sticking when I click on Files


Go to End


7 Posts   2158 Views

Avatar
jimbeeer

Community Member, 4 Posts

29 November 2013 at 1:26am

Edited: 29/11/2013 2:49am

I'm in the admin on v3.1.

I can navigate around any of the back-end, until I click on Files on the left, then the whole admin sticks and I have to manually delete the 'assets' from the address and refresh the page. I've set the assets folder to 777 but that doesn't seem to have made much difference.

Anyone know why this is happening?

Also when I click on 'Upload Image' it just shows 'There has been an error'. I can only suspect the two issues are related.

-James

Avatar
swaiba

Forum Moderator, 1899 Posts

30 November 2013 at 5:45am

Hi James,

My initial advice would be to log errors... e.g.

SS_Log::add_writer(new SS_LogFileWriter(BASE_PATH . DIRECTORY_SEPARATOR .'logs'. DIRECTORY_SEPARATOR . 'ss_error.log'), SS_Log::WARN, '<=');

...and check them!

Secondly I assume you are in dev mode already? with error report "on"?

Director::set_environment_type('dev');
ini_set('display_errors', 1);error_reporting(E_ALL & ~E_STRICT);
(in _config.php)

Avatar
jimbeeer

Community Member, 4 Posts

2 December 2013 at 5:41am

Thanks, I didn't know about any of this.

Here's my error:

[01-Dec-2013 16:38:01] Error at framework/model/MySQLDatabase.php line 592: Couldn't run query:
SELECT DISTINCT "File"."ClassName", "File"."Created", "File"."LastEdited", "File"."Name", "File"."Title", "File"."Filename", "File"."Content", "File"."ShowInSearch", "File"."ParentID", "File"."OwnerID", "File"."ID", CASE WHEN "File"."ClassName" IS NOT NULL THEN "File"."ClassName" ELSE 'File' END AS "RecordClassName"
FROM "File"
WHERE ("ParentID" = 0) AND ("File"."ClassName" IN ('Folder'))
ORDER BY "File"."Name" ASC

Unknown column 'File.ShowInSearch' in 'field list' (http://prioryschool.com/admin/assets/)

I've recently upgraded from 2.4 to 3.1 but I haven't done anything to the database. Do I have to upgrade it or something?

Apologies for my ignorance.

Avatar
quamsta

Community Member, 29 Posts

2 December 2013 at 11:58am

And you've run /dev/build since upgrading? Even if so, try running it again. The ShowInSearch column should have been available even in SilverStripe 2.4.x.

Avatar
jimbeeer

Community Member, 4 Posts

2 December 2013 at 10:26pm

I hadn't been. But I am now. Here's the error screen I get when I try to refresh the files page:

[User Error] Couldn't run query: SELECT DISTINCT "File"."ClassName", "File"."Created", "File"."LastEdited", "File"."Name", "File"."Title", "File"."Filename", "File"."Content", "File"."ShowInSearch", "File"."ParentID", "File"."OwnerID", "File"."ID", CASE WHEN "File"."ClassName" IS NOT NULL THEN "File"."ClassName" ELSE 'File' END AS "RecordClassName" FROM "File" WHERE ("ParentID" = 0) AND ("File"."ClassName" IN ('Folder')) ORDER BY "File"."Name" ASC Unknown column 'File.ShowInSearch' in 'field list'
GET /admin/assets/

Line 592 in /home/priorysc/public_html/framework/model/MySQLDatabase.php

------------------------------------------

Source

583 }
584
585 public function databaseError($msg, $errorLevel = E_USER_ERROR) {
586 // try to extract and format query
587 if(preg_match('/Couldn\'t run query: ([^\|]*)\|\s*(.*)/', $msg, $matches)) {
588 $formatter = new SQLFormatter();
589 $msg = "Couldn't run query: \n" . $formatter->formatPlain($matches[1]) . "\n\n" . $matches[2];
590 }
591
592 user_error($msg, $errorLevel);
593 }
594
595 /**
596 * Return a boolean type-formatted string
597 *
598 * @param array $values Contains a tokenised list of info about this data type
Trace

Couldn't run query: SELECT DISTINCT "File"."ClassName", "File"."Created", "File"."LastEdited", "File"."Name", "File"."Title", "File"."Filename", "File"."Content", "File"."ShowInSearch", "File"."ParentID", "File"."OwnerID", "File"."ID", CASE WHEN "File"."ClassName" IS NOT NULL THEN "File"."ClassName" ELSE 'File' END AS "RecordClassName" FROM "File" WHERE ("ParentID" = 0) AND ("File"."ClassName" IN ('Folder')) ORDER BY "File"."Name" ASC Unknown column 'File.ShowInSearch' in 'field list'
MySQLDatabase.php:592
MySQLDatabase->databaseError(Couldn't run query: SELECT DISTINCT "File"."ClassName", "File"."Created", "File"."LastEdited", "File"."Name", "File"."Title", "File"."Filename", "File"."Content", "File"."ShowInSearch", "File"."ParentID", "File"."OwnerID", "File"."ID", CASE WHEN "File"."ClassName" IS NOT NULL THEN "File"."ClassName" ELSE 'File' END AS "RecordClassName" FROM "File" WHERE ("ParentID" = 0) AND ("File"."ClassName" IN ('Folder')) ORDER BY "File"."Name" ASC | Unknown column 'File.ShowInSearch' in 'field list',256)
MySQLDatabase.php:144
MySQLDatabase->query(SELECT DISTINCT "File"."ClassName", "File"."Created", "File"."LastEdited", "File"."Name", "File"."Title", "File"."Filename", "File"."Content", "File"."ShowInSearch", "File"."ParentID", "File"."OwnerID", "File"."ID", CASE WHEN "File"."ClassName" IS NOT NULL THEN "File"."ClassName" ELSE 'File' END AS "RecordClassName" FROM "File" WHERE ("ParentID" = 0) AND ("File"."ClassName" IN ('Folder')) ORDER BY "File"."Name" ASC,256)
DB.php:200
DB::query(SELECT DISTINCT "File"."ClassName", "File"."Created", "File"."LastEdited", "File"."Name", "File"."Title", "File"."Filename", "File"."Content", "File"."ShowInSearch", "File"."ParentID", "File"."OwnerID", "File"."ID", CASE WHEN "File"."ClassName" IS NOT NULL THEN "File"."ClassName" ELSE 'File' END AS "RecordClassName" FROM "File" WHERE ("ParentID" = 0) AND ("File"."ClassName" IN ('Folder')) ORDER BY "File"."Name" ASC,256)
SQLQuery.php:945
SQLQuery->execute()

Avatar
Mr. Neave

Community Member, 23 Posts

4 January 2015 at 1:33pm

Bump!

the same error is happening on a site that I’m trying to upgrade from 2.4 to 3.1.8.

In this case it looks to be caused by referencing images in the .ss templates, though I’m not sure why.

Commenting out references to images in the template files, like these, prevents the error from happening:
$Thumbnail.SetWidth(1200)
$Image.SetWidth(1200)

I’m partway through the upgrade process and have replaced the sapphire and cms directories, removed the DataObjectManager module and references to it, and now the front end of the site appears to work OK apart from this issue.

Any clues?

Avatar
Mr. Neave

Community Member, 23 Posts

4 January 2015 at 1:42pm

Fixed this by changing static methods to private static methods in custom page classes as per this documentation: http://doc.silverstripe.org/framework/en/changelogs/3.1.0#upgrading