Skip to content

012 Component FTP and more

Amigo edited this page May 31, 2019 · 21 revisions

COMPONENT FTP AND MORE

Adding README Script

Next in the component view we are going to add the README script to a component. The README script is commonly used as the components homepage. If you were to go to Github for example, let's open Github. We are on the demo components page on Github, and you'll see that it has this nice image here, and it has some details and some layout. Now this all is done with the README file. It's with this file here(README). We can open that and then look at the Raw. Here you can see it's basically the same text this we looking at previously. 00:00:53 Inside of component builder you can add this README and README text. This is placeholders(###version###).

Place Holders

Now I know that(#) is part of the markdown for a header. You need to know a little bit about markdown. You need to you know what is placeholders and what is not. That is why I added the script so you can get an idea of everything that are placeholders. 00:01:27 These placeholders are automatically updated from the details that are in these fields here. You can see the actual placeholders names. It's nice, if you change the version here, it'll updated there automatically. So that is just README file.

Component-Builder Link Back Info

Really a place for you to give a lot of information to those who are using your 00:02:01 application. Maybe you can add some links to it, or you could add some links to help menus, or even instructions on installing it, or anything else that you'd like to share through the README file. I would ask if it's not too much for you to leave this area, this commenting, the more people using component builder, the more involve within a community. Others getting this training set. Help us to sustain this project. If 00:02:36 you leave that in, it will certainly be helpful. You are not compulsory, I mean it's only if you want to.

Markdown Info

Then if you want to know more about markdown, then you can open this link here(Markdown-Cheatsheet). It shows you a little bit of cheat sheet of everything that you can do. That is looking at the README area.

Admin - Site Views Adding Editing

This admin view area, 00:03:06 and the site view area, should be seen as a place where you can create new admin views. Do realize that if you create a new admin view it's not necessarily linked to this component. You need to still link it in here, in settings, under admin view. This is more a place to create admin view. If you click on new or to edit existing admin views, that are linked to this component. Same goes with the site views. It's simply a way for you to gain access to editing those site views that already linked to this application easily.

FTP Info - Updating Component

And then the forth. 00:03:51 We want to look at is the FTP server. That FTP server is been added to give you a hand in moving this application, the component to your server and also add the feature of that automated updating that is inside of Joomla. The update server is actually a Joomla concept. If you open a component. I'll open sermon distributor, this is the front I need to look at the back end. We look at the 00:04:39 XML file of this component. Component builder built this whole file for you. But at the very bottom you will see that there is an app updates server. That is being added. Now this is not added if you have not set this. If this is set to no, it will not be adding an update server. If you add this(yes) 00:05:03 then you can set the link to where the update server is going to be hosted. It will automatically take that link, and added into your XML file, like it's done here. That file itself, Component Builder, can also build that file for you. 00:05:31 The way it does it, is this should look like that: host=hostname&PORT=portINT&option(type)=FTP_BINARY. Now this FTP Binary usually is 21. And the default value FTP binary would usually be 15 and then username and a password. 00:06:04 Now this FTP details should login directly to this(Update Server) folder that you have up here. All that component builder does, it logs into your server, move this file in there, and then disconnects. And this information is what will make it possible for him to do that.

FTP Info - Sales Server

Same goes with the sales server. The sales server usually would be very much the same concept. You will simply be adding the same kind of string here. Except usually the update server and the sales server is not the same place. 00:06:47 The update server, let the user know, that there is an update. Where the sales server, where this component zip file will be stored on your server. You have something like WHMCS or another component through which you are selling your extensions, you can use the folder in your server which it's looking for the files. You can use that folder, you can create a FTP account to that folder, and then set that details in this field here. Then component builder at the moment that you click compile, it has a 00:07:30 an option here, it says add backup folder and save sales server. You click that to yes. If you compile it now, it will move the zip file to sales server, as well as creating a backup.

Component Builder Global Options

The backup and the Git folder is actually set up in your components global options. We haven't really spoken much about the global options. Let us open it now. We saw in this area here, that it says that this field is encrypted. In component builder if you go to global settings, it says encryption settings. In here 00:08:18 you would add your own key. By which it will encrypt, once you've added this key. You shouldn't change it because it will not be able to decrypt, because it's used to encrypt and as well to decrypt the data. That just means everything that's been encrypted needs to be redone. In this case it is going to be these login FTP login information. This is the basic encryption which we spoke of on talk about storing types. You got basic encryption and advanced encryption. This is basic encryption way. 00:09:01 It's also called basic key.

Component Builder Folder Paths

Then you have folder paths. These two first folder paths, called compiler folder and custom folder, I would leave them for now, they are a little buggy. I haven't fully managed to achieve them being flexible. To move them at this stage is difficult. For a number of reasons I would suggest you just leave them blank. But here you would add a backup folder. This should be related to the root of your server. As well as a Git folder. 00:09:41 Git folder would be where component builder creates a folder with all the components files without zipping them. And then you can go to that folder and create a Git create, a Git repository there. From that folder you can push to Github or any other Git server respectively. It's able to create a folder from which you can do Github or any other kind of repository work. Which are separate from your backup folder and also separate from the temporary folder in which 00:10:17 compiles the component. You can move it out of your Joomla install. That's what these folder paths are for. So when you do the compiling of the component it does that Git repository. It won't delete the .Gitfolder, it will just replace all the files in it. First remove the old ones then add the new ones and Git will see that only the files that is been changed, it will notice and those who you need to do a recommit, do just a normal commit to get it into your repository. If you don't know Git, then possibly it doesn't make sense to you. There's some great courses as well about Git on lynda.com as well as Udome. You can just go look in at those. That's a backup folder and the sales server. The same goes here with this FTP 00:11:18 credentials should be that direct folder in which these zip files should be stored. Unfortunately component builder cannot store it in subfolders at this point. The FTP details will just login to that FTP account, and in that folder which has the access you'll put the file there. No subfolders or other folders, the FTP details should be going directly to the folder. In the component builder, then will be in the back end components, component builder and then Helpers. There is a file called compiler. If you open that file, 00:12:14 you would see that we have a function here builtme. Here's all the placeholders that you can use in the builtme file, and will be replaced with the relative information.

Component Builder Compiler.PhP FTP Info

There is a function here called move file to FTP server. This move file to FTP server, calls another function called: getFTP. Now getFTP is this function here, it takes the signature, checks whether we already made such a connection before. And then loads that object. But here I'm using this parse string function to convert the string into the variables. All the variables in that string is converted to arrays or variables respectively. 00:13:12 That then is used to make use of Joomlas own client FTP class. If you want to know where that is, you can in NetBeans you'd click control spacebar. It shows you it's in libraries/Joomla/client/FTP.PHP. You can click there, open it, so we are using Joomlas built-in FTP client, and we passing the host, the port, the option, the username, the password, and making a connection. Then we sending that off to do this move file, which then takes the file content and moves it to the server. That's just for your own piece of mind that the data itself is not being leaked or compromised. 00:14:04 It's all handled right here and you can follow its events in component builder, from relations to the update server as well as to the sales server.

Update Server Extra Info(Versions)

The other thing that I know is quite in important. Is this update server, it is an XML file. 00:14:25 This XML file is build up of versions and download links to those versions. So like I explain to you in a previous video. There is this reality while you are developing your component. Your users wouldn't need any 00:14:47 change updates or anything. The moment you put your component out there on the web. Immediately you need to consider when you make a change in the application, how will you user be able adapt to that change. The biggest changes you can make 00:15:03 is adding new views or adding new fields to the component. That makes it a little hard. Like I explain previously, with the history component we've done scripting to take control of that problem. 00:15:21 You also need to think about the database. We created this thing called: Version Updates. Which gives you the ability to actually add MySQL scripting, which needs to be executed upon the updating. Now the way for you to think about this, if you have a new version 1.2.9, 00:15:43 then there needs to be a table alteration. You need to know if MySQL commands to do that. I'm not going to teach you that. You just need to put that MySQL command in here(MySQL - Update Dump) according to the Joomla conventions. The table name must have that #_ _ in front of it and Joomla will dynamically put in the prefix. You might just simply will do a MySQL script here. If you are making a change and the new release is 1.2.9 and 1.0 didn't have that 00:16:23 specific field or view, then you must realize that you're updating this one and the SQL must come next to that specific version. The update must be placed at the version, which needs the update. If you make a change don't put it here(1.2.9), because it won't update correctly. You need to put the update next 00:16:44 to the version(1.0) that needs to be updated. Then over here(Version URL), you would put the link to the respective downloads. Like here we had Version 1.2.9 Aand then we had version 1.3.0 00:16:59

???

And We added the 1.3.0 link here Obviously I'm using GitHub as my distributing Platform of the application You could use any URL And these URLs is what will be used In your updates Server So the update server 00:17:18 If I was to open that for us first let me close this and we will go to the update server Link copy that You'd see that it has this URLs here for the download And as we move on it 3, 3.1, 3.2 And so it's getting these these Details It is getting them 00:17:48 From This version update area And so the last version in this List being 1.3. 2 Must be the same Is the one that you set here That is important So that it will know ok now we are at the current version 00:18:07 And it will do the necessary you know the adjustments to that Ok so that is Basically All the concepts that would be Necessary To cover Regarding the Component Area We've looked at adding admin views 00:18:26 We will again look at site views and adding them as well as your custom admin views And we will possibly Going to more depths about this MySQL tweak What we briefly spoke about But the For most part that's or the at Component Area 00:18:48 And all it's nice Features Obviously it all stacks upon each other from the Fields then the admin Views and then the components themselves And if you have come this far you Set out your component You have added some admin views You are now ready to 00:19:06 Start building the front and the site area Which You wouldn't be able to To really do effectively until now It is really necessary to First do the admin views And then only do the site views Well Thank you for watching

Clone this wiki locally