function displaySchemaDiff() { require_once KPATH_ADMIN . '/install/schema.php'; $schema = new KunenaModelSchema(); $diff = $schema->getDiffSchema(); $sql = $schema->getSchemaSQL($diff); echo '<textarea cols="80" rows="20">'; echo $this->escape($diff->saveXML()); echo '</textarea>'; if (KunenaForum::isDev()) { echo '<textarea cols="80" rows="20">'; foreach ($sql as $item) { echo $this->escape($item['sql']) . "\n\n"; } echo '</textarea>'; } }
/** * @param string $type * @param JInstallerFile $parent * @return bool */ public function preflight($type, $parent) { if (!in_array($type, array('install', 'update'))) return true; $app = JFactory::getApplication(); // Do not install if Kunena doesn't exist. if (!class_exists('KunenaForum') || !KunenaForum::isCompatible('4.0')) { $app->enqueueMessage(sprintf ( 'Kunena %s has not been installed, aborting!', '4.0' ), 'notice'); return false; } if (KunenaForum::isDev()) { $app->enqueueMessage(sprintf ( 'You have installed Kunena from GitHub, aborting!' ), 'notice'); return false; } // Get list of languages to be installed. $source = $parent->getParent()->getPath('source').'/language'; $languages = JFactory::getLanguage()->getKnownLanguages(); /** @var SimpleXMLElement $files */ $files = $parent->manifest->files; foreach ($languages as $language) { $name = "com_kunena_{$language['tag']}"; $search = JFolder::files($source, $name); if (empty($search)) continue; // Generate <file type="file" client="site" id="fi-FI">com_kunena_fi-FI_v2.0.0-BETA2-DEV2.zip</file> $file = $files->addChild('file', array_pop($search)); $file->addAttribute('type', 'file'); $file->addAttribute('client', 'site'); $file->addAttribute('id', $name); echo sprintf('Installing language %s - %s ...', $language['tag'], $language['name']) . '<br />'; } if (empty($files)) { $app->enqueueMessage(sprintf ( 'Your site is English only. There\'s no need to install Kunena language pack.' ), 'notice'); return false; } // Remove old K1.7 style language pack. $table = JTable::getInstance('extension'); $id = $table->find(array('type'=>'file', 'element'=>"kunena_language_pack")); if ($id) { $installer = new JInstaller(); $installer->uninstall ( 'file', $id ); } return true; }
public static function addScript($filename) { $document = JFactory::getDocument (); $config = KunenaFactory::getConfig (); // Replace edit.js and mediaboxAdv.js with the new version of the file $filename = preg_replace('#^.*/(editor(-min)?.js)$#', KUNENA_DIRECTURL.'template/blue_eagle/js/\1', $filename); $filename = preg_replace('#^.*/(mediaboxAdv(-min)?.js)$#', JUri::root(true).'/media/kunena/js/\1', $filename); // Replace everything else that points to default template with media $filename = preg_replace('#/components/com_kunena/template/default/js/#', '/media/kunena/js/', $filename); if (JDEBUG || $config->debug || KunenaForum::isDev()) { // If we are in debug more, make sure we load the unpacked javascript $filename = preg_replace ( '/\-min\./u', '.', $filename ); } return $document->addScript( $filename ); }
public function stepExtract() { $path = JPATH_ADMINISTRATOR . '/components/com_kunena/archive'; if (KunenaForum::isDev() || !is_file("{$path}/fileformat")) { // Git install $dir = JPATH_ADMINISTRATOR . '/components/com_kunena/media/kunena'; if (is_dir($dir)) { JFolder::copy($dir, KPATH_MEDIA, false, true); } $this->setStep($this->getStep() + 1); return; } $ext = file_get_contents("{$path}/fileformat"); static $files = array(array('name' => 'com_kunena-admin', 'dest' => KPATH_ADMIN), array('name' => 'com_kunena-site', 'dest' => KPATH_SITE), array('name' => 'com_kunena-media', 'dest' => KPATH_MEDIA)); static $ignore = array(KPATH_ADMIN => array('index.html', 'kunena.xml', 'kunena.j25.xml', 'admin.kunena.php', 'api.php', 'archive', 'install', 'language'), KPATH_SITE => array('index.html', 'kunena.php', 'router.php', 'COPYRIGHT.php', 'template', 'language')); $task = $this->getTask(); // Extract archive files if (isset($files[$task])) { $file = $files[$task]; if (file_exists("{$path}/{$file['name']}{$ext}")) { $dest = $file['dest']; if (!empty($ignore[$dest])) { // Delete all files and folders (cleanup) $this->deleteFolder($dest, $ignore[$dest]); if ($dest == KPATH_SITE) { $this->deleteFolder("{$dest}/template/blue_eagle", array('params.ini')); $this->deleteFolder("{$dest}/template/mirage", array('params.ini')); } } // Copy new files into folder $this->extract($path, $file['name'] . $ext, $dest, KunenaForum::isDev()); } $this->setTask($task + 1); } else { if (function_exists('apc_clear_cache')) { apc_clear_cache('system'); } // Force page reload to avoid MySQL timeouts after extracting $this->checkTimeout(true); if (!$this->getInstallError()) { $this->setStep($this->getStep() + 1); } } }
echo JText::_('COM_KUNENA_A_PURGE_RE_STATEMENTS'); ?> </span> </a> <a class="btn" href="index.php?option=com_kunena&view=tools&layout=cleanupip"> <img src="components/com_kunena/media/icons/large/cleanupip.png" alt="<?php echo JText::_('COM_KUNENA_CPANEL_LABEL_CLEANUP_IP'); ?> " /><br /> <span><?php echo JText::_('COM_KUNENA_CPANEL_LABEL_CLEANUP_IP'); ?> </span> </a> <?php if (KunenaForum::isDev()) { ?> <a class="btn" href="index.php?option=com_kunena&view=install"> <img src="components/com_kunena/media/icons/large/install.png" alt="<?php echo JText::_('COM_KUNENA_GIT_INSTALL'); ?> " /><br /> <span><?php echo JText::_('COM_KUNENA_GIT_INSTALL'); ?> </span> </a> <?php } ?> </div>
protected function checkKunena($version) { $app = JFactory::getApplication(); // Always load Kunena API if it exists. $api = JPATH_ADMINISTRATOR . '/components/com_kunena/api.php'; if (file_exists($api)) { require_once $api; } // Do not install over Git repository (K1.6+). if (class_exists('Kunena') && method_exists('Kunena', 'isSvn') && Kunena::isSvn() || class_exists('KunenaForum') && method_exists('KunenaForum', 'isDev') && KunenaForum::isDev()) { $app->enqueueMessage('Oops! You should not install Kunena over your Git reporitory!', 'notice'); return false; } $db = JFactory::getDBO(); // Check if Kunena can be found from the database $table = $db->getPrefix() . 'kunena_version'; $db->setQuery("SHOW TABLES LIKE {$db->quote($table)}"); if ($db->loadResult() != $table) { return true; } // Get installed Kunena version $db->setQuery("SELECT version FROM {$db->quoteName($table)} ORDER BY `id` DESC", 0, 1); $installed = $db->loadResult(); if (!$installed) { return true; } // Always allow upgrade to the newer version if (version_compare($version, $installed, '>=')) { return true; } // Check if we can downgrade to the current version if (class_exists('KunenaInstaller')) { if (KunenaInstaller::canDowngrade($version)) { return true; } } else { // Workaround when Kunena files were removed to allow downgrade between bugfix versions. $major = preg_replace('/(\\d+.\\d+)\\..*$/', '\\1', $version); if (version_compare($installed, $major, '>')) { return true; } } $app->enqueueMessage(sprintf('Sorry, it is not possible to downgrade Kunena %s to version %s.', $installed, $version), 'notice'); return false; }
* Kunena Component * * @package Kunena.Installer * * @copyright (C) 2008 - 2015 Kunena Team. All rights reserved. * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL * @link http://www.kunena.org **/ defined('_JEXEC') or die; /* ************************/ /* KUNENA FORUM INSTALLER */ $app = JFactory::getApplication(); $view = $app->input->getCmd('view'); $task = $app->input->getCmd('task'); // Special case for developer versions. if ($view != 'install' && class_exists('KunenaForum') && KunenaForum::isDev()) { // Developer version found: Check if latest version of Kunena has been installed. If not, prepare installation. require_once __DIR__ . '/install/version.php'; $kversion = new KunenaVersion(); if (!$kversion->checkVersion()) { JFactory::getApplication()->redirect(JUri::base(true) . '/index.php?option=com_kunena&view=install'); } return; } // Run the installer... require_once __DIR__ . '/install/controller.php'; $controller = new KunenaControllerInstall(); $controller->execute($task); $controller->redirect();
<img src="components/com_kunena/media/icons/large/menu.png" alt="<?php echo JText::_('COM_KUNENA_A_MENU_MANAGER') ?>" /><br /> <span><?php echo JText::_('COM_KUNENA_A_MENU_MANAGER'); ?></span> </a> <a class="btn" href="index.php?option=com_kunena&view=tools&layout=purgerestatements"> <img src="components/com_kunena/media/icons/large/purgerestatements.png" alt="<?php echo JText::_('COM_KUNENA_A_PURGE_RE_STATEMENTS') ?>" /><br /> <span><?php echo JText::_('COM_KUNENA_A_PURGE_RE_STATEMENTS'); ?></span> </a> <a class="btn" href="index.php?option=com_kunena&view=tools&layout=cleanupip"> <img src="components/com_kunena/media/icons/large/cleanupip.png" alt="<?php echo JText::_('COM_KUNENA_CPANEL_LABEL_CLEANUP_IP') ?>" /><br /> <span><?php echo JText::_('COM_KUNENA_CPANEL_LABEL_CLEANUP_IP'); ?></span> </a> <a class="btn" href="index.php?option=com_kunena&view=tools&layout=uninstall"> <img src="components/com_kunena/media/icons/large/uninstall_kunena.png" alt="<?php echo JText::_('COM_KUNENA_TOOLS_LABEL_UNINSTALL_PROCESS'); ?>" /><br /> <span><?php echo JText::_('COM_KUNENA_TOOLS_LABEL_UNINSTALL_PROCESS'); ?></span> </a> <?php if (KunenaForum::isDev()) : ?> <a class="btn" href="index.php?option=com_kunena&view=install"> <img src="components/com_kunena/media/icons/large/install.png" alt="<?php echo JText::_('COM_KUNENA_GIT_INSTALL') ?>" /><br /> <span><?php echo JText::_('COM_KUNENA_GIT_INSTALL'); ?></span> </a> <?php endif; ?> </div> <div class="clearfix"></div> </div> </section> </div> <div class="pull-right small"> <?php echo KunenaVersion::getLongVersionHTML(); ?> </div> </div>
function uninstall() { if (!JSession::checkToken('get')) { $this->setRedirect('index.php?option=com_kunena'); return; } $this->model->setAction('uninstall'); $this->model->deleteTables('kunena_'); $app = JFactory::getApplication(); $app->enqueueMessage(JText::_('COM_KUNENA_INSTALL_REMOVED')); if (class_exists('KunenaForum') && !KunenaForum::isDev()) { jimport('joomla.filesystem.folder'); jimport('joomla.application.component.helper'); JFolder::delete(KPATH_MEDIA); $installer = new JInstaller(); $component = JComponentHelper::getComponent('com_kunena'); $installer->uninstall('component', $component->id); $this->setRedirect('index.php?option=com_installer'); } else { $this->setRedirect('index.php?option=com_kunena&view=install'); } }
public function stepFinish() { KunenaForum::setup(); $lang = JFactory::getLanguage(); $lang->load('com_kunena', JPATH_SITE) || $lang->load('com_kunena', KUNENA_INSTALLER_SITEPATH); $this->createMenu(false); // Fix broken category aliases (workaround for < 2.0-DEV12 bug) KunenaForumCategoryHelper::fixAliases(); // Clean cache, just in case KunenaMenuHelper::cleanCache(); /** @var JCache|JCacheController $cache */ $cache = JFactory::getCache(); $cache->clean('com_kunena'); // Delete installer file (only if not using GIT build). if (!KunenaForum::isDev()) { JFile::delete(KPATH_ADMIN . '/install.php'); } if (!$this->getInstallError()) { $this->updateVersionState(''); $this->addStatus(JText::_('COM_KUNENA_INSTALL_SUCCESS'), true, ''); $this->setStep($this->getStep() + 1); } }
/** * Wrapper to addScript * * @param $filename * * @return JDocument */ function addScript($filename) { if (!preg_match('|https?://|', $filename)) { $filename = preg_replace('|^js/|u', '', $filename); $filemin_path = preg_replace('/\\.js$/u', '-min.js', $filename); if (!JDEBUG && !KunenaFactory::getConfig()->debug && !KunenaForum::isDev() && is_file(JPATH_ROOT . "/media/kunena/{$filemin_path}")) { // If we are in debug more, make sure we load the unpacked css $filename = preg_replace('/\\.js$/u', '-min.js', $filename); } $filename = $this->getFile($filename, true, $this->pathTypes['js'], 'media/kunena/js', 'default'); } return JFactory::getDocument()->addScript($filename); }
/** * Wrapper to addScript */ function addScript($filename) { if (!JDEBUG && !KunenaFactory::getConfig()->debug && !KunenaForum::isDev()) { // If we are in debug more, make sure we load the unpacked css $filename = preg_replace('/\\.js$/u', '-min.js', $filename); } return JFactory::getDocument()->addScript($this->getFile($filename, true, '', 'media/kunena', 'default')); }