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

Synchronizing FTP Files and Images in the Folder /asset


Reply

6 Posts   1896 Views

Avatar
davidm2010

15 March 2011 at 9:51am Community Member, 107 Posts

For those who FTP files to your asset folder or change its strucutre, here is a tip for you. Maybe you know, but I didn't and just about destroyed my site database.

Go to http://www.mysite.com/dev

There you get a selection of all of the utilities that are at your disposal. Very important and useful.

Here is the dev utility list:

•/dev/build: Build/rebuild this environment. Call this whenever you have updated your project sources
•/dev/buildcache: Rebuild the static cache, if you're using StaticPublisher
•/dev/tests: See a list of unit tests to run
•/dev/tests/all: Run all tests
•/dev/tests/startsession: Start a test session in your browser (gives you a temporary database with default content)
•/dev/tests/endsession: Ends a test session
•/dev/jstests: See a list of JavaScript tests to run
•/dev/jstests/all: Run all JavaScript tests
•/dev/tasks: See a list of build tasks to run
•/dev/viewcode: Read source code in a literate programming style

Select the /dev/tasks link. Here you get:

•Sync Files & Images assets
The Files & Images system in SilverStripe maintains its own database of the contents of the assets/ folder. This action will update that database, and should be called whenever files are added to the assets/ folder from outside SilverStripe, for example, if an author uploads files via FTP.
•Forum Database Migration
Upgrades your 0.2 forum version to the 0.3 structure
•i18n Textcollector Task
Traverses through files in order to collect the 'entity master tables' stored in each module.
•Database Migrations
Provide atomic database changes (not implemented yet)
•Flush Generated Images Task
Remove all cached/generated images created as the result of an image manipulation
•Encrypt all passwords tasks
Convert all plaintext passwords on the Member table to the default encryption/hashing algorithm. Note: This mainly applies to passwords in SilverStripe 2.1 or earlier, passwords in newer versions are hashed by default.
•Migrate SiteTree Linking Task
Rewrites plain internal HTML links into shortcode form, using existing link tracking information.
•Migrate Translatable Task
Migrates site translations from SilverStripe 2.1/2.2 to new database structure.
•Upgrade SiteTree Permissions Schema
Move data from legacy columns to new schema introduced in SilverStripe 2.1.
SiteTree->Viewers to SiteTree->CanViewType
SiteTree->Editors to SiteTree->CanEditType
SiteTree->ViewersGroup to SiteTree->ViewerGroups (has_one to many_many)
SiteTree->Editorsroup to SiteTree->EditorGroups (has_one to many_many)
See http://open.silverstripe.com/ticket/2847
•UserForms Database Migration
Upgrades your current forms to the latest structure
•UserForms Versioned Initial Migration
Publishes the existing forms

If you pick the first one, it will reindex all of your asset files and make SS behave correctly.

I hope this helps someone avert heartache and disaster.

DM

Avatar
Willr

15 March 2011 at 9:38pm Forum Moderator, 5511 Posts

Pretty sure this is the same task that is run by clicking the 'Look for new files' button in the assets section in the CMS. Slightly easier to find!

Avatar
davidm2010

15 March 2011 at 11:59pm Community Member, 107 Posts

Assuming you can get to it. I was not able to open up the File and Images section. This I was able to do to get it corrected.

Avatar
Stef87

28 October 2012 at 10:48am Community Member, 66 Posts

I'm desperately looking for the way to call this from one of my CMS pages as I am adding images programmatically. Can anyone help me out?

Thanks

Avatar
simon_w

28 October 2012 at 11:34am Forum Moderator, 474 Posts

Filesystem::sync();

Avatar
Stef87

28 October 2012 at 12:04pm Community Member, 66 Posts

Enormous thanks. You've saved me. :)