Joomla 3.xx - how to uninstall and install component or package programmatically - joomla3.0

Normally when you want to uninstall or install a component, package, plugin or module, you normally do this manually from within the Joomla admin interface.
In this case I´m looking for a way to programmatically uninstall and install a component or package directly from PHP (within the Joomla framework), probably from a system plugin.
So basically I want to initiate the uninstall and install process of a package programmatically, so that all the components, modules, plugins etc. are uninstalled and installed, the same way the would normally be unstalled and installed by uninstalling and installing the package manually from within Joomla admin.
Can someone give me a hint to how I would accomplish this, preferably using Joomla´s core class specific functions.
I have tried to find information about this by searching various Joomla documentation, but no luck so far.
UPDATE
I have located the core model files that are used when installing and uninstalling extensions from Joomla admin.
I have found a function that I might be able to use for uninstalling extension(s) from a plugin, in this class file:
/administrator/components/com_installer/models/manage.php
The function is: "remove($eid = array())" as part of the class: "InstallerModelManage" which extends "InstallerModel"
I have also found a function to use for installing extension(s) from a plugin, in this class file:
/administrator/components/com_installer/models/install.php
The function is: "install()" as part of the class: "InstallerModelInstall" which extends "JModelLegacy"
Now I only need to find the best (correct) way to include these functions in my plugin file so that I can execute remove($eid = array()) and install()

This is how you call it.
JModelLegacy::addIncludePath(JPATH_ROOT . '/administrator/components/com_installer/models');
$model = JModelLegacy::getInstance('Install', 'InstallerModel');
$model->install();
But It will take some data from input. So you have to prepare it BEFORE
$input = JFactory::getApplication()->input;
$input->set('installtype', 'url');
$input->set('install_url', 'path/to/instalation/asyou/would/enter/it/in/installation/interface');

Related

How to use jhipster and react-jhipster-mui generator

I would like to use use mui react library with jhipster. There seemed to be module react-jhipster-mui which should enable it, but I am not sure how to force jhipster to use it.
I have found simmilar blueprint module which is used by jhipster using --blueprint parameter, see bellow
jhipster --blueprint primereact-blueprint
unfortunately it doesnt work with latest version of jhipster.
Anyway execution of the module as blueprint doesn't work
jhipster --blueprint react-jhipster-mui
it ends with:
The generator-jhipster-react-jhipster-mui blueprint provided is not
installed. Please install it using command npm i -g
generator-jhipster-react-jhipster-mui*
react-jhipster-mui is not a blueprint, it's a replacement for react-jhipster library.
So you must edit the package.json file of your project, replace "react-jhipster" by "react-jhipster-mui" with correct version "1.1.0" and then run npm install.
However, it's very likely that it won't work as "react-jhipster-mui" has not been updated for last 6 months since it was forked from "react-jhipster".
If it does not work, you could try to contact its author to see if he/she is interested in updating it or you could make it work by yourself.

Deploy React components to many personal projects

I hope this is a reasonable forum for this question.
I have a library of React components that I've developed that I'd like to use in multiple personal projects. When I update/improve that library I'd like it to allow me to update in all projects where it is used.
I'm using Meteor as a build tool, which will prompt me when there is an update available for a dependency it's using, so I assume it'd be an NPM module or something. It is checked in to GitHub and I don't mind if it's public.
What would be the best way to achieve this?
I know two ways:
Publish your module on NPM
Link using npm link
For the first one, your module will be public unless you pay NPM for a private module.
The second one, make your module available locally only (It is used for a development purpose, but it fits your needs).
https://docs.npmjs.com/cli/link
If you have your package published on GitHub, you can simply create dependency by linking to tarball/master. If your path is https://github.com/my-nick/my-package, just add to your dependencies in your project's package.json:
"my-package": "https://github.com/my-nick/my-package/tarball/master"
If you have your package well described (package.json file with name, main and version attributes) it should works after meteor npm install.
Of course it works for Meteor 1.3 and higher only, lower versions don't support npm.
I did not use is personally yet, but an frequently mentioned tool for this purpose is https://lernajs.io/, which is e.g. used by create-react-app.

sitecore installation wizard could not install some content

I would like to ask you if someone has similar problem. I am using Sitecore.NET 7.2 (rev. 151021) with Solr. I need to add some items from prod to my local sitecore instance. When I create package and tried to install specific content I get exception null reference exception. It doesnt depend on the content. I tried to used package designer with varios content and always I get this exception.
As the comments indicate: Make sure that all of the supporting items that each item in the package require are in place in the destination before trying to install them through a package.
Normally, separate packages are created for Templates, Layouts and Content and installed in that order to avoid missing dependencies.
You can also look into disabling Index builds during package installation. I have a module out there that does this:
https://marketplace.sitecore.net/en/Modules/Detailed_Package_Installer.aspx

Can i install component and plugin with single extension in joomla package?

I want to know if we can install plugin and component with a single extension? for example i created a plugin to send the trackback, and i create a component to import articles and i want to include them in a single package . Is it possible?Thanks in advance.
Sorry My bad. There is this thing called package in joomla where you can pack module and plugin or vice-versa.
You can find the detailed explaination here.Sorry for the quick question
Joomla Packages
Yes, it is possible... Try http://joomla-extensions-packager.org, there is a form for generating extension packages online by uploading extensions / filling a form. If you need some automation, you can use the php library to generate your packages programatically (by php cli scripts, phing etc.)

Adding packages like moment.js & account.js to meteor Project

How do I add these JS packages to a meteor project? Do I simply place the JS files in the public folder so the client and server can access them? Or is there some specific steps that I need to follow?
These kind of standalone libraries can be directly placed in the /lib directory under your project.
For use on both the client and the server, place them into project/lib folder.
Or if you want to use them only at client-side, place them as usual in project/client/lib
In short, It depends.
I would recommend you check out http://atmosphere.meteor.com for a list of packages. If what you're looking for is there, install meteorite with npm install -g meteorite (https://github.com/oortcloud/meteorite)
Once you have metorite installed you can install these community packages quite easily using mrt add packagename
Most packages are on http://atmosphere.meteor.com.
But if for some reason the JS package you want isn't on atmosphere, depending on the package, if its a UI package (e.g datepicker, etc) put it in the /client/lib folder to avoid meteor crashing (only accessible by client).
If its a type of module abstractor (e.g backbone - backbone is included in meteor already btw: add using meteor add backbone) you could put it in the /lib directory of your package, it will be referenced automatically by both the server and client.
You have to add the packages via console.
Type "meteor add accounts-password" for example.
See here
Perhaps you should watch some of these videos here
to get an idea how meteor packages are added.

Resources