本文整理汇总了PHP中JInstaller::install方法的典型用法代码示例。如果您正苦于以下问题:PHP JInstaller::install方法的具体用法?PHP JInstaller::install怎么用?PHP JInstaller::install使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JInstaller
的用法示例。
在下文中一共展示了JInstaller::install方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: install
public function install($path = null)
{
$result = parent::install($path);
$type = (string) $this->manifest->attributes()->type;
$this->installtype = $this->_adapters[$type]->getInstallType();
return $result;
}
示例2: postflight
function postflight($type, $parent)
{
$db = JFactory::getDBO();
$mod_sp_poll = $parent->getParent()->getPath('source') . '/mod_sp_poll';
$installer = new JInstaller();
$installer->install($mod_sp_poll);
}
示例3: install
function install()
{
$pkg_path = JPATH_ADMINISTRATOR . DIRECTORY_SEPARATOR . 'components' . DIRECTORY_SEPARATOR . $this->com . DIRECTORY_SEPARATOR . 'extensions' . DIRECTORY_SEPARATOR;
if (JFolder::exists($pkg_path . 'nextend')) {
$librariesPath = defined('JPATH_LIBRARIES') ? JPATH_LIBRARIES : JPATH_PLATFORM;
JFolder::copy($pkg_path . 'nextend', $librariesPath . DIRECTORY_SEPARATOR . 'nextend', '', true);
JFolder::delete($pkg_path . 'nextend');
}
$extensions = array_merge(JFolder::folders($pkg_path, '^(?!com_)\\w+$'), JFolder::folders($pkg_path, '^com_\\w+$'));
if (version_compare(JVERSION, '3.0.0', 'ge')) {
foreach ($extensions as $pkg) {
$f = $pkg_path . DIRECTORY_SEPARATOR . $pkg;
$xmlfiles = JFolder::files($f, '.xml$', 1, true);
foreach ($xmlfiles as $xmlf) {
$file = file_get_contents($xmlf);
file_put_contents($xmlf, preg_replace("/<\\/install/", "</extension", preg_replace("/<install/", "<extension", $file)));
}
}
}
foreach ($extensions as $pkg) {
$installer = new JInstaller();
$installer->setOverwrite(true);
if ($success = $installer->install($pkg_path . DIRECTORY_SEPARATOR . $pkg)) {
$msgcolor = "#E0FFE0";
$name = version_compare(JVERSION, '1.6.0', 'l') ? $installer->getManifest()->document->name[0]->data() : $installer->getManifest()->name;
$msgtext = $name . " successfully installed.";
} else {
$msgcolor = "#FFD0D0";
$msgtext = "ERROR: Could not install the {$pkg}. Please contact us on our support page: http://www.nextendweb.com/help/support";
}
?>
<table bgcolor="<?php
echo $msgcolor;
?>
" width ="100%">
<tr style="height:30px">
<td><font size="2"><b><?php
echo $msgtext;
?>
</b></font></td>
</tr>
</table><?php
if ($success && file_exists("{$pkg_path}/{$pkg}/install.php")) {
require_once "{$pkg_path}/{$pkg}/install.php";
$com = new $pkg();
$com->install();
}
}
$db = JFactory::getDBO();
if (version_compare(JVERSION, '1.6.0', 'lt')) {
$db->setQuery("UPDATE #__plugins SET published=1 WHERE name LIKE '%nextend%'");
} else {
$db->setQuery("UPDATE #__extensions SET enabled=1 WHERE name LIKE '%nextend%' AND type='plugin'");
}
$db->query();
if (JFolder::exists(JPATH_SITE . DIRECTORY_SEPARATOR . 'media' . DIRECTORY_SEPARATOR . 'dojo' . DIRECTORY_SEPARATOR)) {
JFolder::delete(JPATH_SITE . DIRECTORY_SEPARATOR . 'media' . DIRECTORY_SEPARATOR . 'dojo' . DIRECTORY_SEPARATOR);
JFolder::create(JPATH_SITE . DIRECTORY_SEPARATOR . 'media' . DIRECTORY_SEPARATOR . 'dojo' . DIRECTORY_SEPARATOR);
}
}
示例4: postflight
function postflight($type, $parent)
{
$db = JFactory::getDBO();
$src = $parent->getParent()->getPath('source');
$manifest = $parent->getParent()->manifest;
$plugins = $manifest->xpath('plugins/plugin');
foreach ($plugins as $plugin) {
$name = (string) $plugin->attributes()->plugin;
$group = (string) $plugin->attributes()->group;
$path = $src . '/plugins/' . $group;
if (JFolder::exists($src . '/plugins/' . $group . '/' . $name)) {
$path = $src . '/plugins/' . $group . '/' . $name;
}
$installer = new JInstaller();
$installer->install($path);
$query = $db->getQuery(true);
$query->update($db->quoteName('#__extensions'));
$query->set($db->quoteName('enabled') . ' = 1');
$query->where($db->quoteName('type') . ' = ' . $db->Quote('plugin'));
$query->where($db->quoteName('element') . ' = ' . $db->Quote($name));
$query->where($db->quoteName('folder') . ' = ' . $db->Quote($group));
$db->setQuery($query);
$db->execute();
}
$deprecatedFiles = array(JPATH_SITE . '/components/com_proofreader/controllers/typo.raw.php');
foreach ($deprecatedFiles as $file) {
if (is_file($file)) {
JFile::delete($file);
}
}
self::displayDonation();
}
示例5: installGiantExtensionsPlugin
private function installGiantExtensionsPlugin()
{
$pluginPath = dirname(__FILE__) . '/plg_content_giantcontent.zip';
$installResult = JInstallerHelper::unpack($pluginPath);
if (empty($installResult)) {
$app = JFactory::getApplication();
$app->enqueueMessage('Giant Content can not install "Content - Giant Content" plugin. Please install plugin manually inside package.', 'error');
return false;
}
$installer = new JInstaller();
$installer->setOverwrite(true);
if (!$installer->install($installResult['extractdir'])) {
$app = JFactory::getApplication();
$app->enqueueMessage('Giant Content can not install "Content - Giant Content" plugin. Please install plugin manually inside package.', 'error');
return false;
}
$db = JFactory::getDBO();
$db->setQuery('UPDATE #__extensions SET enabled = 1 WHERE type = "plugin" AND folder = "content" AND element = "giantcontent"');
$db->query();
if ($db->getErrorNum()) {
$app = JFactory::getApplication();
$app->enqueueMessage('Giant Content can not enable "Content - Giant Content" plugin. Please enable plugin manually in the plugin manager.', 'warning');
}
return true;
}
示例6: install
/**
* method to install the component
*
* @return void
*/
function install($parent)
{
// $parent is the class calling this method
//$parent->getParent()->setRedirectURL('index.php?option=com_helloworld');
// installing module
$module_installer = new JInstaller();
if (@$module_installer->install(dirname(__FILE__) . DS . 'admin' . DS . 'module')) {
echo 'Module install success', '<br />';
} else {
echo 'Module install failed', '<br />';
}
// installing plugin
$plugin_installer = new JInstaller();
if ($plugin_installer->install(dirname(__FILE__) . DS . 'admin' . DS . 'plugin')) {
echo 'Plugin install success', '<br />';
} else {
echo 'Plugin install failed', '<br />';
}
// installing router
$plugin_installer = new JInstaller();
if ($plugin_installer->install(dirname(__FILE__) . DS . 'admin' . DS . 'router')) {
echo 'Router install success', '<br />';
} else {
echo 'Router install failed', '<br />';
}
// enabling plugin
$db =& JFactory::getDBO();
$db->setQuery('update #__extensions set enabled = 1 where element = "jumi" and folder = "system"');
$db->query();
// enabling router
$db->setQuery('update #__extensions set enabled = 1, ordering = 100 where element = "jumirouter" and folder = "system"');
$db->query();
}
示例7: postflight
public function postflight($type, $parent)
{
$db = JFactory::getDBO();
$db->setQuery("UPDATE #__extensions SET enabled = 0 WHERE client_id = 1 AND element = " . $db->Quote($parent->get('element')));
$db->query();
$status = new stdClass();
$status->plugins = array();
$src = $parent->getParent()->getPath('source');
$manifest = $parent->getParent()->manifest;
$plugins = $manifest->xpath('plugins/plugin');
foreach ($plugins as $plugin) {
$name = (string) $plugin->attributes()->plugin;
$group = (string) $plugin->attributes()->group;
$path = $src . '/plugins/' . $group . '/' . $name;
$installer = new JInstaller();
$result = $installer->install($path);
if ($result) {
if (JFile::exists(JPATH_SITE . '/plugins/' . $group . '/' . $name . '/' . $name . '.xml')) {
JFile::delete(JPATH_SITE . '/plugins/' . $group . '/' . $name . '/' . $name . '.xml');
}
JFile::move(JPATH_SITE . '/plugins/' . $group . '/' . $name . '/' . $name . '.j25.xml', JPATH_SITE . '/plugins/' . $group . '/' . $name . '/' . $name . '.xml');
}
$query = "UPDATE #__extensions SET enabled=1, ordering=99 WHERE type='plugin' AND element=" . $db->Quote($name) . " AND folder=" . $db->Quote($group);
$db->setQuery($query);
$db->query();
$status->plugins[] = array('name' => $name, 'group' => $group, 'result' => $result);
}
$this->installationResults($status);
}
示例8: postflight
function postflight($type, $parent)
{
$app = JFactory::getApplication();
$db = JFactory::getDBO();
$db->setQuery("UPDATE #__extensions SET enabled = 1 WHERE folder='content' AND element = '{$this->extensionName}'");
$db->execute();
$status = new stdClass();
$status->plugins = array();
$src = $parent->getParent()->getPath('source');
$manifest = $parent->getParent()->manifest;
$plugins = $manifest->xpath('plugins/plugin');
foreach ($plugins as $plugin) {
$name = (string) $plugin->attributes()->plugin;
$group = (string) $plugin->attributes()->group;
$path = $src . '/plugins/' . $group;
if (JFolder::exists($src . '/plugins/' . $group . '/' . $name)) {
$path = $src . '/plugins/' . $group . '/' . $name;
}
$installer = new JInstaller();
$result = $installer->install($path);
$query = "UPDATE #__extensions SET enabled=1 WHERE type='plugin' AND element=" . $db->Quote($name) . " AND folder=" . $db->Quote($group);
$db->setQuery($query);
$db->query();
$status->plugins[] = array('name' => $name, 'group' => $group, 'result' => $result);
}
//echo "<p>Installed</p>";
$this->results($status, $parent, "install");
}
示例9: postflight
function postflight($type, $parent)
{
$db = JFactory::getDBO();
$status = new stdClass();
$status->plugins = array();
$src = $parent->getParent()->getPath('source');
$manifest = $parent->getParent()->manifest;
$plugins = $manifest->xpath('plugins/plugin');
foreach ($plugins as $key => $plugin) {
$name = (string) $plugin->attributes()->plugin;
$group = (string) $plugin->attributes()->group;
$path = $src . '/plugins/' . $group;
if (JFolder::exists($src . '/plugins/' . $group . '/' . $name)) {
$path = $src . '/plugins/' . $group . '/' . $name;
}
$installer = new JInstaller();
$result = $installer->install($path);
if ($result) {
$query = "UPDATE #__extensions SET enabled=1 WHERE type='plugin' AND element=" . $db->Quote($name) . " AND folder=" . $db->Quote($group);
$db->setQuery($query);
$db->query();
}
}
$template_path = $src . '/template';
if (JFolder::exists($template_path)) {
$installer = new JInstaller();
$installer->install($template_path);
}
$conf = JFactory::getConfig();
$conf->set('debug', false);
$parent->getParent()->abort();
}
示例10: install
/**
* method to install the component
*
* @return void
*/
function install($parent)
{
$manifest = $parent->get("manifest");
$parent = $parent->getParent();
$source = $parent->getPath("source");
$installer = new JInstaller();
// Install plugins
foreach ($manifest->plugins->plugin as $plugin) {
$attributes = $plugin->attributes();
$plg = $source . DIRECTORY_SEPARATOR . $attributes['folder'] . DIRECTORY_SEPARATOR . $attributes['plugin'];
$installer->install($plg);
}
$db = JFactory::getDbo();
$tableExtensions = "#__extensions";
//$db->quote("#__extensions");
$columnElement = "element";
//$db->quote("element");
$columnType = "type";
//$db->quote("type");
$columnFolder = "folder";
//$db->quote("folder");
$columnEnabled = "enabled";
//$db->quote("enabled",false);
// Enable plugins
$db->setQuery("UPDATE\n {$tableExtensions}\n SET\n {$columnEnabled}=1\n WHERE\n {$columnElement}='admirorgallery'\n AND\n {$columnType}='plugin'\n AND\n {$columnFolder}='content'");
$this->gallery_install_result = $db->query();
// Enable plugins
$db->setQuery("UPDATE\n {$tableExtensions}\n SET\n {$columnEnabled}=1\n WHERE\n {$columnElement}='admirorbutton'\n AND\n {$columnType}='plugin'\n AND\n {$columnFolder}='editors-xtd'");
$this->button_install_result = $db->query();
}
示例11: update
function update($parent)
{
$manifest = $parent->get("manifest");
$parent = $parent->getParent();
$source = $parent->getPath("source");
foreach ($manifest->plugins->plugin as $plugin) {
$installer = new JInstaller();
$attributes = $plugin->attributes();
$plg = $source . "/" . $attributes['folder'] . "/" . $attributes['plugin'];
$installer->install($plg);
}
$db = JFactory::getDBO();
// Fixes a Joomla bug, wich adds a second repository rather than overwrite the first one if they are different
$query = "DELETE FROM `#__update_sites` WHERE `name` = '" . $this->extension_name . " update site';";
$db->setQuery($query);
$db->query();
$query = "DELETE FROM `#__update_sites` WHERE `name` = 'Ozio Gallery3 update site';";
$db->setQuery($query);
$db->query();
// Clear updates cache related to this extension
$query = "DELETE FROM `#__updates` WHERE `name` = '" . $this->extension_name . "';";
$db->setQuery($query);
$db->query();
// Shows the installation/upgrade message
$this->message();
}
示例12: installExtensions
function installExtensions($extPath = null)
{
//if no path defined, use default path
if ($extPath == null) {
$extPath = dirname(__FILE__) . DS . 'extensions';
}
if (!JFolder::exists($extPath)) {
return false;
}
$extensions = JFolder::folders($extPath);
//no apps there to install
if (empty($extensions)) {
return true;
}
//get instance of installer
$installer = new JInstaller();
$installer->setOverwrite(true);
//install all apps
foreach ($extensions as $ext) {
$msg = "Supportive Plugin/Module {$ext} Installed Successfully";
// Install the packages
if ($installer->install($extPath . DS . $ext) == false) {
$msg = "Supportive Plugin/Module {$ext} Installation Failed";
}
//enque the message
JFactory::getApplication()->enqueueMessage($msg);
}
return true;
}
示例13: install
/**
* method to install the component
*
* @return void
*/
function install($parent)
{
// General settings
$status = new JObject();
$status->modules = array();
// Array to store module and plugin installation results
$result = array();
$indice = 0;
$installer = new JInstaller();
$manifest = $parent->get("manifest");
$parent = $parent->getParent();
$source = $parent->getPath("source");
foreach ($manifest->plugins->plugin as $plugin) {
$installer = new JInstaller();
$attributes = $plugin->attributes();
$plg = $source . DIRECTORY_SEPARATOR . $attributes['folder'] . DIRECTORY_SEPARATOR . $attributes['plugin'];
$result[$indice] = $installer->install($plg);
$indice++;
}
$db = JFactory::getDbo();
$tableExtensions = $db->quoteName("#__extensions");
$columnElement = $db->quoteName("element");
$columnType = $db->quoteName("type");
$columnEnabled = $db->quoteName("enabled");
// Enable Tracker plugin
$db->setQuery("UPDATE \n\t\t\t\t{$tableExtensions}\n\t\t\tSET\n\t\t\t\t{$columnEnabled}=1\n\t\t\tWHERE\n\t\t\t\t{$columnElement}='tracker'\n\t\t\tAND\n\t\t\t\t{$columnType}='plugin'");
$db->execute();
}
示例14: com_install
/**
* Main installer
*/
function com_install()
{
$errors = FALSE;
//-- common images
$img_OK = '<img src="images/publish_g.png" />';
$img_WARN = '<img src="images/publish_y.png" />';
$img_ERROR = '<img src="images/publish_r.png" />';
$BR = '<br />';
//--install...
$db =& JFactory::getDBO();
$query = "CREATE TABLE IF NOT EXISTS `#__friendmanager` ( " . "`id` int(11) NOT NULL auto_increment, " . "`backupdate` datetime NOT NULL, " . "`msg` varchar(50) NOT NULL default '', " . "PRIMARY KEY (`id`) " . ")";
$db->setQuery($query);
if (!$db->query()) {
echo $img_ERROR . JText::_('Unable to create table') . $BR;
echo $db->getErrorMsg();
return FALSE;
}
// Install plg_geocode
$plugin_installer = new JInstaller();
if ($plugin_installer->install(dirname(__FILE__) . DS . 'plg_firstfriend')) {
echo "<br/><hr><h1>First Friend Plugin Installed and Published " . $img_OK . "</h1><hr><br />";
} else {
echo "<br/><hr><h1>First Friend Plugin Not Installed " . $img_ERROR . "</h1><hr><br />";
}
// Enable plg_geocode
$db->setQuery("UPDATE #__plugins SET published = 1 WHERE " . "name = 'FirstFriend' ");
$db->query();
return TRUE;
}
示例15: postflight
public function postflight($type, $parent)
{
$db = JFactory::getDBO();
$status = new stdClass();
$status->modules = array();
$status->plugins = array();
$status->libraries = array();
$src = $parent->getParent()->getPath('source');
$manifest = $parent->getParent()->manifest;
$plugins = $manifest->xpath('plugins/plugin');
foreach ($plugins as $plugin) {
$name = (string) $plugin->attributes()->plugin;
$group = (string) $plugin->attributes()->group;
$path = $src . '/plugins/' . $group;
if (JFolder::exists($src . '/plugins/' . $group . '/' . $name)) {
$path = $src . '/plugins/' . $group . '/' . $name;
}
$installer = new JInstaller();
$result = $installer->install($path);
$query = "UPDATE #__extensions SET enabled=1 WHERE type='plugin' AND element=" . $db->Quote($name) . " AND folder=" . $db->Quote($group);
$db->setQuery($query);
$db->query();
$status->plugins[] = array('name' => $name, 'group' => $group, 'result' => $result);
}
$modules = $manifest->xpath('modules/module');
foreach ($modules as $module) {
$name = (string) $module->attributes()->module;
$client = (string) $module->attributes()->client;
if (is_null($client)) {
$client = 'site';
}
$client == 'administrator' ? $path = $src . '/administrator/modules/' . $name : ($path = $src . '/modules/' . $name);
if ($client == 'administrator') {
$db->setQuery("SELECT id FROM #__modules WHERE `module` = " . $db->quote($name));
$isUpdate = (int) $db->loadResult();
}
$installer = new JInstaller();
$result = $installer->install($path);
$status->modules[] = array('name' => $name, 'client' => $client, 'result' => $result);
if ($client == 'administrator' && !$isUpdate) {
$position = version_compare(JVERSION, '3.0', '<') && $name == 'mod_k2_quickicons' ? 'icon' : 'cpanel';
$db->setQuery("UPDATE #__modules SET `position`=" . $db->quote($position) . ",`published`='1' WHERE `module`=" . $db->quote($name));
$db->query();
$db->setQuery("SELECT id FROM #__modules WHERE `module` = " . $db->quote($name));
$id = (int) $db->loadResult();
$db->setQuery("INSERT IGNORE INTO #__modules_menu (`moduleid`,`menuid`) VALUES (" . $id . ", 0)");
$db->query();
}
}
$libraries = $manifest->xpath('library/library');
foreach ($libraries as $library) {
$name = (string) $library->attributes()->name;
$path = $src . '/libraries/' . $name;
$installer = new JInstaller();
$result = $installer->install($path);
$status->libraries[] = array('name' => $name, 'client' => '', 'result' => $result);
}
$this->installationResults($status);
}