import Web Content into Liferay Database - liferay

I want to keep web content in liferay database. Currently the JPGs are in another filesystem on another server, which I want to move to liferay database. Is there a way to bulk import these JPGs/web content to liferay db? One option I'm thinking is having a daily scheduled job to import new files from the filesystem. Curious to hear if anyone else has done it and how?
I found that there is a thing called as Database Hook. But as far as I understand, this lets you save to db only those files which you upload through the Image Gallery in Liferay. Which is a bit different from having to import files from another filesystem programmatically.

When you go to Liferay's Document Library (or image gallery in 6.0) you'll find a link "Access from Desktop" in every folder. This can be used to connect via WebDAV, so you can connect to Liferay's Document Library as if it was a Network share. Then just copy through batch files or explorer (drag&drop) and they'll end up in the doclib. Works in both directions.
For Liferay 6.1 you can also consider Liferay Sync, a Dropbox-like client that just synchronizes the document library with a folder on a local (remote from the server) system.
And the most complex variant (just to be complete here) is to use Liferay's API to insert documents programmatically. The advandage here is that you can also use it to tag and categorize the content during your import process, but it definitely is more work than just dragging and dropping files.

Related

How to host website on different server

I'm wondering if my website need to be hosted on a different server for load balancing purposes as picture below:
I'm thinking of installing 3 Kentico Project into each server. Then, export and import the site into each Kentico Project and link with the same database connection string.
But what if one of the webparts (.ascx) gets updated? Is that mean I will need to update all 3 Kentico Project. What if other files like js, css, or media?
Is there a proper way to host on different servers but yet can manage the content as one of the Kentico Project get update?
What you are describing is the exact purpose of Kentico's Web farm feature where you can have multiple servers (web farms) connected to a single database. The main purpose of web farms is to ensure that cache and files (not code files, but media files such as the ones uploaded by you as attachments, media library, meta files...) are synchronized across all servers.
Each server in your scenario has its own memory and if you change an object, you want all other servers to reflect the change because otherwise some visitors might end up seeing "old" data, while others wouldn't.
You are also correct in assumption that all code files (ascx, cs, aspx...) will need to be uploaded to all servers. Best way to approach this is to have a tool such as Team city which is able to deploy your changes to multiple servers simultaneously.
With js, css, html, images... it depends where you store them. If you store them in database (not usually the best thing to do) you don't need to update them on particular servers, but if you store them on file system, you might need to. There are many variables here, but some deployment tool will probably be the best bet.
One note here. Try not to install Kentico directly on each of those server and use Export and Import to setup the site. Simply make a copy of the website physically files from your DEV server and paste into each of those server. Then connect them all to the same database.
Why not use the Export and Import? 1. You will get different hast salt string in the web.config which you will get Macro security error, which you will have to replace with the same key. 2. You may miss objects during export and import. 3. The export and import are mostly for the objects stored in the data base, and for the web farm setup, they share the same database, so there is no point of doing that.
You can easily achieve this move to windows Azure from on-premises.
--Can deploy your website/ web project as Cloud service/App service.
--Kentico Azure supports both development and deployment solution
--Built-in scalability
For more details refer below links
Hosting options: https://docs.kentico.com/k10/running-kentico-on-microsoft-azure/microsoft-azure-web-hosting-options
https://devnet.kentico.com/articles/deploying-kentico-to-microsoft-azure-know-your-web-hosting-options

Automatic way of export / import pages from liferay

I have created portlets for liferay and prepare couple of pages. Now I want to create installation script, which create pages definition in customer liferay server. I know that pages export/import is possible using LAR file, but this could be done only manualy, or using remote publishing which i am not able to do.
I was searching on net and found ddm tool. Which should be able to do that. Unfortunately i'm not able to get it work as it export only web content, blogs, wikis, etc, but not pages with portlets. It is probably because one of the condition is "Every Template must be assigned to a Structure. Don't create any templates on the Liferay server which does not have a structure connected to it.
". But how can I assign page to structure ? Cant find anything.
Or is there any other option for automatic page creation, which could be used ?
In case you created a custom theme, you can easily use the "resources importer" to create an entire site via the "sitemap.json" file (define pages: choose layout, assign portlets to the columns, ...). You can also export existing content as xml from the current instance and import them via the theme. Same thing for web content structures and templates.
for more details: https://dev.liferay.com/develop/tutorials/-/knowledge_base/6-1/importing-resources-with-your-themes
Unfortunately theme is produced by another supplier, so this solution isn't suitable for me.
at the end i find working solution which consist of following steps:
create plugin hook
in hook setup upgrade process
in the upgrade process create pages with appropriate layout, friendlyUrl, etc. All these is possible to do using liferay api
Don't have enough reputation, so at least two links
https://www.liferay.com/de/web/james.falkner/blog/-/blogs/7cogs-is-dead-long-live-7cogs-
https://github.com/azzazzel/liferay-official-plugins/tree/master/hooks/sevencogs-hook/docroot/WEB-INF/src/com/liferay/sevencogs/hook/upgrade

Liferay create site / page programmatically

I have been using Liferay for work for 2 weeks. I noticed that it's a bit difficult to find good documentation and tutorials.
Until now I created pages from the web portal. After I create them, I drag and drop portlets. I don't really like this approach, I would prefer to use a coding approach. Is there a way to create a website or page programmatically by defining a project as I do to create portlets?
Moreover, I am using Liferay with WebLogic 10.3.6. I want to know where liferay puts pages I created via web-portal on the file system. I suppose that a file, or something similar, is created when I declare a new site on the Liferay web-portal.
Thank you all,
Marco
Yes Liferay has it's Database, all data of any Liferay object is stored in the database and / or on the file system depending on your configuration.
However, one of the functionality of Liferay is to let you create pages / sites through the UI. As documented in the Java Portal Specification and Liferay Server Documents your approach to create pages in an alternative way is possible but it is part of Liferay's Portal Services. You can use Liferay's Service (HTTP REST) API to call the related service. To access those APIs you need to configure your Liferay Server.
In case you want to do programmatically you still need to configure, enable and call those external HTTP services from your code. You should not create Liferay Objects from your own code hosted as an extension inside your Liferay Instance as that will result inconsistency in your Liferay Database / filesystem. (As in case of page creation Liferay creates a set of other related objects in it's database / filesystem.)
In your liferay bundle you will find two plugins of interest.
First is resources-importer-web for which description says
The Resources Importer app allows front-end developers to package web
content, portlet configurations, and layouts together in a theme
without saving it as a compiled .LAR file thereby allowing for greater
flexibility in its usage between Liferay Portal versions.This app will automatically create associated content when other
plugins are deployed that are configured to make use of the Resource
Importer app.This app installs as a Liferay service.
Second is welcome-theme which declares resources to be created by resources-importer-web. This on should be example how to create your own. Take a look at
welcome-theme\WEB-INF\src\resources-importer\*
welcome-theme\WEB-INF\liferay-plugin-package.properties
This feature is described at importing-resources-with-themes
As mentioned by gabor_the_kid, Liferay stores all objects in its tables. For example, User related objects would be in user table. Liferay exposed services or API's to change the default/to add new behaviors by program but not easier than achieving it through UI. Also maintenance should be considered for going program way of creating pages or layouts etc.
You can describe your changes using xml and use the Liferay Portal DB Setup core to create the changes in DB.
The library defines the list of available xml configurations.

deleting web content programmatically in liferay 6.0

I am new to liferay. I am developing delete scheduler, which has to delete documents programatically based on some condition. using DLfileLocalServiceUtil.deleteFileEntry(id) I can delete it, but it is deleting only entry in DlfileEntry table not the actual file stored in file system in server in data folder.
DLfileLocalServiceUtil is used for managing Documents. You need to use 'JournalArticle*Util' APIs to deal with Web Contents. There are multiple Util classes for different purpose. You'll perhaps need JournalArticleLocalServiceUtil.deleteJournalArticle() methods for deleting the web contents.

Accessing Sharepoint File Server Search Results Externally

We are currently implementing MOSS 2007 to replace an older portal system (Plumtree) and are currently looking at searching. We have 1000s of documents on a file server that we would like users to be able to search. This I can set up by adding a content source of "File Shares" and pointing it at the UNC of the file share. The issue is getting access to this data when you are not on the local network.
So, file share is \FileServer01\Files. This has a file called Wibble.txt containing the word Wibble.
When I search for Wibble it finds this document, BUT it points to file:\FileServer01\Files\Wibble.txt.
That is great if I am attached to the network, but what about when I am accessing Sharepoint via the Internet and I'm not on the LAN that knows about that server?
If I wrote something from scratch I would have a download page that I passed in the location of the file and it would stream it to my browser. Sharepoint does not seam to do anything like like.
Ideas? Suggestions? Have I missed something simple?
Create an HttpModule that intercepts requests to documents in this file share, and presents them through an HttpHandler to the user. Deploy the module and handler to the web application.
The only way to make that content accessible via HTTP would be to bring everything off the file server and into the SharePoint content database. You can then simply let SharePoint crawl that instead of the file server; and your users will be able to download content as well.
Edit: To make the migration task quicker and easier, you can ensure that the WebDav service is running on the sharepoint box, which will allow you to open a document library using the windows explorer interface.

Resources