Skip to content
This repository has been archived by the owner on Mar 30, 2019. It is now read-only.

Fix bug with RocketTheme extensions #238

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion README.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Requirements

Support
===============
* Documentation for *Podcast Manager* is available on my website at http://www.babdev.com/extensions/podcast-manager.
* Documentation for *Podcast Manager* is available on my website at https://www.babdev.com/extensions/podcast-manager.
* If you've found a bug, please report it to the Issue Tracker at https://github.com/BabDev/podcast-manager/issues.

Installation Package
Expand Down
6 changes: 5 additions & 1 deletion build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<project name="podcast-manager" default="dev_head" basedir=".">
<!-- Project properties -->
<property name="repo.dir" value="." />
<property name="version" value="2.2.0-dev" />
<property name="version" value="2.2.0" />
<tstamp>
<format property="build.date" pattern="yyyy-MM-dd" />
</tstamp>
Expand Down Expand Up @@ -40,6 +40,8 @@
</zip>
<echo message="Building Hathor Overrides package" />
<zip destfile="files_podcastmanager_hathor_${version}.zip" basedir="packaging/files_podcastmanager_hathor" />
<echo message="Building Isis Overrides package" />
<zip destfile="files_podcastmanager_strapped_${version}.zip" basedir="packaging/strapped" />
</target>

<!-- Build a package for release -->
Expand All @@ -57,6 +59,8 @@
</zip>
<echo message="Building Hathor Overrides package" />
<zip destfile="releases/files_podcastmanager_hathor_${version}.zip" basedir="packaging/files_podcastmanager_hathor" />
<echo message="Building Isis Overrides package" />
<zip destfile="releases/files_podcastmanager_strapped_${version}.zip" basedir="packaging/strapped" />
<echo message="Committing version" />
<git command="commit">
<args>
Expand Down
121 changes: 117 additions & 4 deletions com_podcastmanager/admin/controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* @package PodcastManager
* @subpackage com_podcastmanager
*
* @copyright Copyright (C) 2011-2014 Michael Babker. All rights reserved.
* @copyright Copyright (C) 2011-2015 Michael Babker. All rights reserved.
* @license GNU/GPL - http://www.gnu.org/copyleft/gpl.html
*
* Podcast Manager is based upon the ideas found in Podcast Suite created by Joe LeBlanc
Expand Down Expand Up @@ -38,7 +38,7 @@ class PodcastManagerController extends JControllerLegacy
* @param array $urlparams An array of safe url parameters and their variable types,
* for valid values see {@link JFilterInput::clean()}.
*
* @return JControllerLegacy A JControllerLegacy object to support chaining.
* @return PodcastManagerController Instance of $this to support chaining.
*
* @since 1.6
*/
Expand Down Expand Up @@ -71,8 +71,121 @@ public function display($cachable = false, $urlparams = array())
return false;
}

parent::display();
return parent::display();
}

/**
* Executes the extension's migration steps
*
* @return void
*
* @since 2.2
*/
public function migrate()
{
JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN'));

$errors = array();
$input = JFactory::getApplication('administrator')->input;
$migrationTasks = json_decode(base64_decode($input->getBase64('migrationTasks')), true);

if (count($migrationTasks))
{
$tasks = array_keys($migrationTasks);

foreach ($tasks as $task)
{
switch ($task)
{
case 'noFeedType' :
case 'noPodcastType' :
include_once JPATH_COMPONENT . '/helpers/podcastmanager.php';

try
{
PodcastManagerHelper::insertUcmRecords();
}
catch (RuntimeException $e)
{
$errors[] = JText::sprintf(
'COM_PODCASTMANAGER_MIGRATION_ERROR_INSERTING_UCM_RECORDS',
strtolower(str_replace(array('no', 'Type'), '', $task)),
$e->getMessage()
);
}

break;

case 'noLayouts' :
// To build the package URL, we'll need to get the extension's version
$manifest = JApplicationHelper::parseXMLInstallFile(JPATH_ADMINISTRATOR . '/components/com_podcastmanager/podcastmanager.xml');
$version = $manifest['version'];
$url = 'https://github.com/BabDev/Podcast-Manager/releases/download/' . $version . '/files_podcastmanager_strapped_' . $version . '.zip';

// Download the package at the URL given.
$file = JInstallerHelper::downloadPackage($url);

// Was the package downloaded?
if (!$file)
{
$errors[] = JText::_('COM_PODCASTMANAGER_MIGRATION_ERROR_DOWNLOADING_PACKAGE');

continue;
}

$tmpPath = JFactory::getConfig()->get('tmp_path');

// Unpack the downloaded package file.
$package = JInstallerHelper::unpack($tmpPath . '/' . $file, true);

// Was the package unpacked?
if (!$package || !$package['type'])
{
JInstallerHelper::cleanupInstall($package['packagefile'], $package['extractdir']);
$errors[] = JText::_('COM_PODCASTMANAGER_MIGRATION_ERROR_EXTRACTING_PACKAGE');

continue;
}

// Get an installer instance.
$installer = new JInstaller;

// Install the package.
if (!$installer->install($package['dir']))
{
// There was an error installing the package.
$errors[] = JText::_('COM_PODCASTMANAGER_MIGRATION_ERROR_INSTALLING_PACKAGE');
}

// Cleanup the install files.
if (!is_file($package['packagefile']))
{
$package['packagefile'] = JFactory::getConfig()->get('tmp_path') . '/' . $package['packagefile'];
}

JInstallerHelper::cleanupInstall($package['packagefile'], $package['extractdir']);

break;

default:
$errors[] = JText::sprintf('COM_PODCASTMANAGER_MIGRATION_ERROR_BAD_TASK', $task);

break;
}
}
}

if (count($errors))
{
$message = JText::sprintf('COM_PODCASTMANAGER_MIGRATION_ERRORS', implode("\n", $errors));
$msgType = 'error';
}
else
{
$message = JText::_('COM_PODCASTMANAGER_MIGRATION_SUCCESSFUL');
$msgType = 'success';
}

return $this;
$this->setRedirect(JRoute::_('index.php?option=com_podcastmanager'), $message, $msgType);
}
}
2 changes: 1 addition & 1 deletion com_podcastmanager/admin/controllers/feed.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* @package PodcastManager
* @subpackage com_podcastmanager
*
* @copyright Copyright (C) 2011-2014 Michael Babker. All rights reserved.
* @copyright Copyright (C) 2011-2015 Michael Babker. All rights reserved.
* @license GNU/GPL - http://www.gnu.org/copyleft/gpl.html
*
* Podcast Manager is based upon the ideas found in Podcast Suite created by Joe LeBlanc
Expand Down
2 changes: 1 addition & 1 deletion com_podcastmanager/admin/controllers/feeds.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* @package PodcastManager
* @subpackage com_podcastmanager
*
* @copyright Copyright (C) 2011-2014 Michael Babker. All rights reserved.
* @copyright Copyright (C) 2011-2015 Michael Babker. All rights reserved.
* @license GNU/GPL - http://www.gnu.org/copyleft/gpl.html
*
* Podcast Manager is based upon the ideas found in Podcast Suite created by Joe LeBlanc
Expand Down
2 changes: 1 addition & 1 deletion com_podcastmanager/admin/controllers/podcast.json.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* @package PodcastManager
* @subpackage com_podcastmanager
*
* @copyright Copyright (C) 2011-2014 Michael Babker. All rights reserved.
* @copyright Copyright (C) 2011-2015 Michael Babker. All rights reserved.
* @license GNU/GPL - http://www.gnu.org/copyleft/gpl.html
*
* Podcast Manager is based upon the ideas found in Podcast Suite created by Joe LeBlanc
Expand Down
2 changes: 1 addition & 1 deletion com_podcastmanager/admin/controllers/podcast.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* @package PodcastManager
* @subpackage com_podcastmanager
*
* @copyright Copyright (C) 2011-2014 Michael Babker. All rights reserved.
* @copyright Copyright (C) 2011-2015 Michael Babker. All rights reserved.
* @license GNU/GPL - http://www.gnu.org/copyleft/gpl.html
*
* Podcast Manager is based upon the ideas found in Podcast Suite created by Joe LeBlanc
Expand Down
2 changes: 1 addition & 1 deletion com_podcastmanager/admin/controllers/podcasts.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* @package PodcastManager
* @subpackage com_podcastmanager
*
* @copyright Copyright (C) 2011-2014 Michael Babker. All rights reserved.
* @copyright Copyright (C) 2011-2015 Michael Babker. All rights reserved.
* @license GNU/GPL - http://www.gnu.org/copyleft/gpl.html
*
* Podcast Manager is based upon the ideas found in Podcast Suite created by Joe LeBlanc
Expand Down
2 changes: 1 addition & 1 deletion com_podcastmanager/admin/helpers/html/podcast.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* @package PodcastManager
* @subpackage com_podcastmanager
*
* @copyright Copyright (C) 2011-2014 Michael Babker. All rights reserved.
* @copyright Copyright (C) 2011-2015 Michael Babker. All rights reserved.
* @license GNU/GPL - http://www.gnu.org/copyleft/gpl.html
*
* Podcast Manager is based upon the ideas found in Podcast Suite created by Joe LeBlanc
Expand Down
Loading