示例#1
0
    /**
     * Method to run after an install/update/uninstall method
     *
     * @param string                     $type
     * @param JInstallerAdapterComponent $parent
     *
     * @return  void
     */
    public function postflight($type, \JInstallerAdapterComponent $parent)
    {
        $db = JFactory::getDbo();
        // Get install manifest
        // ========================================================================
        $p_installer = $parent->getParent();
        $installer = new JInstaller();
        $manifest = $p_installer->manifest;
        $path = $p_installer->getPath('source');
        $result = array();
        $css = <<<CSS
<style type="text/css">
#ak-install-img
{
}

#ak-install-msg
{
}
</style>
CSS;
        echo $css;
        $installScript = dirname($path) . '/windwalker/src/System/installscript.php';
        if (!is_file($installScript)) {
            $installScript = JPATH_LIBRARIES . '/windwalker/src/System/installscript.php';
        }
        include $installScript;
    }
示例#2
0
 /**
  * method to run before an install/update/uninstall method
  *
  * @param   string                      $type    'install', 'update' or 'discover_install'
  * @param   JInstallerAdapterComponent  $parent  Installerobject
  *
  * @return  boolean  false will terminate the installation
  */
 public function preflight($type, $parent)
 {
     $min_version = (string) $parent->get('manifest')->attributes()->version;
     $jversion = new JVersion();
     if (!$jversion->isCompatible($min_version)) {
         JFactory::getApplication()->enqueueMessage(JText::sprintf('PLG_CONTENT_BIBLELINK_XT_VERSION_UNSUPPORTED', $min_version), 'error');
         return false;
     }
     return true;
 }
示例#3
0
 /**
  * Copying files
  *
  * @param   string                     $type   Installation type
  * @param   JInstallerAdapterComponent $parent Installation adapter
  *
  * @return bool False if something happens
  */
 public function postflight($type, $parent)
 {
     // Enabling Neno plugin
     $db = JFactory::getDbo();
     $query = $db->getQuery(true);
     $query->update('#__extensions')->set('enabled = 1')->where(array('type = ' . $db->quote('plugin'), 'folder = ' . $db->quote('system'), 'element = ' . $db->quote('neno')));
     $db->setQuery($query);
     $db->execute();
     $parent->getParent()->setRedirectURL(JRoute::_('index.php?option=com_neno&view=installation', false));
     return true;
 }
示例#4
0
 /**
  * method to run before an install/update/uninstall method
  *
  * @param   string                     $type   'install', 'update' or 'discover_install'
  * @param   JInstallerAdapterComponent $parent Installerobject
  *
  * @since  1.0
  *
  * @return  boolean  false will terminate the installation
  */
 public function preflight($type, $parent)
 {
     $min_version = (string) $parent->get('manifest')->attributes()->version;
     $jversion = new JVersion();
     if (!$jversion->isCompatible($min_version)) {
         $this->app->enqueueMessage(JText::sprintf('COM_SICHTWEITEN_VERSION_UNSUPPORTED', $min_version), 'error');
         return false;
     }
     // Storing old release number for process in postflight
     if ($type == 'update') {
         $this->oldRelease = $this->getParam('version');
     }
     return true;
 }
示例#5
0
 /**
  * Copying files
  *
  * @param   string                     $type   Installation type
  * @param   JInstallerAdapterComponent $parent Installation adapter
  *
  * @return bool False if something happens
  */
 public function postflight($type, $parent)
 {
     $installationPath = $parent->getParent()->getPath('source');
     jimport('joomla.filesystem.folder');
     // If the layout folder exists, let's delete them first
     if (JFolder::exists(JPATH_ROOT . '/layouts/libraries/neno')) {
         JFolder::delete(JPATH_ROOT . '/layouts/libraries/neno');
     }
     // Moving Layouts
     JFolder::move($installationPath . '/layouts', JPATH_ROOT . '/layouts/libraries/neno');
     // If the media folder exists, let's delete them first
     if (JFolder::exists(JPATH_ROOT . '/media/neno')) {
         JFolder::delete(JPATH_ROOT . '/media/neno');
     }
     // Moving media files
     JFolder::move($installationPath . '/media', JPATH_ROOT . '/media/neno');
     return true;
 }
示例#6
0
文件: script.php 项目: fracting/cmc
 /**
  * Executed on install/update/discover
  *
  * @param   string                      $type    - the type of th einstallation
  * @param   JInstallerAdapterComponent  $parent  - the parent JInstaller obeject
  *
  * @throws  Exception  - if library is not found
  *
  * @return boolean - true if everything is OK and we should continue with the installation
  */
 public function preflight($type, $parent)
 {
     $path = $parent->getParent()->getPath('source') . '/libraries/compojoom/libraries/compojoom/include.php';
     // Check if the file exists (on discover install it won't)
     if (JFile::exists($path)) {
         require_once $path;
     } else {
         // Try fallback to installed one
         $path = JPATH_ROOT . '/libraries/compojoom/include.php';
         if (JFile::exists($path)) {
             require_once $path;
         } else {
             throw new Exception("Compojoom library not found", 404);
         }
     }
     $this->installer = new CompojoomInstaller($type, $parent, 'com_cmc');
     if (!$this->installer->allowedInstall()) {
         return false;
     }
     return true;
 }
 /**
  * Constructor
  *
  * @param   string                      $type     - the installation type
  * @param   JInstallerAdapterComponent  $parent   - the parent object of the JInstaller
  * @param   string                      $extName  - the extension name
  */
 public function __construct($type, $parent, $extName)
 {
     $this->type = $type;
     $this->parent = $parent;
     // Load the library lang files
     if ($type == 'uninstall') {
         CompojoomLanguage::load('lib_compojoom', JPATH_ROOT);
         CompojoomLanguage::load('lib_compojoom.sys', JPATH_ROOT);
         // Now les us load the extension files
         CompojoomLanguage::load($extName, JPATH_ADMINISTRATOR);
         CompojoomLanguage::load($extName . '.sys', JPATH_ADMINISTRATOR);
     } else {
         CompojoomLanguage::load('lib_compojoom', $parent->getParent()->getPath('source') . '/libraries/compojoom');
         CompojoomLanguage::load('lib_compojoom.sys', $parent->getParent()->getPath('source') . '/libraries/compojoom');
         // Now les us load the extension files
         CompojoomLanguage::load($extName, $parent->getParent()->getPath('source') . '/administrator');
         CompojoomLanguage::load($extName . '.sys', $parent->getParent()->getPath('source') . '/administrator');
     }
     // Since Joomla translates the message before it has loaded the correct lang files
     // let us translate themessage again
     $manifest = $parent->getParent()->getManifest();
     $parent->getParent()->set('message', JText::_((string) $manifest->description));
     $this->addCss();
 }
 /**
  * Make sure the Component menu items are really published!
  *
  * @param JInstallerAdapterComponent $parent
  *
  * @return bool
  */
 private function _reallyPublishAdminMenuItems($parent)
 {
     $db = F0FPlatform::getInstance()->getDbo();
     $option = $parent->get('element');
     $query = $db->getQuery(true)->update('#__menu AS m')->join('LEFT', '#__extensions AS e ON m.component_id = e.extension_id')->set($db->qn('published') . ' = ' . $db->q(1))->where('m.parent_id = 1')->where('m.client_id = 1')->where('e.type = ' . $db->quote('component'))->where('e.element = ' . $db->quote($option));
     $db->setQuery($query);
     try {
         $db->execute();
     } catch (Exception $e) {
         // If it fails, it fails. Who cares.
     }
 }
 /**
  * Removes obsolete update sites created for the component (we are now using an update site for the package, not the
  * component).
  *
  * @param   JInstallerAdapterComponent  $parent  The parent installer
  */
 protected function removeObsoleteUpdateSites($parent)
 {
     $db = $parent->getParent()->getDbo();
     $query = $db->getQuery(true)->select($db->qn('extension_id'))->from($db->qn('#__extensions'))->where($db->qn('type') . ' = ' . $db->q('component'))->where($db->qn('name') . ' = ' . $db->q($this->componentName));
     try {
         $extensionId = $db->setQuery($query)->loadResult();
     } catch (Exception $e) {
         // Your database is broken.
         return;
     }
     if (!$extensionId) {
         return;
     }
     $query = $db->getQuery(true)->select($db->qn('update_site_id'))->from($db->qn('#__update_sites_extensions'))->where($db->qn('extension_id') . ' = ' . $db->q($extensionId));
     try {
         $ids = $db->setQuery($query)->loadColumn(0);
     } catch (Exception $e) {
         // Your database is broken.
         return;
     }
     if (!is_array($ids) && empty($ids)) {
         return;
     }
     foreach ($ids as $id) {
         $query = $db->getQuery(true)->delete($db->qn('#__update_sites'))->where($db->qn('update_site_id') . ' = ' . $db->q($id));
         $db->setQuery($query);
         try {
             $db->execute();
         } catch (\Exception $e) {
             // Do not fail in this case
         }
     }
 }
示例#10
0
    /**
     * Method to run after an install/update/uninstall method
     *
     * @param string                     $type
     * @param JInstallerAdapterComponent $parent
     *
     * @return  void
     */
    public function postflight($type, \JInstallerAdapterComponent $parent)
    {
        $db = JFactory::getDbo();
        // Get install manifest
        // ========================================================================
        $p_installer = $parent->getParent();
        $installer = new JInstaller();
        $manifest = $p_installer->manifest;
        $path = $p_installer->getPath('source');
        $result = array();
        $css = <<<CSS
<style type="text/css">
#ak-install-img
{
}

#ak-install-msg
{
}
</style>
CSS;
        echo $css;
        $installScript = dirname($path) . '/windwalker/src/System/installscript.php';
        if (!is_file($installScript)) {
            $installScript = JPATH_LIBRARIES . '/windwalker/src/System/installscript.php';
        }
        include $installScript;
        // Set Module active
        // ========================================================================
        if ($type == 'install') {
            $q = $db->getQuery(true);
            $q->select('*')->from('#__modules')->where("module='mod_akquickicons'");
            $db->setQuery($q);
            $module = $db->loadObject();
            $module->published = 1;
            $module->position = 'cpanel';
            $params = new stdClass();
            $params->catid = 1;
            $module->params = json_encode($params);
            $db->updateObject('#__modules', $module, 'id');
            $in = new stdClass();
            $in->moduleid = $module->id;
            $in->menuid = 0;
            $db->insertObject('#__modules_menu', $in);
        }
    }