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

cached data location


Go to End


8 Posts   2148 Views

Avatar
wroof

Community Member, 6 Posts

19 February 2015 at 12:04pm

Edited: 19/02/2015 3:11pm

Good afternoon all,

I have been given the job of looking after a website running on SilverStripe. I have never dealt with Silverstripe before so I have uploaded a copy of the site to play around with. It took a while but I now have it running well.

Now the problem I have is this site has a search function that allows the user to search through a large table or products and I am trying to work out how to sync this with our own central database. I decided to start by finding the query and editing it to look at a different table to make sure I was looking in the right place and that I had my head around how the query works.

the code I found did not seam to change anything on the website. I then tried changing the table name in the database itself and flush the site. The search still seams to be reading through the database no problem. As a last resort I deleted the table in the database completely. did a dev/build?flush=all and yet the site still checkes through the database no problem. The only thing I can think of is that silverstripe caches the data somewhere, so does anyone know what is going on or how I can clear it?

edit: Turns out I was running the dev/build on the wrong site! problem of having them up side by side. When I run the dev/build on the test site I get a 500 error same if I try a ?flush=all on the test site "newsite.xxxxxxxxx.com/?flush=all" gives me a flush token and redirects to a 500 internal server error

edit: So I wiped everything, did a fresh install of Silverstripe. Site installs and can do a dev/build and a flush=all no problems. overwrote the database with the backup from the main site. Can still do a build and flush. copied over all assets ect folders except the mysite folder. can do a build and flush with each copy. Copy over mysite folder and now get a 500 error on build and flush.

Avatar
martimiz

Forum Moderator, 1391 Posts

20 February 2015 at 8:03am

Just to make sure - your initial copy of the site did work on your local system you say. And now copying mysite back in gives you an error...

Are you sure you copied in the original version? Or are you trying to use the version where you made all the changes (that didn't seem to do anything because you kept flushing/building the wrong site) but might now create an error?

Avatar
wroof

Community Member, 6 Posts

23 February 2015 at 11:07am

When I first started I uploaded a zip with all of the original files. When ever I copy of the website files I make sure I unzip the original files again and take everything from there so I know none of my changes have caused a problem.

Avatar
martimiz

Forum Moderator, 1391 Posts

23 February 2015 at 10:49pm

Ok, make sure your site is in 'dev' mode, this should give you a more readable errormessage.

In your mysite/_config.php

Director::set_environment_type("dev");

Also if you have a silverstripe-cache directory in your site, empty it. If it's not there, create it. This way silverstripe wil automatically recreate the entitre cache, eliminating everything weird that might have slipped in there. (By default silverstripe uses the default tmp directory, but adding the custom silverstripe-cache directory will make it easier to manage)

Let's take it from there :)

Avatar
wroof

Community Member, 6 Posts

24 February 2015 at 11:23am

Edited: 24/02/2015 3:40pm

Ok time for me to be as detailed as I can with the steps I am going through.

The site is being moved to Godaddy's plesk hosting.

I have tried a few different ways of setting the site up and this is the way that seams to have worked the best, though it is still riddled with problems.

Set up a new sub site: newsite.amsmusicsystem.com
enable asp.net and php
import database into phpmyadmin
upload all files from website to new host
upload silverstripe
extract Silverstripe
change permissions on required files
go to site/install.php (does not always redirect automatically.)
set up site to different database
copy over Assets, Themes, Mysite.
change _config file in mySite folder to match site upload config file
Aim site to uploaded database

Config file:

<?php

global $project;
$project = 'mysite';

global $database;
$database = '';

if(!(defined('SS_DATABASE_CHOOSE_NAME') && SS_DATABASE_CHOOSE_NAME)) $database = 'ss_musicsystems';

require_once('conf/ConfigureFromEnv.php');

MySQLDatabase::set_connection_charset('utf8');

i18n::set_locale('en_NZ');
i18n::set_default_locale('en_NZ');
//Requirements::add_i18n_javascript($project . '/javascript/lang', $return=false, $langOnly=true);
LeftAndMain::require_javascript($project.'/javascript/lang/'.i18n::default_locale().'.js');
LeftAndMain::require_javascript($project.'/javascript/lang/'.i18n::get_locale().'.js');

// Set the current theme. More themes can be downloaded from
// http://www.silverstripe.org/themes/
SSViewer::set_theme('ams');

// Enable nested URLs for this site (e.g. page/sub-page/)
if(class_exists('SiteTree')) SiteTree::enable_nested_urls();

//fix spellchecking
HtmlEditorConfig::get('cms')->setOption('spellchecker_rpc_url',THIRDPARTY_DIR.'/tinymce-spellchecker/rpc.php');
HtmlEditorConfig::get('cms')->setOption('browser_spellcheck', false);

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

The site is set in dev mode at all times but I just get a 500 error when I try and build or flush the site. Sometimes I also get a 500 error when I first install the site

If the site installs I can do a build and flush no problem

If I add a silverstripe-cache folder to the root directory I can no longer load the site and flush and build fails with a 500 error. If I add the folder before I run the install I get a 500 error even when trying to access the install.php file.

Any chance I could send you the site files to have a look at Martimiz to see if there is something dumb I am missing?

Edit: Ok so I seem to have found one of the major problems. Turns out you need to change the php setting for Open_BaseDir needs to be changed to none. As soon as I did this 98% of the site started working. The problem I have now is that 3 of the pages do not have the theme. If you go to automatedmusicsystems.com.au you can see the theme working but if you go to the news, support or contact pages you drop back to the default silverstripe theme.
Any ideas?

Edit 2: I have found the problem to be with some of the pages having custom setups and needing to transfer over the folders and then doing a flush on each page. The only problem I have now is that the contact details on the bottom are not updating. They point to a class in the database and that class has the correct details in it but it will not pull it. Any ideas?

Avatar
martimiz

Forum Moderator, 1391 Posts

24 February 2015 at 10:16pm

So you solved most of your problems already - great work! Open_basedir can be a monster...l

I suppose you need asp.net for some other code? Because SilverStripe doesn't really need it... As to the templates: instead of flushing each page separately, doing a ?flush=all should work for all templates.

Hard to guess why the contact data won't update in the CMS. Where/how are they entered in the CMS, what are the fieldnames and what does the template look like?

Avatar
wroof

Community Member, 6 Posts

25 February 2015 at 11:26am

Edited: 25/02/2015 12:38pm

Yea I have managed to work out a lot of how it works and what was going wrong.

Flush all makes the job a lot easier :) Do not know why I didn't do that yesterday. Must have been a dead brain moment.

The contact data is loaded in the theme using

<p><span>Ph:</span> $SiteConfig.Phone</p>
                    <p><span>E:</span> <a href="mailto:$SiteConfig.Email?subject=Web%20Enquiry" class="noPadding" target="_blank">$SiteConfig.Email</a></p>
                    <p><span>Post:</span> $SiteConfig.Address</p>

and then in the database we have a table called siteConfig with a entry with classname SiteConfig and address etc.
I have attached the whole file encase there is something else in the file that might point in the right direction (it is a ss file but changed to a txt so I can upload it)

edit: So the site that was using this folder before had some asp elements to it but this one does not. I removed it and then wiped everything and reloaded the site. a build?flush=all followed by a second flush=all and the site is working correctly :) just goes to show sometimes you have to flush twice to get rid of all the crap!

Last job to do is to work out how to update the music database behind the site without any down time. And yes every entry in the database can be changed in one go so a UID won't work.

Attached Files
Avatar
martimiz

Forum Moderator, 1391 Posts

25 February 2015 at 10:21pm

So, after your edit, the footer is updated correctly now? Because I see no reason why it shouldn't - unless the SiteConfig extension class, where those database fields are probably defined, isn't registered or doesn't exist anymore...

About the music database - I can't quite follow... But I'm positive you'll get there :)