sitecore publish item from web to master - sitecore

I am working with Sitecore Intranet Portal. I am using web database for CD.
If a user change his email Id. How would I publish this to master database.
I am using this code to publish item from web to master db.
// The publishOptions determine the source and target database,
// the publish mode and language, and the publish date
var publishOptions =
new PublishOptions(Database.GetDatabase("web"), Database.GetDatabase("master"),
PublishMode.SingleItem,
item.Language,
DateTime.Now);
var publisher = new Publisher(publishOptions);
// Choose where to publish from
publisher.Options.RootItem = item;
// Publish children as well?
publisher.Options.Deep = true;
// Do the publish!
publisher.Publish();
It would be nice to know the correct procedure.

To publish from web to master is a bad practice.
This kind of content is named User Generated Content. I suggested to use this approach :
https://sitecore.unic.com/2015/07/16/user-generated-content-in-a-security-hardened-environment
Or you can use webservices. This allows all content (even user-generated) to be authored in your CM instance. This allows you to leverage the capabilities of the platform for workflow, publishing, etc.

Either use an external database or use Sitecore users for a certain domain and store everything in the core database. The core database is commonly shared between all environments

You can make use of package to transfer your item from web to master. You can follow the following steps:
Create your item package from web.
Use the tool that i have developed to convert the destination of the items. That is, change from web to master. The tool is found on marketplace at Sitecore package modifier.
Install the modified package on the master database.
Another solution is to have a schedule job that create the package from web, modified it and install it on the master database. This hence require no manual intervention.
I prefer to use this method than the sitecore transfer method because the transfer method tends to timeout or cause an error if there are lots of items to transfer.

The best practice to store the user information in the Core database. Sitecore is using ASP.NET membership to manage the user accounts. I recommend you to store all the user info in the core DB.
Sitecore doesn't provide any option to publish data from web to master, however, it has provides you an option to transfer data from web DB to master DB.
Check out my blog Transfer Items from Web to Master Database for complete details on transferring the data from one DB to another DB
Step 1: Login to Sitecore desktop mode.
Step 2: Select the source database from where you need to transfer the items. If you want to transfer from Web to Master then select Web Database in the right-hand bottom corner.
Step 3: Open the content editor and select the item which you would like to transfer.
Step 4: Right click on the Item and select Copying>>Transfer and click on the transfer button
Step 5: In the Transfer window verify if the source item is selected properly or not.
Step 6: Click on Next to continue. In this window first thing is to select the destination database to which you need to transfer. The second thing is to select the parent item or the destination folder where you need to place this item. In my case, I need to select Layout because sublayouts are present in the layouts item.
Step 7: Click on next, here you will get an option which says include subitems. Select the checkbox if you need to restore the subitems also else uncheck the box to transfer only the selected item.
Step 8: Click on transfer button and it will start the transfer process. Close the dialog box once the transfer is completed.

Related

Attach multiple query tabs in BigQuery to the same BQ Session

I cannot find a way to do this in the UI: I'd like to have distinct query tabs in the BigQuery's UI attached to the same session (i.e. so they share the same ##session_id and _SESSION variables). For example, I'd like to create a temporary table (session-scoped) in one tab, then in a separate query tab be able to refer to that temp table.
As far as I can tell, when I put a query tab in Session Mode, it always creates a new session, which is precisely what I don't want :-\
Is this doable in BQ's UI?
There is 3rd party IDE for BigQuery supporting such a feature (namely: joining Tab(s) into existing session)
This is Goliath - part of Potens.io Suite available at Marketplace.
Let's see how it works there:
Step 1 - create Tab with new session and run some query to actually initiate session
Step 2 - create new Tab(s) and join to existing session (either using session_id or just simply respective Tab Name
So, now both Tabs(Tab 2 and Tab 3) share same session with all expected perks
You can add as many Tabs to that session as you want to comfortably organize your workspace
And, as you can see Tabs that belong to same session are colored in user defined color so easy to navigate between them
Note: Another tool in this suite is Magnus - Workflow Automator. Supports all BigQuery, Cloud Storage and most of Google APIs as well as multiple simple utility type Tasks like BigQuery Task, Export to Storage Task, Loop Task and many many more along with advanced scheduling, triggering, etc. Supports GitHub as a source control as well
Disclosure: I am GDE for Google Cloud and creator of those tools and leader on Potens team

Semantic-UI-React Dropdown Selected Index

I am trying to set a default selected item in a semantic-ui-react dropdown. If I select an item from the dropdown, when I reopen the dropdown it opens on the correct item. However, this item is persisted, and when I refresh the page, the correct items are displayed on the dropdown, but it does not open on the correct item.
Please advise.
Matt, it sounds like you are only using the internal component state. Whatever your components initialize with, they will always start that same way. Your entire React application works this way. If you are expecting your data to be persistent, it needs to be stored somewhere. When you refresh you are starting over again. If the state of your application is not being put elsewhere, you lose that state every single time you refresh because the only copy of state is in your client browser.
Basically you currently only have a frontend application that is not storing data anywhere. Depending on your needs, you could do this in a lot of different ways. A REST API. A GraphQL API. One simple way to accomplish this if you are just creating a simple website would be to use a headless CMS. That will give you a database to store your application data. There are a lot of interesting ones out there that you can explore based on your needs.

Sitecore Publishing Problems and determining item state

Can anyone explain to me what state the data should be in for a healthy sitecore instance in each database?
for example:
We currently have an issue with publishing in a 2 server setup.
Our staging server hosts the SQL instance and the authoring / staging instance of sitecore.
We then have a second server to host just the production website for our corp site.
When I look in the master database the PublishQueue table is full of entries and the same table in the web database is empty.
Is this correct?
No amount of hitting publish buttons is changing that at the moment.
How do I determine what the state of an item is in both staging and production environments without having to write an application on top of the sitecore API which I really don't have time for?
This is a normal behavior for the Publish Queue of the Web Database to be blank. The reason is because changes are made on the Master database which will add an entry in the Publish Queue.
After publishing, the item will not be removed from the Publish Queue table. It is the job of the CleanupPublishQueue to cleanup the publish queue table.
In general, tables WILL be different between the two databases as they are used for different purposes. Your master database is generally connected to by authors and the publishing logic, while the web database is generally used as a holding place for the latest published version of content that should be visible.
In terms of debugging publishing, from the Sitecore desktop, you can swap between 'master' and 'web' databases in the lower right corner and use the Content Editor to examine any individual item. This is useful for spot checking individual items have been published successfully.
If an item is missing from 'web', or the wrong version is in 'web', you should examine the following:
Publishing Restrictions on the item: Is there a restriction applied to the item or version that prevents it from publishing at this time?
Workflow state: Is the item/version in the final approved workflow state? You can use the workbox to do a quick check for items needing approval.
Connection strings: Is your staging system connection strings setup to connect to the correct 'web' used by the production delivery server?
The Database table [PublishQueue] is a table where all save and other mutations are stored. This table is used by a Incremental Publish. Sitecore get all the items from the PublishQueue table that were modified more recently than the last incremental publish date. The PublishQueue tabel is not used by a full publish
So it is okay that this Table contain a lot of records on the Master. The web database has the same database scheme. (not the same data, web contain only one version of a item, optimize for performance) The PublishQueue on the web is Empty this is normal.
To Know the state of an item compair the master version with the web version, there can be more than 1 webdatabase, The master database do not know the state/version of the web database

SharePoint 2013 Admin Content DB is corrupted - Recover/Fix options?

After recovering from a recent hardware failure on our SharePoint server (single server farm), all the SQL DBs were in suspect mode, to change the mode back to normal, we ran the consistency checks on all DBs and successfully changed back to normal mode. However, one particular database i.e. SharePoint_AdminContent_ is still causing SQL crashes with messages like:
The Database ID 6, Page (1:11812), slot 22 for LOB data type node does not exist. This is usually caused by transactions that can read uncommitted data on a data page. Run DBCC CHECKTABLE.
dbcc checkdb with REPAIR_ALLOW_DATA_LOSS fails and does not complete successfully.
I have set the DB to single user mode for now, the central admin works when I set to multi user mode but the SQL logs very quickly fill up the hard drive with crash dumps. I suspect that the hardware failure has caused some serious damage to the DB which cannot be repaired.
I tried to move central admin site to a new content db using move-spsite but it fails with the error given above.
Now, in an attempt to repair central admin, I have tried to unprovision the central admin and tried to re-create the central admin using both Configuration Wizard GUI and PowerShell, one by one but both these methods return the same error that I have specified above, while trying to create new central admin.
I have tried to backup the corrupted DB and restore it to a new DB to see if it works, but it does not. The corruption transfers to restored DB as well.
I have also tried to detach the corrupted AdminContent DB from SQL and then tried to create a new central admin site (hoping that it will create a new admin content DB) but it complains that it cannot find the old admin content db (I suppose SharePoint_Config DB holds the references to old AdminContent DB), anyways this method fails as well because the old DB detached, and is not available.
Then, I have tried to create a new content database under central admin web application, unprovisioned central admin site, removed corrupted AdminContent DB (through central admin) and tried to create new central admin site using psconfiggui, it did not open the site until I attached corrupted admin content DB through powershell (mount-spcontentdatabase)
I have a full farm backup taken using SharePoint native tools through powershell. It has central admin backup but it cannot be restored individually, I will need to restore the whole farm somewhere to even try to see if restored admin content DB will work and even if it works, how would I transfer it back to original farm because it will have a new guid and how would I associate it with original farm? I cannot restore it to original farm because the backup is 3-4 days older and I can only restore admincontent if I perform a full farm restore which will overwrite all the content as well.
Is there any way I can setup a new Admin Content DB and create a new central admin site using that DB? or anything I can do to fix this? Any help will be appreciated.
After 7 months you probably fixed it, on that case please share your approach with us, otherwise let me recommend you to have a look on:
http://www.sqlskills.com/blogs/paul/finding-table-name-page-id/
Particularly on this clause and how to read its output:
DBCC PAGE (6, 1, 11812, 0) WITH TABLERESULTS;
Note: The article's author is Paul Randal.

sitecore: Serialization and package designer

I have a large amount of data(content created by user, not developer) created in Sitecore.
I know that in order to transfer large amount of data from one environment to another, I need to serialize all the content first.
My question is, after I serialize the content, do I need to create a designer package that contains the data I want to move? Or after I serialize, I use the serialized file?
Serialization is an option, but you could also create a package through the Package designer, download it and install it on the other environment.
If you are installing big packages, it is a good practice to set the value of Indexing.UpdateInterval in the web.config to 00:00:00 to prevent starting the Lucene indexer during the package install which results in much longer install times.
You don't need to create a package, use the serliazied file and update via the UI as below.
To update an item from the text file:
In the Content Editor, select the item that you want to update.
On the Developer tab, in the Serialize group, click Update Item.
To update an item with all its subitems from the file system:
In the Content Editor, select the parent item that you want to update with all its subitems.
On the Developer tab, in the Serialize group, click Update Tree.
To update the whole database:
In the Content Editor, select any item.
On the Developer tab, in the Serialize group, click Update Database
You can also use the "Transfer Item to Another Database" feature.
Just select the database where you want to go, go to Control Panel, Database, Transfer Item to Another Database.
This will open a wizard. Then you can select the Source items (the items you want to transfer to another database), then select the Target database and select where you want the items to be in the tree (i.e. under Home or some other node).
For some more information you can go to this blogpost by Sam J. Griffin, which explains it step by step.
One very important side-note though - don't copy the /sitecore/templates/sytem if you want to do all templates. This will result in some circular reference issues. If it's just content that you're copying it should be fine.
If you have a spare $149 then you should also take a look at the new Sitecore synchronization tool from Hedgehog:
http://www.hhogdev.com/Products/Razl.aspx