Beispiel #1
0
    protected function renderPostUninstallation($status, $parent)
    {
        ?>
		<h2>Akeeba Backup Uninstallation Status</h2>
		<?php 
        parent::renderPostUninstallation($status, $parent);
    }
 public function preflight($type, $parent)
 {
     if (parent::preflight($type, $parent)) {
         $app = JFactory::getApplication();
         $configuration = JFactory::getConfig();
         $db = JFactory::getDbo();
         //check of curl is present
         if (!function_exists('curl_init') || !is_callable('curl_init')) {
             $msg = "<p>cURL extension is not enabled in your PHP installation. Please contact your hosting service provider</p>";
             if (version_compare(JVERSION, '3.0', 'gt')) {
                 JLog::add($msg, JLog::WARNING, 'jerror');
             } else {
                 JError::raiseWarning(100, $msg);
             }
             return false;
         }
         if (!function_exists('json_encode')) {
             $msg = "<p>JSON extension is not enabled in your PHP installation. Please contact your hosting service provider</p>";
             if (version_compare(JVERSION, '3.0', 'gt')) {
                 JLog::add($msg, JLog::WARNING, 'jerror');
             } else {
                 JError::raiseWarning(100, $msg);
             }
             return false;
         }
         //Get installed version
         //conservative method
         $xmlfile = JPATH_ADMINISTRATOR . '/components/com_j2store/manifest.xml';
         if (JFile::exists($xmlfile)) {
             $xml = JFactory::getXML($xmlfile);
             $version = (string) $xml->version;
             // abort if the current J2Store release is older
             if (version_compare($version, '3.0.0', 'lt')) {
                 $parent->getParent()->abort('You cannot install J2Store Version 3 over the old versions directly. A migration tool should be used first to migrate your previous store data.');
                 return false;
             }
         }
         //let us check the manifest cache as well. Cannot trust joomla installer
         $query = $db->getQuery(true);
         $query->select($db->quoteName('manifest_cache'))->from($db->quoteName('#__extensions'))->where($db->quoteName('element') . ' = ' . $db->quote('com_j2store'));
         $db->setQuery($query);
         $result = $db->loadResult();
         if ($result) {
             $manifest = json_decode($result);
             $version = $manifest->version;
             // abort if the current J2Store release is older
             if (version_compare($version, '3.0.0', 'lt')) {
                 $parent->getParent()->abort('You cannot install J2Store Version 3 over the old versions directly. A migration tool should be used first to migrate your previous store data.');
                 return false;
             }
         }
         //some times the user might have uninstalled v2 and try installing v3. Let us stop them doing so.
         //check for the prices table. It he has the prices table, then he is certainly having the old version.
         $db = JFactory::getDbo();
         //get the table list
         $alltables = $db->getTableList();
         //get prefix
         $prefix = $db->getPrefix();
         if (in_array($prefix . 'j2store_prices', $alltables)) {
             //user has the prices table. So the old version data might be there.
             $parent->getParent()->abort('Tables of J2Store Version 2.x found. If you have already installed J2Store Version 2, its tables might be there. If you do not have any data in those tables, then you can delete those tables via the phpmyadmin and then install J2store version 3. Otherwise, you will have to use our migration tool');
             return false;
         }
         //if we are here, then all checks are passed. Let us allow the user to install J2Store Version 3. Just make sure to remove the template overrides and incompatible modules
         //----file removal//
         //check in the template overrides.
         //first get the default template
         $query = "SELECT template FROM #__template_styles WHERE client_id = 0 AND home=1";
         $db->setQuery($query);
         $template = $db->loadResult();
         $template_path = JPATH_SITE . '/templates/' . $template . '/html';
         $com_override_path = $template_path . '/com_j2store';
         //j2store overrides - mycart
         if (JFolder::exists($com_override_path . '/carts')) {
             if (JFile::exists($com_override_path . '/carts/default_items.php')) {
                 if (!JFolder::move($com_override_path . '/carts/default_items.php', $com_override_path . '/carts/old_default_items.php')) {
                     $parent->getParent()->abort('Could not move file ' . $com_override_path . '/carts/default_items.php. It might be having old code. So please Check permissions and rename this file. ');
                     return false;
                 }
             }
         }
         if (JFolder::exists($com_override_path . '/cart')) {
             if (JFile::exists($com_override_path . '/cart/default_items.php')) {
                 if (!JFolder::move($com_override_path . '/cart/default_items.php', $com_override_path . '/cart/old_default_items.php')) {
                     $parent->getParent()->abort('Could not move file ' . $com_override_path . '/cart/default_items.php. It might be having old code. So please Check permissions and rename this file. ');
                     return false;
                 }
             }
         }
         //the following renaming should happen only during new installs. If its an update, then these issues probably taken care of.
         if ($type != 'update') {
             if (JFolder::exists($com_override_path . '/checkout')) {
                 if (JFile::exists($com_override_path . '/checkout/shipping_yes.php')) {
                     if (!JFolder::move($com_override_path . '/checkout/shipping_yes.php', $com_override_path . '/checkout/old_shipping_yes.php')) {
                         $parent->getParent()->abort('Could not move file ' . $com_override_path . '/checkout/shipping_yes.php. It might be having old code. So please Check permissions and rename this file. ');
                         return false;
                     }
                 }
             }
             //j2store overrides - products
             if (JFolder::exists($com_override_path . '/products')) {
                 if (JFolder::exists($com_override_path . '/old_products')) {
                     if (!JFolder::delete($com_override_path . '/old_products')) {
                         $parent->getParent()->abort('Could not delete folder ' . $com_override_path . '/products  Check permissions.');
                         return false;
                     }
                 }
                 if (!JFolder::move($com_override_path . '/products', $com_override_path . '/old_products')) {
                     $parent->getParent()->abort('Could not move folder ' . $com_override_path . '/products. Check permissions.');
                     return false;
                 }
             }
         }
         //----end of file removal//
         //all set. Lets rock..
         return true;
     } else {
         return false;
     }
 }
    protected function renderPostUninstallation($status, $parent)
    {
        ?>
<h2 style="font-size: 14pt; font-weight: black; padding: 0; margin: 0 0 0.5em;">&nbsp;Akeeba Subscriptions Uninstallation</h2>
<p>We are sorry that you decided to uninstall Akeeba Subscriptions. Please let us know why by using the Contact Us form on our site. We appreciate your feedback; it helps us develop better software!</p>

<?php 
        parent::renderPostUninstallation($status, $parent);
    }
    protected function renderPostUninstallation($status, $parent)
    {
        ?>
		<h2>Admin Tools Uninstallation Status</h2>
		<?php 
        parent::renderPostUninstallation($status, $parent);
    }
    /**
     * renderPostUninstallation
     *
     * @param   bool        $status  Param
     * @param   JInstaller  $parent  Parent object
     *
     * @return void
     */
    protected function renderPostUninstallation($status, $parent)
    {
        ?>
<h2><?php 
        echo $this->componentTitle;
        ?>
 Uninstallation Status</h2>
<?php 
        parent::renderPostUninstallation($status, $parent);
    }