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();
 }
Exemple #2
0
 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;
 }
 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();
 }
 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);
 }
 public function install($adapter)
 {
     /** @var $plugin JTableExtension */
     $plugin = JTable::getInstance('extension');
     if (!$plugin->load(array('type' => 'plugin', 'folder' => 'system', 'element' => 'communitybuilder'))) {
         return false;
     }
     /** @var $legacy JTableExtension */
     $legacy = JTable::getInstance('extension');
     if ($legacy->load(array('type' => 'plugin', 'folder' => 'system', 'element' => 'cbcoreredirect'))) {
         $pluginParams = new JRegistry();
         $pluginParams->loadString($plugin->get('params'));
         $legacyParams = new JRegistry();
         $legacyParams->loadString($legacy->get('params'));
         $pluginParams->set('rewrite_urls', $legacyParams->get('rewrite_urls', 1));
         $pluginParams->set('itemids', $legacyParams->get('itemids', 1));
         $plugin->set('params', $pluginParams->toString());
         $installer = new JInstaller();
         try {
             $installer->uninstall('plugin', $legacy->get('extension_id'));
         } catch (RuntimeException $e) {
         }
     }
     $plugin->set('enabled', 1);
     return $plugin->store();
 }
Exemple #6
0
 function uninstall($parent)
 {
     $db = JFactory::getDBO();
     $manifest = $parent->getParent()->manifest;
     $plugins = $manifest->xpath('plugins/plugin');
     foreach ($plugins as $plugin) {
         $name = (string) $plugin->attributes()->plugin;
         $group = (string) $plugin->attributes()->group;
         $query = $db->getQuery(true);
         $query->select($db->quoteName('extension_id'));
         $query->from($db->quoteName('#__extensions'));
         $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);
         $extensions = $db->loadColumn();
         if (count($extensions)) {
             foreach ($extensions as $id) {
                 $installer = new JInstaller();
                 $installer->uninstall('plugin', $id);
             }
         }
     }
     self::displayDonation();
 }
Exemple #7
0
 /**
  * method to uninstall the component
  *
  * @return void
  */
 function uninstall($parent)
 {
     return;
     //XXX not working, need to install all plugins/modules separately
     // $parent is the class calling this method
     echo '<p>' . JText::_('COM_HELLOWORLD_UNINSTALL_TEXT') . '</p>';
     $manifest = $parent->get("manifest");
     $parent = $parent->getParent();
     $source = $parent->getPath("source");
     $installer = new JInstaller();
     $db = JFactory::getDBO();
     // Install plugins
     foreach ($manifest->plugins->plugin as $plugin) {
         $attributes = $plugin->attributes();
         $plg = $source . '/' . $attributes['folder'] . '/' . $attributes['plugin'];
         $plg = $source . '/' . $attributes['folder'];
         $name = $attributes['plugin'];
         /*			print_r ($attributes);
         				echo "X";
         				$type = 'user';
         				$data = JPluginHelper::getPlugin ($type, 'joomdlehooks');
         				print_r ($data);
         */
         $query = 'SELECT extension_id ' . ' FROM #__extensions' . " WHERE name = '{$name}'";
         $db->setQuery($query);
         $extension_id = $db->loadResult();
         $installer->uninstall('plugin', $extension_id);
     }
 }
Exemple #8
0
 /**
  * method to uninstall the component
  *
  * @return void
  */
 function uninstall($parent)
 {
     // $parent is the class calling this method
     //echo '<p>' . JText::_('COM_HELLOWORLD_UNINSTALL_TEXT') . '</p>';
     $db =& JFactory::getDBO();
     // uninstalling jumi module
     $db->setQuery("select extension_id from #__extensions where name = 'Jumi' and type = 'module' and element = 'mod_jumi'");
     $jumi_module = $db->loadObject();
     $module_uninstaller = new JInstaller();
     if (@$module_uninstaller->uninstall('module', $jumi_module->extension_id)) {
         echo 'Module uninstall success', '<br />';
     } else {
         echo 'Module uninstall failed', '<br />';
     }
     // uninstalling jumi plugin
     $db->setQuery("select extension_id from #__extensions where name = 'System - Jumi' and type = 'plugin' and element = 'jumi'");
     $jumi_plugin = $db->loadObject();
     $plugin_uninstaller = new JInstaller();
     if ($plugin_uninstaller->uninstall('plugin', $jumi_plugin->extension_id)) {
         echo 'Plugin uninstall success', '<br />';
     } else {
         echo 'Plugin uninstall failed', '<br />';
     }
     // uninstalling jumi router
     $db->setQuery("select extension_id from #__extensions where name = 'System - Jumi Router' and type = 'plugin' and element = 'jumirouter'");
     $jumi_router = $db->loadObject();
     $plugin_uninstaller = new JInstaller();
     if ($plugin_uninstaller->uninstall('plugin', $jumi_router->extension_id)) {
         echo 'Router uninstall success', '<br />';
     } else {
         echo 'Router uninstall failed', '<br />';
     }
 }
 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;
 }
Exemple #10
0
        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);
            }
        }
function installHotelPackages()
{
    jimport('joomla.installer.installer');
    // Install Package Manager
    $basedir = dirname(__FILE__);
    $packageDir = JPATH_ADMINISTRATOR . '/components/com_jhotelreservation/extensions';
    if (!is_dir($packageDir)) {
        $packageDir = $basedir . '/admin/extensions';
    }
    $extensionsDirs = JFolder::folders($packageDir);
    foreach ($extensionsDirs as $extensionDir) {
        $tmpInstaller = new JInstaller();
        if (!$tmpInstaller->update($packageDir . '/' . $extensionDir)) {
            JError::raiseWarning(100, "Extension :" . $extensionDir);
        }
    }
    $db = JFactory::getDBO();
    $db->setQuery(" UPDATE #__extensions SET enabled=1 WHERE name='Hotel Url Translator' ");
    $db->query();
    $db = JFactory::getDBO();
    $db->setQuery(" UPDATE #__extensions SET enabled=1 WHERE name='Hotel Gallery' ");
    $db->query();
    $path = JPATH_ADMINISTRATOR . '/components/com_jhotelreservation/help/readme.html';
    ?>
		
		<div style="text-align: left; float: left;">
		<?php 
    include $path;
    ?>
		</div>
<?php 
}
/**
 * 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;
}
Exemple #13
0
 /**
  * method to run after an install/update/uninstall method
  *
  * @return void
  */
 function postflight($type, $parent)
 {
     $manifest = $parent->getParent()->getManifest();
     if ($type != 'uninstall' && !$this->_installAllowed($manifest)) {
         return false;
     }
     // Remove AjaxHelpAry
     $db = JFactory::getDbo();
     $query = $db->getQuery(true);
     $query->select(array('extension_id', 'name', 'params', 'element'));
     $query->from('#__extensions');
     $query->where($db->quoteName('element') . ' = ' . $db->quote('ajaxhelpary'));
     $query->where($db->quoteName('folder') . ' = ' . $db->quote('ajax'));
     $db->setQuery($query);
     $row = $db->loadAssoc();
     if (!empty($row)) {
         $installer = new JInstaller();
         $res = $installer->uninstall('plugin', $row['extension_id']);
         if ($res) {
             $msg = '<b style="color:green">' . JText::sprintf('COM_INSTALLER_UNINSTALL_SUCCESS', $row['name']) . '</b>';
         } else {
             $msg = '<b style="color:red">' . JText::sprintf('COM_INSTALLER_UNINSTALL_ERROR', $row['name']) . '</b>';
         }
         $this->messages[] = $msg;
     }
     parent::postflight($type, $parent, $publishPlugin = true);
 }
 /**
  * After update of an extension.
  *
  * @param  JInstaller  $installer  Installer object
  * @param  integer     $eid        Extension identifier
  */
 public function onExtensionAfterUpdate($installer, $eid)
 {
     $msg = '';
     $msg .= $eid === false ? 'Failed extension update: ' . $installer->getError() : 'Extension update successful';
     $msg .= $eid ? ' with updated extension ID ' . $eid : ' with no extension ID detected or multiple extension IDs assigned';
     JLog::add($msg, JLog::INFO, __METHOD__);
 }
 /**
  * method to uninstall the component
  *
  * @return void
  */
 function uninstall($parent)
 {
     $installer = new JInstaller();
     $db = JFactory::getDbo();
     $tableExtensions = "#__extensions";
     //$db->quote("#__extensions");
     $columnElement = "element";
     //$db->quote("element");
     $columnType = "type";
     //$db->quote("type");
     $columnFolder = "folder";
     //$db->quote("folder");
     // Find AdmirorGallery plugin ID
     $db->setQuery("SELECT extension_id\n\t\t\t\tFROM \n\t\t\t\t\t{$tableExtensions}\n\t\t\t\tWHERE\n\t\t\t\t\t{$columnElement}='admirorgallery'\n\t\t\t\tAND\n\t\t\t\t\t{$columnType}='plugin'\n\t\t\t\tAND\n\t\t\t\t\t{$columnFolder}='content'");
     $admirorgallery_id = $db->loadResult();
     $this->gallery_uninstall_result = $installer->uninstall('plugin', $admirorgallery_id);
     // Find AdmirorButton ID
     $db->setQuery("SELECT extension_id\n\t\t\t\tFROM \n\t\t\t\t\t{$tableExtensions}\n\t\t\t\tWHERE\n\t\t\t\t\t{$columnElement}='admirorbutton'\n\t\t\t\tAND\n\t\t\t\t\t{$columnType}='plugin'\n\t\t\t\tAND\n\t\t\t\t\t{$columnFolder}='editors-xtd'");
     $admirorbutton_id = $db->loadResult();
     $this->button_uninstall_result = $installer->uninstall('plugin', $admirorbutton_id);
     $gallery_status = $this->gallery_uninstall_result ? JText::_('Removed') : JText::_('Error');
     $button_status = $this->button_uninstall_result ? JText::_('Removed') : JText::_('Error');
     $html = '<h2>Admiror Gallery ' . JText::_('Uninstall') . '</h2>
             <table class="adminlist">
                     <thead>
                             <tr>
                                     <th class="title" colspan="2">' . JText::_('Extension') . '</th>
                                     <th width="30%">' . JText::_('Status') . '</th>
                             </tr>
                     </thead>
                     <tfoot>
                             <tr>
                                     <td colspan="3"></td>
                             </tr>
                     </tfoot>
                     <tbody>
                             <tr class="row0">
                                     <td class="key" colspan="2">Admiror Gallery ' . JText::_('Component') . '</td>
                                     <td><strong>' . JText::_('Removed') . '</strong></td>
                             </tr>
                             <tr class="row1">
                                     <th>' . JText::_('Plugin') . '</th>
                                     <th>' . JText::_('Group') . '</th>
                                     <th></th>
                             </tr>
                             <tr class="row0">
                                     <td class="key">' . ucfirst('Admiror Gallery Plugin') . '</td>
                                     <td class="key">' . ucfirst('content') . '</td>
                                     <td><strong>' . $gallery_status . '</strong></td>
                             </tr>
                             <tr class="row0">
                                     <td class="key">' . ucfirst('Admiror Button') . '</td>
                                     <td class="key">' . ucfirst('editors-xtd') . '</td>
                                     <td><strong>' . $button_status . '</strong></td>
                             </tr>
                     </tbody>
             </table>';
     echo $html;
 }
Exemple #16
0
	public function uninstallLanguage($tag, $name) {
		$table = JTable::getInstance('extension');
		$id = $table->find(array('type'=>'file', 'element'=>"com_kunena_{$tag}"));
		if (!$id) return;

		$installer = new JInstaller();
		$installer->uninstall ( 'file', $id );
	}
 /**
  * method to run after an install/update/uninstall method
  *
  * @param   string      $type    Installation type (install, update, discover_install)
  * @param   JInstaller  $parent  Parent object
  *
  * @return void
  */
 function postflight($type, $parent)
 {
     $src = $parent->getParent()->getPath('source');
     // Install the babioon Library
     $source = $src . '/library/babioon';
     $installer = new JInstaller();
     $result = $installer->install($source);
 }
 /**
  * Called after any type of action
  *
  * @param   string  $route  Which action is happening (install|uninstall|discover_install)
  * @param   JAdapterInstance  $adapter  The object responsible for running this script
  *
  * @return  boolean  True on success
  */
 public function postflight($type, $parent)
 {
     $installer = new JInstaller();
     $src = $parent->getParent()->getPath('source');
     $installer->install($src . '/plg_braftoncron');
     $installer_2 = new JInstaller();
     $src_2 = $parent->getParent()->getPath('source');
     $installer_2->install($src_2 . '/plg_braftoncontent');
 }
 /**
  * Check if FoF is already installed and install if not
  *
  * @param   object  $parent  class calling this method
  *
  * @return  array            Array with performed actions summary
  */
 private function _installFOF($parent)
 {
     $src = $parent->getParent()->getPath('source');
     // Load dependencies
     JLoader::import('joomla.filesystem.file');
     JLoader::import('joomla.utilities.date');
     $source = $src . '/fof';
     if (!defined('JPATH_LIBRARIES')) {
         $target = JPATH_ROOT . '/libraries/fof';
     } else {
         $target = JPATH_LIBRARIES . '/fof';
     }
     $haveToInstallFOF = false;
     if (!is_dir($target)) {
         $haveToInstallFOF = true;
     } else {
         $fofVersion = array();
         if (file_exists($target . '/version.txt')) {
             $rawData = JFile::read($target . '/version.txt');
             $info = explode("\n", $rawData);
             $fofVersion['installed'] = array('version' => trim($info[0]), 'date' => new JDate(trim($info[1])));
         } else {
             $fofVersion['installed'] = array('version' => '0.0', 'date' => new JDate('2011-01-01'));
         }
         $rawData = JFile::read($source . '/version.txt');
         $info = explode("\n", $rawData);
         $fofVersion['package'] = array('version' => trim($info[0]), 'date' => new JDate(trim($info[1])));
         $haveToInstallFOF = $fofVersion['package']['date']->toUNIX() > $fofVersion['installed']['date']->toUNIX();
     }
     $installedFOF = false;
     if ($haveToInstallFOF) {
         $versionSource = 'package';
         $installer = new JInstaller();
         $installedFOF = $installer->install($source);
     } else {
         $versionSource = 'installed';
     }
     if (!isset($fofVersion)) {
         $fofVersion = array();
         if (file_exists($target . '/version.txt')) {
             $rawData = JFile::read($target . '/version.txt');
             $info = explode("\n", $rawData);
             $fofVersion['installed'] = array('version' => trim($info[0]), 'date' => new JDate(trim($info[1])));
         } else {
             $fofVersion['installed'] = array('version' => '0.0', 'date' => new JDate('2011-01-01'));
         }
         $rawData = JFile::read($source . '/version.txt');
         $info = explode("\n", $rawData);
         $fofVersion['package'] = array('version' => trim($info[0]), 'date' => new JDate(trim($info[1])));
         $versionSource = 'installed';
     }
     if (!$fofVersion[$versionSource]['date'] instanceof JDate) {
         $fofVersion[$versionSource]['date'] = new JDate();
     }
     return array('required' => $haveToInstallFOF, 'installed' => $installedFOF, 'version' => $fofVersion[$versionSource]['version'], 'date' => $fofVersion[$versionSource]['date']->format('Y-m-d'));
 }
 function getManifestObject($path)
 {
     $installer = new JInstaller();
     $installer->setPath('source', $path);
     if (!$installer->setupInstall()) {
         return null;
     }
     $manifest =& $installer->getManifest();
     return $manifest;
 }
Exemple #21
0
 private function uninstallModule($name)
 {
     $this->db->setQuery("select extension_id from #__extensions where type = 'module' and element = " . $this->db->Quote($name));
     $obj = $this->db->loadObject();
     if (!$obj) {
         return 0;
     }
     $installer = new JInstaller();
     return $installer->uninstall('module', $obj->extension_id);
 }
Exemple #22
0
        function install()
        {
            $pkg_path = JPATH_ADMINISTRATOR . DS . 'components' . DS . $this->com . DS . 'extensions' . DS;
            $extensions = array_merge(JFolder::folders($pkg_path, '^(?!com_)\\w+$'), JFolder::folders($pkg_path, '^com_\\w+$'));
            $v3 = version_compare(JVERSION, '3.0.0', 'ge');
            if ($v3) {
                foreach ($extensions as $pkg) {
                    $f = $pkg_path . DS . $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) {
                if ($pkg == 'plg_offlajnjoomla3compat' && !$v3 || $pkg == 'plg_sticky_toolbar' && !$v3) {
                    continue;
                }
                $installer = new JInstaller();
                $installer->setOverwrite(true);
                if ($success = $installer->install($pkg_path . DS . $pkg)) {
                    $msgcolor = "#E0FFE0";
                    $msgtext = "{$pkg} successfully installed.";
                } else {
                    $msgcolor = "#FFD0D0";
                    $msgtext = "ERROR: Could not install the {$pkg}. Please contact us on our support page: http://offlajn.com/support.html";
                }
                ?>
        <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 '%offlajn%' OR name LIKE 'Nextend Joomla 3.0 compatibility' OR name LIKE 'Nextend Dojo Loader'");
            } else {
                $db->setQuery("UPDATE #__extensions SET enabled=1 WHERE (name LIKE '%offlajn%' OR name LIKE 'Nextend Joomla 3.0 compatibility' OR name LIKE 'Nextend Dojo Loader') AND type='plugin'");
            }
            $db->query();
        }
Exemple #23
0
 public function run($app)
 {
     // uninstall shortcut plugin
     jimport('joomla.installer.installer');
     // set query
     $query = 'SELECT extension_id as id FROM #__extensions WHERE element = ' . $app->database->Quote('zooshortcut');
     // query extension id and client id
     if ($res = $app->database->queryObject($query)) {
         $installer = new JInstaller();
         $installer->uninstall('plugin', $res->id, 0);
     }
 }
 function update($parent)
 {
     $manifest = $parent->get('manifest');
     $parent = $parent->getParent();
     $source = $parent->getPath('source');
     $installer = new JInstaller();
     foreach ($manifest->plugins->plugin as $plugin) {
         $attributes = $plugin->attributes();
         $plg = $source . DS . $attributes['folder'] . DS . $attributes['plugin'];
         $installer->install($plg);
     }
 }
Exemple #25
0
 /**
  * Method to install the embedded third extensions.
  *
  * @access	private
  * @param	JAdapterInstance	$adapter	Installer Component Adapter.
  * @return	void
  *
  * @since	Cook 2.6
  */
 private function installExtensions(JAdapterInstance $adapter)
 {
     $dir = $adapter->getParent()->getPath('source') . DS . 'extensions';
     $installResults = array();
     jimport('joomla.filesystem.folder');
     $folders = JFolder::folders($dir);
     foreach ($folders as $folder) {
         $source = $dir . DS . $folder;
         $installer = new JInstaller();
         $installResults[] = $installer->install($source);
     }
 }
Exemple #26
0
 function uninstallPlugin($folder, $name)
 {
     // Joomla 2.5+
     $query = "SELECT extension_id FROM #__extensions WHERE type='plugin' AND folder='{$folder}' AND element='{$name}'";
     $db = JFactory::getDbo();
     $db->setQuery($query);
     $pluginid = $db->loadResult();
     if ($pluginid) {
         $installer = new JInstaller();
         $installer->uninstall('plugin', $pluginid);
     }
 }
 public function ppInstall()
 {
     jimport('joomla.filesystem.file');
     jimport('joomla.installer.installer');
     $db =& JFactory::getDBO();
     $this->path = JInstaller::getInstance()->getPath('extension_administrator');
     // sposto la cartella "propayment"
     $src = $this->path . DS . "propayment";
     $dst = JPATH_ROOT . DS . "propayment";
     $this->recurse_move($src, $dst);
     echo "<div>Cartella 'propayment' installata nel sito</div>";
     // creo la sottocartella "log" (se non esiste)
     @mkdir($dst . "/log");
     // installo il plugin
     jimport('joomla.installer.installer');
     $installer = new JInstaller();
     $result = $installer->install($this->path . DS . 'plugin');
     if ($result) {
         // abilito il plugin
         if (version_compare(JVERSION, '1.6.0', 'ge')) {
             $q = "UPDATE #__extensions SET enabled=1, name='VM - Payment, ProPayment' WHERE folder='vmpayment' AND element='propayment'";
         } else {
             $q = "UPDATE #__plugins SET published=1, name='VM - Payment, ProPayment' WHERE folder='vmpayment' AND element='propayment'";
         }
         $db->setQuery($q);
         $db->query();
         // elimino la cartella "plugin"
         $this->recursiveDelete($this->path . DS . 'plugin');
         echo "<h3>Componente e Plugin ProPayment installati.</h3>";
     } else {
         echo "<h3>Errore nell'installazione del plugin per VirtueMart 2!</h3>";
     }
     // modifico le voci di menu, in caso di Joomla 1.5
     if (!version_compare(JVERSION, '1.6.0', 'ge')) {
         $q = "UPDATE #__components SET name='ProPayment' WHERE name='COM_PROPAYMENT' AND `option`='com_propayment'";
         $db->setQuery($q);
         $db->query();
         $q = "UPDATE #__components SET name='Configurazione' WHERE name='MNU_CONFIG' AND `option`='com_propayment'";
         $db->setQuery($q);
         $db->query();
         $q = "UPDATE #__components SET name='Installazione moduli' WHERE name='MNU_INSTALL' AND `option`='com_propayment'";
         $db->setQuery($q);
         $db->query();
         $q = "UPDATE #__components SET name='Log errori' WHERE name='MNU_LOG_ERR' AND `option`='com_propayment'";
         $db->setQuery($q);
         $db->query();
         $q = "UPDATE #__components SET name='Log transazioni' WHERE name='MNU_LOG_TRN' AND `option`='com_propayment'";
         $db->setQuery($q);
         $db->query();
     }
     return true;
 }
Exemple #28
0
 function com_install()
 {
     JAVoiceHelpers::Install_Db();
     $messages = array();
     // Import required modules
     jimport('joomla.installer.installer');
     jimport('joomla.installer.helper');
     jimport('joomla.filesystem.file');
     // Get packages
     $p_dir = JPath::clean(JPATH_SITE . '/components/com_javoice/packages');
     // Did you give us a valid directory?
     if (!is_dir($p_dir)) {
         $messages[] = JText::_('Package directory(Related modules, plugins) is missing');
     } else {
         $subpackages = JFolder::files($p_dir);
         $result = true;
         $installer = new JInstaller();
         if ($subpackages) {
             $app = JFactory::getApplication();
             $templateDir = 'templates/' . $app->getTemplate();
             foreach ($subpackages as $zpackage) {
                 if (JFile::getExt($p_dir . DS . $zpackage) != "zip") {
                     continue;
                 }
                 $subpackage = JInstallerHelper::unpack($p_dir . DS . $zpackage);
                 if ($subpackage) {
                     $type = JInstallerHelper::detectType($subpackage['dir']);
                     if (!$type) {
                         $messages[] = '<img src="' . $templateDir . '/images/admin/publish_x.png" alt="" width="16" height="16" />&nbsp;<span style="color:#FF0000;">' . JText::_($zpackage . " Not valid package") . '</span>';
                         $result = false;
                     }
                     if (!$installer->install($subpackage['dir'])) {
                         // There was an error installing the package
                         $messages[] = '<img src="' . $templateDir . '/images/admin/publish_x.png" alt="" width="16" height="16" />&nbsp;<span style="color:#FF0000;">' . JText::sprintf('Install %s: %s', $type . " " . JFile::getName($zpackage), JText::_('Error')) . '</span>';
                     } else {
                         $messages[] = '<img src="' . $templateDir . '/images/admin/tick.png" alt="" width="16" height="16" />&nbsp;<span style="color:#00FF00;">' . JText::sprintf('Install %s: %s', $type . " " . JFile::getName($zpackage), JText::_('Success')) . '</span>';
                     }
                     if (!is_file($subpackage['packagefile'])) {
                         $subpackage['packagefile'] = $p_dir . DS . $subpackage['packagefile'];
                     }
                     if (is_dir($subpackage['extractdir'])) {
                         JFolder::delete($subpackage['extractdir']);
                     }
                     if (is_file($subpackage['packagefile'])) {
                         JFile::delete($subpackage['packagefile']);
                     }
                 }
             }
         }
         JFolder::delete($p_dir);
     }
 }
Exemple #29
0
 /**
  * Runs after install, update or discover_update. In other words, it executes after Joomla! has finished installing
  * or updating your component. This is the last chance you've got to perform any additional installations, clean-up,
  * database updates and similar housekeeping functions.
  *
  * @param   string     $type   install, update or discover_update
  * @param   JInstaller $parent Parent object
  */
 function postflight($type, $parent)
 {
     $this->isPaid = is_dir($parent->getParent()->getPath('source') . '/plugins/system/srp');
     parent::postflight($type, $parent);
     // Make sure the two plugins folders exist in Core release and are empty
     if (!$this->isPaid) {
         if (!JFolder::exists(JPATH_ADMINISTRATOR . '/components/com_akeeba/plugins')) {
             JFolder::create(JPATH_ADMINISTRATOR . '/components/com_akeeba/plugins');
         }
         if (!JFolder::exists(JPATH_ADMINISTRATOR . '/components/com_akeeba/akeeba/plugins')) {
             JFolder::create(JPATH_ADMINISTRATOR . '/components/com_akeeba/akeeba/plugins');
         }
     }
 }
Exemple #30
0
 private function chain_install(&$parent)
 {
     $manifest = $parent->get("manifest");
     $p_installer = $parent->getParent();
     $installer = new JInstaller();
     // Install modules
     if (is_object($manifest->modules->module)) {
         foreach ($manifest->modules->module as $module) {
             $attributes = $module->attributes();
             $mod = $p_installer->getPath("source") . DS . $attributes['folder'] . DS . $attributes['module'];
             $installer->install($mod);
         }
     }
 }