Skip to content
Merged
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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 23 additions & 11 deletions core/components/com_installer/admin/controllers/customexts.php
Original file line number Diff line number Diff line change
Expand Up @@ -673,7 +673,8 @@ public function doUpdateTask()
}

// vars to hold results of pull
$msg = array();
$success = array();
$failed = array();

// loop through each extension and pull code from repos
foreach ($ids as $id)
Expand All @@ -684,22 +685,33 @@ public function doUpdateTask()
$update_response = Cli::call($museCmd, $task='repository');
$update_response = json_decode($update_response == null ? '' : $update_response);

// add output message, success or failure, just output.
$msg[] = array(
'extension' => $extension->get('name'),
'message' => $update_response
);

// Run migrations
$migrations_response = Cli::migration($dryRun=false, $ignoreDates=true, $file=null, $dir='up', $folder=$extension->path);
$migrations_response = json_decode($migrations_response == null ? '' : $migration_response);
// In minimal/json mode muse emits an empty array on success and a non-empty
// array of error strings on failure. A null result means muse did not run.
if (is_null($update_response) || !empty($update_response))
{
$failed[] = array(
'extension' => $extension->get('name'),
'message' => is_array($update_response) ? $update_response : array(Lang::txt('COM_INSTALLER_CUSTOMEXTS_PULL_FAIL_GENERIC'))
);
}
else
{
// Run migrations only when the update succeeded
$migrations_response = Cli::migration($dryRun=false, $ignoreDates=true, $file=null, $dir='up', $folder=$extension->path);
$migrations_response = json_decode($migrations_response == null ? '' : $migrations_response);

$success[] = array(
'extension' => $extension->get('name'),
'message' => array(Lang::txt('COM_INSTALLER_CUSTOMEXTS_PULL_SUCCESS'))
);
}
}

// display view
$this->view
->setLayout('merged')
->set('msg', $msg)
->set('success', $success)
->set('failed', $failed)
->display();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,8 @@ COM_INSTALLER_CUSTOMEXTS_MERGE_CODE="Merge Code"
COM_INSTALLER_CUSTOMEXTS_FETCH_SUCCESS="The following extensions successfully fetched from the upstream repo."
COM_INSTALLER_CUSTOMEXTS_FETCH_SUCCESS_DESC="The following changes have been fetched and will be merged if you continue..."
COM_INSTALLER_CUSTOMEXTS_PULL_SUCCESS="The following extensions successfully updated"
COM_INSTALLER_CUSTOMEXTS_PULL_FAIL="The following extensions failed to update"
COM_INSTALLER_CUSTOMEXTS_PULL_FAIL_GENERIC="Update failed: muse returned no response."
COM_INSTALLER_CUSTOMEXTS_FETCH_CODE_UP_TO_DATE="Your code is currently up to date!"
COM_INSTALLER_CUSTOMEXTS_MERGE="MERGE"
COM_INSTALLER_CUSTOMEXTS_FETCH_FAIL="ERROR FETCH FAILURE"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,29 +17,50 @@
?>

<form action="<?php echo Route::url('index.php?option=' . $this->option . '&controller=' . $this->controller); ?>" method="post" name="adminForm" id="adminForm">

<?php if (!empty($this->success)) : ?>
<table class="adminlist success">
<thead>
<tr>
<th scope="col"><?php echo Lang::txt('COM_INSTALLER_CUSTOMEXTS_PULL_SUCCESS'); ?></th>
</tr>
</thead>
<tbody>
<?php foreach ($this->msg as $msg) : ?>
<?php foreach ($this->success as $item) : ?>
<tr>
<td>
<?php
echo '<strong> Extension: ' . $msg['extension'] . '</strong>';
?>
<br />
<br />
<pre><?php echo $msg['message']; ?></pre>
<strong>Extension: <?php echo $item['extension']; ?></strong>
<hr />
<code><?php echo implode('<br>', $item['message']); ?></code>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
<?php endif; ?>
<br /><br />

<?php if (!empty($this->failed)) : ?>
<table class="adminlist failed">
<thead>
<tr>
<th scope="col"><?php echo Lang::txt('COM_INSTALLER_CUSTOMEXTS_PULL_FAIL'); ?></th>
</tr>
</thead>
<tbody>
<?php foreach ($this->failed as $item) : ?>
<tr>
<td>
<strong>Extension: <?php echo $item['extension']; ?></strong>
<hr />
<pre><?php echo implode('<br>', is_array($item['message']) ? $item['message'] : array($item['message'])); ?></pre>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
<?php endif; ?>

<input type="hidden" name="option" value="<?php echo $this->option ?>" />
<input type="hidden" name="controller" value="<?php echo $this->controller; ?>">
<input type="hidden" name="task" value="" />
Expand Down