| Current Path : /proc/1908984/root/proc/2603263/cwd/ |
| Current File : //proc/1908984/root/proc/2603263/cwd/Task.tar |
AbstractTask.php 0000644 00000002743 15235344133 0007654 0 ustar 00 <?php
/**
* @package akeebabackup
* @copyright Copyright (c)2006-2023 Nicholas K. Dionysopoulos / Akeeba Ltd
* @license GNU General Public License version 3, or later
*/
namespace Akeeba\Backup\Site\Model\Json\Task;
// Protect from unauthorized access
defined('_JEXEC') || die();
// Protect from unauthorized access
use Akeeba\Backup\Site\Model\Json\TaskInterface;
use FOF40\Container\Container;
class AbstractTask implements TaskInterface
{
/**
* The container of the component we belong to
*
* @var Container
*/
protected $container = null;
/**
* The method name
*
* @var string
*/
protected $methodName = '';
/**
* Public constructor
*
* @param Container $container The container of the component we belong to
*/
public function __construct(Container $container)
{
$this->container = $container;
$path = explode('\\', get_class($this));
$shortName = array_pop($path);
$this->methodName = lcfirst($shortName);
}
/**
* Return the JSON API task's name ("method" name). Remote clients will use it to call us.
*
* @return string
*/
public function getMethodName()
{
return $this->methodName;
}
/**
* Execute the JSON API task
*
* @param array $parameters The parameters to this task
*
* @return mixed
*
* @throws \RuntimeException In case of an error
*/
public function execute(array $parameters = array())
{
throw new \LogicException(__CLASS__ . ' has not implemented its execute() method yet.');
}
}
Browse.php 0000644 00000001377 15235344133 0006531 0 ustar 00 <?php
/**
* @package akeebabackup
* @copyright Copyright (c)2006-2023 Nicholas K. Dionysopoulos / Akeeba Ltd
* @license GNU General Public License version 3, or later
*/
namespace Akeeba\Backup\Site\Model\Json\Task;
// Protect from unauthorized access
defined('_JEXEC') || die();
use Joomla\CMS\Filter\InputFilter;
/**
* Return folder browser results
*
* @deprecated
*/
class Browse extends AbstractTask
{
/**
* Execute the JSON API task
*
* @param array $parameters The parameters to this task
*
* @return mixed
*
* @throws \RuntimeException In case of an error
*/
public function execute(array $parameters = [])
{
throw new \RuntimeException('This method is no longer supported by the Akeeba Remote JSON API', 501);
}
}
Delete.php 0000644 00000002174 15235344133 0006466 0 ustar 00 <?php
/**
* @package akeebabackup
* @copyright Copyright (c)2006-2023 Nicholas K. Dionysopoulos / Akeeba Ltd
* @license GNU General Public License version 3, or later
*/
namespace Akeeba\Backup\Site\Model\Json\Task;
// Protect from unauthorized access
defined('_JEXEC') || die();
use Akeeba\Backup\Site\Model\Statistics;
use Akeeba\Engine\Platform;
/**
* Delete a backup record
*/
class Delete extends AbstractTask
{
/**
* Execute the JSON API task
*
* @param array $parameters The parameters to this task
*
* @return mixed
*
* @throws \RuntimeException In case of an error
*/
public function execute(array $parameters = array())
{
// Get the passed configuration values
$defConfig = array(
'backup_id' => 0,
);
$defConfig = array_merge($defConfig, $parameters);
$backup_id = (int)$defConfig['backup_id'];
/** @var Statistics $model */
$model = $this->container->factory->model('Statistics')->tmpInstance();
$model->setState('id', $backup_id);
try
{
$model->delete();
}
catch (\Exception $e)
{
throw new \RuntimeException($e->getMessage(), 500);
}
return true;
}
}
DeleteFiles.php 0000644 00000002234 15235344133 0007446 0 ustar 00 <?php
/**
* @package akeebabackup
* @copyright Copyright (c)2006-2023 Nicholas K. Dionysopoulos / Akeeba Ltd
* @license GNU General Public License version 3, or later
*/
namespace Akeeba\Backup\Site\Model\Json\Task;
// Protect from unauthorized access
defined('_JEXEC') || die();
use Akeeba\Backup\Site\Model\Statistics;
use Akeeba\Engine\Platform;
/**
* Delete the backup archives of a backup record
*/
class DeleteFiles extends AbstractTask
{
/**
* Execute the JSON API task
*
* @param array $parameters The parameters to this task
*
* @return mixed
*
* @throws \RuntimeException In case of an error
*/
public function execute(array $parameters = array())
{
// Get the passed configuration values
$defConfig = array(
'backup_id' => 0,
);
$defConfig = array_merge($defConfig, $parameters);
$backup_id = (int)$defConfig['backup_id'];
/** @var Statistics $model */
$model = $this->container->factory->model('Statistics')->tmpInstance();
$model->setState('id', $backup_id);
try
{
$model->deleteFile();
}
catch (\Exception $e)
{
throw new \RuntimeException($e->getMessage(), 500);
}
return true;
}
}
DeleteProfile.php 0000644 00000001337 15235344133 0010007 0 ustar 00 <?php
/**
* @package akeebabackup
* @copyright Copyright (c)2006-2023 Nicholas K. Dionysopoulos / Akeeba Ltd
* @license GNU General Public License version 3, or later
*/
namespace Akeeba\Backup\Site\Model\Json\Task;
// Protect from unauthorized access
defined('_JEXEC') || die();
/**
* Delete a backup profile
*
* @deprecated
*/
class DeleteProfile extends AbstractTask
{
/**
* Execute the JSON API task
*
* @param array $parameters The parameters to this task
*
* @return mixed
*
* @throws \RuntimeException In case of an error
*/
public function execute(array $parameters = array())
{
throw new \RuntimeException('This method is no longer supported by the Akeeba Remote JSON API', 501);
}
}
Download.php 0000644 00000004376 15235344133 0007041 0 ustar 00 <?php
/**
* @package akeebabackup
* @copyright Copyright (c)2006-2023 Nicholas K. Dionysopoulos / Akeeba Ltd
* @license GNU General Public License version 3, or later
*/
namespace Akeeba\Backup\Site\Model\Json\Task;
// Protect from unauthorized access
defined('_JEXEC') || die();
use Akeeba\Engine\Factory;
use Akeeba\Engine\Platform;
/**
* Download a chunk of a backup archive over HTTP
*/
class Download extends AbstractTask
{
/**
* Execute the JSON API task
*
* @param array $parameters The parameters to this task
*
* @return mixed
*
* @throws \RuntimeException In case of an error
*/
public function execute(array $parameters = array())
{
// Get the passed configuration values
$defConfig = array(
'backup_id' => 0,
'part_id' => 1,
'segment' => 1,
'chunk_size' => 1
);
$defConfig = array_merge($defConfig, $parameters);
$backup_id = (int)$defConfig['backup_id'];
$part_id = (int)$defConfig['part_id'];
$segment = (int)$defConfig['segment'];
$chunk_size = (int)$defConfig['chunk_size'];
$backup_stats = Platform::getInstance()->get_statistics($backup_id);
if (empty($backup_stats))
{
// Backup record doesn't exist
throw new \RuntimeException('Invalid backup record identifier', 404);
}
$files = Factory::getStatistics()->get_all_filenames($backup_stats);
if ((($files === null ? 0 : count($files)) < $part_id) || ($part_id <= 0))
{
// Invalid part
throw new \RuntimeException('Invalid backup part', 404);
}
$file = $files[ $part_id - 1 ];
$filesize = @filesize($file);
$seekPos = $chunk_size * 1048576 * ($segment - 1);
if ($seekPos > $filesize)
{
// Trying to seek past end of file
throw new \RuntimeException('Invalid segment', 404);
}
$fp = fopen($file, 'r');
if ($fp === false)
{
// Could not read file
throw new \RuntimeException('Error reading backup archive', 500);
}
rewind($fp);
if (fseek($fp, $seekPos, SEEK_SET) === -1)
{
// Could not seek to position
throw new \RuntimeException('Error reading specified segment', 500);
}
$buffer = fread($fp, 1048576);
if ($buffer === false)
{
throw new \RuntimeException('Error reading specified segment', 500);
}
fclose($fp);
return base64_encode($buffer);
}
}
DownloadDirect.php 0000644 00000007123 15235344133 0010165 0 ustar 00 <?php
/**
* @package akeebabackup
* @copyright Copyright (c)2006-2023 Nicholas K. Dionysopoulos / Akeeba Ltd
* @license GNU General Public License version 3, or later
*/
namespace Akeeba\Backup\Site\Model\Json\Task;
// Protect from unauthorized access
defined('_JEXEC') || die();
use Akeeba\Engine\Factory;
use Akeeba\Engine\Platform;
/**
* Download an entire backup archive directly over HTTP
*/
class DownloadDirect extends AbstractTask
{
/**
* Execute the JSON API task
*
* @param array $parameters The parameters to this task
*
* @return mixed
*
* @throws \RuntimeException In case of an error
*/
public function execute(array $parameters = array())
{
// Get the passed configuration values
$defConfig = array(
'backup_id' => 0,
'part_id' => 1,
);
$defConfig = array_merge($defConfig, $parameters);
$backup_id = (int)$defConfig['backup_id'];
$part_id = (int)$defConfig['part_id'];
$backup_stats = Platform::getInstance()->get_statistics($backup_id);
if (empty($backup_stats))
{
// Backup record doesn't exist
@ob_end_clean();
header('HTTP/1.1 500 Invalid backup record identifier');
flush();
$this->container->platform->closeApplication();
}
$files = Factory::getStatistics()->get_all_filenames($backup_stats);
if ((($files === null ? 0 : count($files)) < $part_id) || ($part_id <= 0))
{
// Invalid part
@ob_end_clean();
header('HTTP/1.1 500 Invalid backup part');
flush();
$this->container->platform->closeApplication();
}
$filename = $files[ $part_id - 1 ];
@clearstatcache();
// For a certain unmentionable browser
if (function_exists('ini_get') && function_exists('ini_set'))
{
if (ini_get('zlib.output_compression'))
{
ini_set('zlib.output_compression', 'Off');
}
}
// Remove php's time limit
if (function_exists('ini_get') && function_exists('set_time_limit'))
{
if (!ini_get('safe_mode'))
{
@set_time_limit(0);
}
}
$basename = @basename($filename);
$fileSize = @filesize($filename);
$extension = strtolower(str_replace(".", "", strrchr($filename, ".")));
while (@ob_end_clean())
{
;
}
@clearstatcache();
// Send MIME headers
header('MIME-Version: 1.0');
header('Content-Disposition: attachment; filename="' . $basename . '"');
header('Content-Transfer-Encoding: binary');
header('Accept-Ranges: bytes');
switch ($extension)
{
case 'zip':
// ZIP MIME type
header('Content-Type: application/zip');
break;
default:
// Generic binary data MIME type
header('Content-Type: application/octet-stream');
break;
}
// Notify of file size, if this info is available
if ($fileSize > 0)
{
header('Content-Length: ' . @filesize($filename));
}
// Disable caching
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Expires: 0");
header('Pragma: no-cache');
flush();
if ($fileSize > 0)
{
// If the filesize is reported, use 1M chunks for echoing the data to the browser
$blockSize = 1048576; //1M chunks
$handle = @fopen($filename, "r");
// Now we need to loop through the file and echo out chunks of file data
if ($handle !== false)
{
while (!@feof($handle))
{
echo @fread($handle, $blockSize);
@ob_flush();
flush();
}
}
if ($handle !== false)
{
@fclose($handle);
}
}
else
{
// If the filesize is not reported, hope that readfile works
@readfile($filename);
}
flush();
$this->container->platform->closeApplication();
// Totally ignored, only added to make static analysis happy
return null;
}
}
ExportConfiguration.php 0000644 00000003220 15235344133 0011266 0 ustar 00 <?php
/**
* @package akeebabackup
* @copyright Copyright (c)2006-2023 Nicholas K. Dionysopoulos / Akeeba Ltd
* @license GNU General Public License version 3, or later
*/
namespace Akeeba\Backup\Site\Model\Json\Task;
// Protect from unauthorized access
defined('_JEXEC') || die();
use Akeeba\Backup\Site\Model\Profiles;
use Akeeba\Engine\Factory;
/**
* Export the profile's configuration
*/
class ExportConfiguration extends AbstractTask
{
/**
* Execute the JSON API task
*
* @param array $parameters The parameters to this task
*
* @return mixed
*
* @throws \RuntimeException In case of an error
*/
public function execute(array $parameters = array())
{
// Get the passed configuration values
$defConfig = array(
'profile' => 0,
);
$defConfig = array_merge($defConfig, $parameters);
$profile_id = (int)$defConfig['profile'];
if ($profile_id <= 0)
{
$profile_id = 1;
}
/** @var Profiles $profile */
$profile = $this->container->factory->model('Profiles')->tmpInstance();
$data = $profile->findOrFail($profile_id)->getData();
if (substr($data['configuration'], 0, 12) == '###AES128###')
{
// Load the server key file if necessary
if (!defined('AKEEBA_SERVERKEY'))
{
$filename = JPATH_COMPONENT_ADMINISTRATOR . '/BackupEngine/serverkey.php';
include_once $filename;
}
$key = Factory::getSecureSettings()->getKey();
$data['configuration'] = Factory::getSecureSettings()->decryptSettings($data['configuration'], $key);
}
return array(
'description' => $data['description'],
'configuration' => $data['configuration'],
'filters' => $data['filters'],
);
}
}
GetBackupInfo.php 0000644 00000003361 15235344133 0007744 0 ustar 00 <?php
/**
* @package akeebabackup
* @copyright Copyright (c)2006-2023 Nicholas K. Dionysopoulos / Akeeba Ltd
* @license GNU General Public License version 3, or later
*/
namespace Akeeba\Backup\Site\Model\Json\Task;
// Protect from unauthorized access
defined('_JEXEC') || die();
use Akeeba\Engine\Factory;
use Akeeba\Engine\Platform;
/**
* Get information for a given backup record
*/
class GetBackupInfo extends AbstractTask
{
/**
* Execute the JSON API task
*
* @param array $parameters The parameters to this task
*
* @return mixed
*
* @throws \RuntimeException In case of an error
*/
public function execute(array $parameters = array())
{
// Get the passed configuration values
$defConfig = array(
'backup_id' => 0,
);
$defConfig = array_merge($defConfig, $parameters);
$backup_id = (int)$defConfig['backup_id'];
// Get the basic statistics
$record = Platform::getInstance()->get_statistics($backup_id);
// Backup record doesn't exist
if (empty($record))
{
throw new \RuntimeException('Invalid backup record identifier', 404);
}
// Get a list of filenames
$filenames = Factory::getStatistics()->get_all_filenames($record);
if (empty($filenames))
{
// Archives are not stored on the server or no files produced
$record['filenames'] = array();
}
else
{
$filedata = array();
$i = 0;
// Get file sizes per part
foreach ($filenames as $file)
{
$i++;
$size = @filesize($file);
$size = is_numeric($size) ? $size : 0;
$filedata[] = array(
'part' => $i,
'name' => basename($file),
'size' => $size
);
}
// Add the file info to $record['filenames']
$record['filenames'] = $filedata;
}
return $record;
}
}
GetDBEntities.php 0000644 00000001504 15235344133 0007712 0 ustar 00 <?php
/**
* @package akeebabackup
* @copyright Copyright (c)2006-2023 Nicholas K. Dionysopoulos / Akeeba Ltd
* @license GNU General Public License version 3, or later
*/
namespace Akeeba\Backup\Site\Model\Json\Task;
// Protect from unauthorized access
defined('_JEXEC') || die();
use Joomla\CMS\Filter\InputFilter;
/**
* Get the database entities along with their filtering status (typically for rendering a GUI)
*
* @deprecated
*/
class GetDBEntities extends AbstractTask
{
/**
* Execute the JSON API task
*
* @param array $parameters The parameters to this task
*
* @return mixed
*
* @throws \RuntimeException In case of an error
*/
public function execute(array $parameters = [])
{
throw new \RuntimeException('This method is no longer supported by the Akeeba Remote JSON API', 501);
}
}
GetDBFilters.php 0000644 00000001403 15235344133 0007534 0 ustar 00 <?php
/**
* @package akeebabackup
* @copyright Copyright (c)2006-2023 Nicholas K. Dionysopoulos / Akeeba Ltd
* @license GNU General Public License version 3, or later
*/
namespace Akeeba\Backup\Site\Model\Json\Task;
// Protect from unauthorized access
defined('_JEXEC') || die();
use Joomla\CMS\Filter\InputFilter;
/**
* Get the database filters
*
* @deprecated
*/
class GetDBFilters extends AbstractTask
{
/**
* Execute the JSON API task
*
* @param array $parameters The parameters to this task
*
* @return mixed
*
* @throws \RuntimeException In case of an error
*/
public function execute(array $parameters = array())
{
throw new \RuntimeException('This method is no longer supported by the Akeeba Remote JSON API', 501);
}
}
GetDBRoots.php 0000644 00000001362 15235344133 0007236 0 ustar 00 <?php
/**
* @package akeebabackup
* @copyright Copyright (c)2006-2023 Nicholas K. Dionysopoulos / Akeeba Ltd
* @license GNU General Public License version 3, or later
*/
namespace Akeeba\Backup\Site\Model\Json\Task;
// Protect from unauthorized access
defined('_JEXEC') || die();
/**
* Get the database roots (database definitions)
*
* @deprecated
*/
class GetDBRoots extends AbstractTask
{
/**
* Execute the JSON API task
*
* @param array $parameters The parameters to this task
*
* @return mixed
*
* @throws \RuntimeException In case of an error
*/
public function execute(array $parameters = array())
{
throw new \RuntimeException('This method is no longer supported by the Akeeba Remote JSON API', 501);
}
}
GetFSEntities.php 0000644 00000001506 15235344133 0007737 0 ustar 00 <?php
/**
* @package akeebabackup
* @copyright Copyright (c)2006-2023 Nicholas K. Dionysopoulos / Akeeba Ltd
* @license GNU General Public License version 3, or later
*/
namespace Akeeba\Backup\Site\Model\Json\Task;
// Protect from unauthorized access
defined('_JEXEC') || die();
use Joomla\CMS\Filter\InputFilter;
/**
* Get the filesystem entities along with their filtering status (typically for rendering a GUI)
*
* @deprecated
*/
class GetFSEntities extends AbstractTask
{
/**
* Execute the JSON API task
*
* @param array $parameters The parameters to this task
*
* @return mixed
*
* @throws \RuntimeException In case of an error
*/
public function execute(array $parameters = [])
{
throw new \RuntimeException('This method is no longer supported by the Akeeba Remote JSON API', 501);
}
}
GetFSFilters.php 0000644 00000001402 15235344133 0007556 0 ustar 00 <?php
/**
* @package akeebabackup
* @copyright Copyright (c)2006-2023 Nicholas K. Dionysopoulos / Akeeba Ltd
* @license GNU General Public License version 3, or later
*/
namespace Akeeba\Backup\Site\Model\Json\Task;
// Protect from unauthorized access
defined('_JEXEC') || die();
use Joomla\CMS\Filter\InputFilter;
/**
* Get the filesystem filters
*
* @deprecated
*/
class GetFSFilters extends AbstractTask
{
/**
* Execute the JSON API task
*
* @param array $parameters The parameters to this task
*
* @return mixed
*
* @throws \RuntimeException In case of an error
*/
public function execute(array $parameters = [])
{
throw new \RuntimeException('This method is no longer supported by the Akeeba Remote JSON API', 501);
}
}
GetFSRoots.php 0000644 00000001410 15235344133 0007253 0 ustar 00 <?php
/**
* @package akeebabackup
* @copyright Copyright (c)2006-2023 Nicholas K. Dionysopoulos / Akeeba Ltd
* @license GNU General Public License version 3, or later
*/
namespace Akeeba\Backup\Site\Model\Json\Task;
// Protect from unauthorized access
defined('_JEXEC') || die();
/**
* Get the filesystem roots (site root and extra included directories)
*
* @deprecated
*/
class GetFSRoots extends AbstractTask
{
/**
* Execute the JSON API task
*
* @param array $parameters The parameters to this task
*
* @return mixed
*
* @throws \RuntimeException In case of an error
*/
public function execute(array $parameters = array())
{
throw new \RuntimeException('This method is no longer supported by the Akeeba Remote JSON API', 501);
}
}
GetGUIConfiguration.php 0000644 00000001400 15235344133 0011067 0 ustar 00 <?php
/**
* @package akeebabackup
* @copyright Copyright (c)2006-2023 Nicholas K. Dionysopoulos / Akeeba Ltd
* @license GNU General Public License version 3, or later
*/
namespace Akeeba\Backup\Site\Model\Json\Task;
// Protect from unauthorized access
defined('_JEXEC') || die();
/**
* Get the GUI definitions for the configuration page
*
* @deprecated
*/
class GetGUIConfiguration extends AbstractTask
{
/**
* Execute the JSON API task
*
* @param array $parameters The parameters to this task
*
* @return mixed
*
* @throws \RuntimeException In case of an error
*/
public function execute(array $parameters = array())
{
throw new \RuntimeException('This method is no longer supported by the Akeeba Remote JSON API', 501);
}
}
GetIncludedDBs.php 0000644 00000001351 15235344133 0010040 0 ustar 00 <?php
/**
* @package akeebabackup
* @copyright Copyright (c)2006-2023 Nicholas K. Dionysopoulos / Akeeba Ltd
* @license GNU General Public License version 3, or later
*/
namespace Akeeba\Backup\Site\Model\Json\Task;
// Protect from unauthorized access
defined('_JEXEC') || die();
/**
* Get the extra included databases
*
* @deprecated
*/
class GetIncludedDBs extends AbstractTask
{
/**
* Execute the JSON API task
*
* @param array $parameters The parameters to this task
*
* @return mixed
*
* @throws \RuntimeException In case of an error
*/
public function execute(array $parameters = array())
{
throw new \RuntimeException('This method is no longer supported by the Akeeba Remote JSON API', 501);
}
}
GetIncludedDirectories.php 0000644 00000001363 15235344133 0011647 0 ustar 00 <?php
/**
* @package akeebabackup
* @copyright Copyright (c)2006-2023 Nicholas K. Dionysopoulos / Akeeba Ltd
* @license GNU General Public License version 3, or later
*/
namespace Akeeba\Backup\Site\Model\Json\Task;
// Protect from unauthorized access
defined('_JEXEC') || die();
/**
* Get the extra included directories
*
* @deprecated
*/
class GetIncludedDirectories extends AbstractTask
{
/**
* Execute the JSON API task
*
* @param array $parameters The parameters to this task
*
* @return mixed
*
* @throws \RuntimeException In case of an error
*/
public function execute(array $parameters = array())
{
throw new \RuntimeException('This method is no longer supported by the Akeeba Remote JSON API', 501);
}
}
GetProfiles.php 0000644 00000002031 15235344133 0007477 0 ustar 00 <?php
/**
* @package akeebabackup
* @copyright Copyright (c)2006-2023 Nicholas K. Dionysopoulos / Akeeba Ltd
* @license GNU General Public License version 3, or later
*/
namespace Akeeba\Backup\Site\Model\Json\Task;
// Protect from unauthorized access
defined('_JEXEC') || die();
use Akeeba\Backup\Site\Model\Profiles;
/**
* Get a list of known backup profiles
*/
class GetProfiles extends AbstractTask
{
/**
* Execute the JSON API task
*
* @param array $parameters The parameters to this task
*
* @return mixed
*
* @throws \RuntimeException In case of an error
*/
public function execute(array $parameters = array())
{
/** @var Profiles $model */
$model = $this->container->factory->model('Profiles')->tmpInstance();
$profiles = $model->get(true);
$ret = array();
if (count($profiles))
{
foreach ($profiles as $profile)
{
$temp = new \stdClass();
$temp->id = $profile->id;
$temp->name = $profile->description;
$ret[] = $temp;
}
}
return $ret;
}
}
GetRegexDBFilters.php 0000644 00000001413 15235344133 0010530 0 ustar 00 <?php
/**
* @package akeebabackup
* @copyright Copyright (c)2006-2023 Nicholas K. Dionysopoulos / Akeeba Ltd
* @license GNU General Public License version 3, or later
*/
namespace Akeeba\Backup\Site\Model\Json\Task;
// Protect from unauthorized access
defined('_JEXEC') || die();
use Joomla\CMS\Filter\InputFilter;
/**
* Get the regex database filters
*
* @deprecated
*/
class GetRegexDBFilters extends AbstractTask
{
/**
* Execute the JSON API task
*
* @param array $parameters The parameters to this task
*
* @return mixed
*
* @throws \RuntimeException In case of an error
*/
public function execute(array $parameters = [])
{
throw new \RuntimeException('This method is no longer supported by the Akeeba Remote JSON API', 501);
}
}
GetRegexFSFilters.php 0000644 00000001415 15235344133 0010555 0 ustar 00 <?php
/**
* @package akeebabackup
* @copyright Copyright (c)2006-2023 Nicholas K. Dionysopoulos / Akeeba Ltd
* @license GNU General Public License version 3, or later
*/
namespace Akeeba\Backup\Site\Model\Json\Task;
// Protect from unauthorized access
defined('_JEXEC') || die();
use Joomla\CMS\Filter\InputFilter;
/**
* Get the regex filesystem filters
*
* @deprecated
*/
class GetRegexFSFilters extends AbstractTask
{
/**
* Execute the JSON API task
*
* @param array $parameters The parameters to this task
*
* @return mixed
*
* @throws \RuntimeException In case of an error
*/
public function execute(array $parameters = [])
{
throw new \RuntimeException('This method is no longer supported by the Akeeba Remote JSON API', 501);
}
}
GetVersion.php 0000644 00000002300 15235344133 0007340 0 ustar 00 <?php
/**
* @package akeebabackup
* @copyright Copyright (c)2006-2023 Nicholas K. Dionysopoulos / Akeeba Ltd
* @license GNU General Public License version 3, or later
*/
namespace Akeeba\Backup\Site\Model\Json\Task;
// Protect from unauthorized access
defined('_JEXEC') || die();
use Akeeba\Backup\Site\Model\Updates;
/**
* Get the version information of Akeeba Backup
*/
class GetVersion extends AbstractTask
{
/**
* Execute the JSON API task
*
* @param array $parameters The parameters to this task
*
* @return mixed
*
* @throws \RuntimeException In case of an error
*/
public function execute(array $parameters = array())
{
/** @var Updates $model */
$model = $this->container->factory->model('Updates')->tmpInstance();
$updateInformation = $model->getUpdates();
if (is_array($updateInformation) && array_key_exists('releasenotes', $updateInformation))
{
unset ($updateInformation['releasenotes']);
}
$edition = AKEEBA_PRO ? 'pro' : 'core';
return (object)array(
'api' => AKEEBA_JSON_API_VERSION,
'component' => AKEEBA_VERSION,
'date' => AKEEBA_DATE,
'edition' => $edition,
'updateinfo' => $updateInformation,
);
}
}
ImportConfiguration.php 0000644 00000002254 15235344133 0011265 0 ustar 00 <?php
/**
* @package akeebabackup
* @copyright Copyright (c)2006-2023 Nicholas K. Dionysopoulos / Akeeba Ltd
* @license GNU General Public License version 3, or later
*/
namespace Akeeba\Backup\Site\Model\Json\Task;
// Protect from unauthorized access
defined('_JEXEC') || die();
use Akeeba\Backup\Site\Model\Profiles;
use Akeeba\Engine\Factory;
/**
* Import the profile's configuration
*/
class ImportConfiguration extends AbstractTask
{
/**
* Execute the JSON API task
*
* @param array $parameters The parameters to this task
*
* @return mixed
*
* @throws \RuntimeException In case of an error
*/
public function execute(array $parameters = array())
{
// Get the passed configuration values
$defConfig = array(
'profile' => 0,
'data' => null,
);
$defConfig = array_merge($defConfig, $parameters);
$profile_id = (int)$defConfig['profile'];
$data = $defConfig['data'];
if ($profile_id <= 0)
{
$profile_id = 0;
}
/** @var Profiles $profile */
$profile = $this->container->factory->model('Profiles')->tmpInstance();
if ($profile_id)
{
$profile->find($profile_id);
}
$profile->import($data);
return true;
}
}
ListBackups.php 0000644 00000002174 15235344133 0007510 0 ustar 00 <?php
/**
* @package akeebabackup
* @copyright Copyright (c)2006-2023 Nicholas K. Dionysopoulos / Akeeba Ltd
* @license GNU General Public License version 3, or later
*/
namespace Akeeba\Backup\Site\Model\Json\Task;
// Protect from unauthorized access
defined('_JEXEC') || die();
use Akeeba\Backup\Site\Model\Statistics;
use Akeeba\Engine\Platform;
/**
* List the backup records
*/
class ListBackups extends AbstractTask
{
/**
* Execute the JSON API task
*
* @param array $parameters The parameters to this task
*
* @return mixed
*
* @throws \RuntimeException In case of an error
*/
public function execute(array $parameters = array())
{
// Get the passed configuration values
$defConfig = array(
'from' => 0,
'limit' => 50
);
$defConfig = array_merge($defConfig, $parameters);
$from = (int)$defConfig['from'];
$limit = (int)$defConfig['limit'];
/** @var Statistics $model */
$model = $this->container->factory->model('Statistics')->tmpInstance();
$model->setState('limitstart', $from);
$model->setState('limit', $limit);
return $model->getStatisticsListWithMeta(false);
}
}
Log.php 0000644 00000001317 15235344133 0006003 0 ustar 00 <?php
/**
* @package akeebabackup
* @copyright Copyright (c)2006-2023 Nicholas K. Dionysopoulos / Akeeba Ltd
* @license GNU General Public License version 3, or later
*/
namespace Akeeba\Backup\Site\Model\Json\Task;
// Protect from unauthorized access
defined('_JEXEC') || die();
/**
* Get the log contents
*
* @deprecated
*/
class Log extends AbstractTask
{
/**
* Execute the JSON API task
*
* @param array $parameters The parameters to this task
*
* @return mixed
*
* @throws \RuntimeException In case of an error
*/
public function execute(array $parameters = [])
{
throw new \RuntimeException('This method is no longer supported by the Akeeba Remote JSON API', 501);
}
}
RemoveIncludedDB.php 0000644 00000001417 15235344133 0010376 0 ustar 00 <?php
/**
* @package akeebabackup
* @copyright Copyright (c)2006-2023 Nicholas K. Dionysopoulos / Akeeba Ltd
* @license GNU General Public License version 3, or later
*/
namespace Akeeba\Backup\Site\Model\Json\Task;
// Protect from unauthorized access
defined('_JEXEC') || die();
use Joomla\CMS\Filter\InputFilter;
/**
* Remove an extra database definition
*
* @deprecated
*/
class RemoveIncludedDB extends AbstractTask
{
/**
* Execute the JSON API task
*
* @param array $parameters The parameters to this task
*
* @return mixed
*
* @throws \RuntimeException In case of an error
*/
public function execute(array $parameters = [])
{
throw new \RuntimeException('This method is no longer supported by the Akeeba Remote JSON API', 501);
}
}
RemoveIncludedDirectory.php 0000644 00000001454 15235344133 0012056 0 ustar 00 <?php
/**
* @package akeebabackup
* @copyright Copyright (c)2006-2023 Nicholas K. Dionysopoulos / Akeeba Ltd
* @license GNU General Public License version 3, or later
*/
namespace Akeeba\Backup\Site\Model\Json\Task;
// Protect from unauthorized access
defined('_JEXEC') || die();
use Joomla\CMS\Filter\InputFilter;
use RuntimeException;
/**
* Remove an extra directory definition
*
* @deprecated
*/
class RemoveIncludedDirectory extends AbstractTask
{
/**
* Execute the JSON API task
*
* @param array $parameters The parameters to this task
*
* @return mixed
*
* @throws RuntimeException In case of an error
*/
public function execute(array $parameters = [])
{
throw new \RuntimeException('This method is no longer supported by the Akeeba Remote JSON API', 501);
}
}
SaveConfiguration.php 0000644 00000001366 15235344133 0010714 0 ustar 00 <?php
/**
* @package akeebabackup
* @copyright Copyright (c)2006-2023 Nicholas K. Dionysopoulos / Akeeba Ltd
* @license GNU General Public License version 3, or later
*/
namespace Akeeba\Backup\Site\Model\Json\Task;
// Protect from unauthorized access
defined('_JEXEC') || die();
/**
* Save the configuration for a given profile
*
* @deprecated
*/
class SaveConfiguration extends AbstractTask
{
/**
* Execute the JSON API task
*
* @param array $parameters The parameters to this task
*
* @return mixed
*
* @throws \RuntimeException In case of an error
*/
public function execute(array $parameters = array())
{
throw new \RuntimeException('This method is no longer supported by the Akeeba Remote JSON API', 501);
}
}
SaveProfile.php 0000644 00000001334 15235344133 0007500 0 ustar 00 <?php
/**
* @package akeebabackup
* @copyright Copyright (c)2006-2023 Nicholas K. Dionysopoulos / Akeeba Ltd
* @license GNU General Public License version 3, or later
*/
namespace Akeeba\Backup\Site\Model\Json\Task;
// Protect from unauthorized access
defined('_JEXEC') || die();
/**
* Saves a backup profile
*
* @deprecated
*/
class SaveProfile extends AbstractTask
{
/**
* Execute the JSON API task
*
* @param array $parameters The parameters to this task
*
* @return mixed
*
* @throws \RuntimeException In case of an error
*/
public function execute(array $parameters = array())
{
throw new \RuntimeException('This method is no longer supported by the Akeeba Remote JSON API', 501);
}
}
SetDBFilter.php 0000644 00000001405 15235344133 0007367 0 ustar 00 <?php
/**
* @package akeebabackup
* @copyright Copyright (c)2006-2023 Nicholas K. Dionysopoulos / Akeeba Ltd
* @license GNU General Public License version 3, or later
*/
namespace Akeeba\Backup\Site\Model\Json\Task;
// Protect from unauthorized access
defined('_JEXEC') || die();
use Joomla\CMS\Filter\InputFilter;
/**
* Set or unset a database filter
*
* @deprecated
*/
class SetDBFilter extends AbstractTask
{
/**
* Execute the JSON API task
*
* @param array $parameters The parameters to this task
*
* @return mixed
*
* @throws \RuntimeException In case of an error
*/
public function execute(array $parameters = [])
{
throw new \RuntimeException('This method is no longer supported by the Akeeba Remote JSON API', 501);
}
}
SetFSFilter.php 0000644 00000001407 15235344133 0007414 0 ustar 00 <?php
/**
* @package akeebabackup
* @copyright Copyright (c)2006-2023 Nicholas K. Dionysopoulos / Akeeba Ltd
* @license GNU General Public License version 3, or later
*/
namespace Akeeba\Backup\Site\Model\Json\Task;
// Protect from unauthorized access
defined('_JEXEC') || die();
use Joomla\CMS\Filter\InputFilter;
/**
* Set or unset a filesystem filter
*
* @deprecated
*/
class SetFSFilter extends AbstractTask
{
/**
* Execute the JSON API task
*
* @param array $parameters The parameters to this task
*
* @return mixed
*
* @throws \RuntimeException In case of an error
*/
public function execute(array $parameters = [])
{
throw new \RuntimeException('This method is no longer supported by the Akeeba Remote JSON API', 501);
}
}
SetIncludedDB.php 0000644 00000001424 15235344133 0007672 0 ustar 00 <?php
/**
* @package akeebabackup
* @copyright Copyright (c)2006-2023 Nicholas K. Dionysopoulos / Akeeba Ltd
* @license GNU General Public License version 3, or later
*/
namespace Akeeba\Backup\Site\Model\Json\Task;
// Protect from unauthorized access
defined('_JEXEC') || die();
use Joomla\CMS\Filter\InputFilter;
/**
* Set up or edit an extra database definition
*
* @deprecated
*/
class SetIncludedDB extends AbstractTask
{
/**
* Execute the JSON API task
*
* @param array $parameters The parameters to this task
*
* @return mixed
*
* @throws \RuntimeException In case of an error
*/
public function execute(array $parameters = [])
{
throw new \RuntimeException('This method is no longer supported by the Akeeba Remote JSON API', 501);
}
}
SetIncludedDirectory.php 0000644 00000001434 15235344133 0011352 0 ustar 00 <?php
/**
* @package akeebabackup
* @copyright Copyright (c)2006-2023 Nicholas K. Dionysopoulos / Akeeba Ltd
* @license GNU General Public License version 3, or later
*/
namespace Akeeba\Backup\Site\Model\Json\Task;
// Protect from unauthorized access
defined('_JEXEC') || die();
use Joomla\CMS\Filter\InputFilter;
/**
* Set up or edit an extra directory definition
*
* @deprecated
*/
class SetIncludedDirectory extends AbstractTask
{
/**
* Execute the JSON API task
*
* @param array $parameters The parameters to this task
*
* @return mixed
*
* @throws \RuntimeException In case of an error
*/
public function execute(array $parameters = [])
{
throw new \RuntimeException('This method is no longer supported by the Akeeba Remote JSON API', 501);
}
}
SetRegexDBFilter.php 0000644 00000001420 15235344133 0010357 0 ustar 00 <?php
/**
* @package akeebabackup
* @copyright Copyright (c)2006-2023 Nicholas K. Dionysopoulos / Akeeba Ltd
* @license GNU General Public License version 3, or later
*/
namespace Akeeba\Backup\Site\Model\Json\Task;
// Protect from unauthorized access
defined('_JEXEC') || die();
use Joomla\CMS\Filter\InputFilter;
/**
* Set or unset a Regex database filter
*
* @deprecated
*/
class SetRegexDBFilter extends AbstractTask
{
/**
* Execute the JSON API task
*
* @param array $parameters The parameters to this task
*
* @return mixed
*
* @throws \RuntimeException In case of an error
*/
public function execute(array $parameters = [])
{
throw new \RuntimeException('This method is no longer supported by the Akeeba Remote JSON API', 501);
}
}
SetRegexFSFilter.php 0000644 00000001422 15235344133 0010404 0 ustar 00 <?php
/**
* @package akeebabackup
* @copyright Copyright (c)2006-2023 Nicholas K. Dionysopoulos / Akeeba Ltd
* @license GNU General Public License version 3, or later
*/
namespace Akeeba\Backup\Site\Model\Json\Task;
// Protect from unauthorized access
defined('_JEXEC') || die();
use Joomla\CMS\Filter\InputFilter;
/**
* Set or unset a Regex filesystem filter
*
* @deprecated
*/
class SetRegexFSFilter extends AbstractTask
{
/**
* Execute the JSON API task
*
* @param array $parameters The parameters to this task
*
* @return mixed
*
* @throws \RuntimeException In case of an error
*/
public function execute(array $parameters = [])
{
throw new \RuntimeException('This method is no longer supported by the Akeeba Remote JSON API', 501);
}
}
StartBackup.php 0000644 00000005603 15235344133 0007507 0 ustar 00 <?php
/**
* @package akeebabackup
* @copyright Copyright (c)2006-2023 Nicholas K. Dionysopoulos / Akeeba Ltd
* @license GNU General Public License version 3, or later
*/
namespace Akeeba\Backup\Site\Model\Json\Task;
// Protect from unauthorized access
defined('_JEXEC') || die();
use Akeeba\Engine\Factory;
use Akeeba\Engine\Platform;
use Joomla\CMS\Filter\InputFilter;
/**
* Start a backup job
*/
class StartBackup extends AbstractTask
{
/**
* Execute the JSON API task
*
* @param array $parameters The parameters to this task
*
* @return mixed
*
* @throws \RuntimeException In case of an error
*/
public function execute(array $parameters = [])
{
$filter = InputFilter::getInstance();
// Get the passed configuration values
$defConfig = [
'profile' => 1,
'description' => '',
'comment' => '',
'backupid' => null,
'overrides' => [],
];
$defConfig = array_merge($defConfig, $parameters);
$profile = (int) $defConfig['profile'];
$profile = max(1, $profile); // Make sure $profile is a positive integer >= 1
$description = $filter->clean($defConfig['description'], 'string');
$comment = $filter->clean($defConfig['comment'], 'string');
$overrides = $filter->clean($defConfig['overrides'], 'array');
if (empty($description))
{
$description = $this->container->factory->model('Backup')->getDefaultDescription() . ' (JSON API)';
}
$this->container->platform->setSessionVar('profile', $profile, 'akeeba');
define('AKEEBA_PROFILE', $profile);
/**
* DO NOT REMOVE!
*
* The Model will only try to load the configuration after nuking the factory. This causes Profile 1 to be
* loaded first. Then it figures out it needs to load a different profile and it does – but the protected keys
* are NOT replaced, meaning that certain configuration parameters are not replaced. Most notably, the chain.
* This causes backups to behave weirdly. So, DON'T REMOVE THIS UNLESS WE REFACTOR THE MODEL.
*/
Platform::getInstance()->load_configuration($profile);
/** @var \Akeeba\Backup\Site\Model\Backup $model */
$model = $this->container->factory->model('Backup')->tmpInstance();
$model->setState('tag', 'json');
$model->setState('description', $description);
$model->setState('comment', $comment);
$model->setState('profile', $profile);
$array = $model->startBackup($overrides);
if ($array['Error'] != '')
{
throw new \RuntimeException('A backup error has occurred: ' . $array['Error'], 500);
}
// BackupID contains the numeric backup record ID. backupid contains the backup id (usually in the form id123)
$statistics = Factory::getStatistics();
$array['BackupID'] = $statistics->getId();
// Remote clients expect a boolean, not an integer.
$array['HasRun'] = ($array['HasRun'] === 0);
$array['Profile'] = Platform::getInstance()->get_active_profile();
return $array;
}
}
StepBackup.php 0000644 00000004341 15235344133 0007323 0 ustar 00 <?php
/**
* @package akeebabackup
* @copyright Copyright (c)2006-2023 Nicholas K. Dionysopoulos / Akeeba Ltd
* @license GNU General Public License version 3, or later
*/
namespace Akeeba\Backup\Site\Model\Json\Task;
// Protect from unauthorized access
defined('_JEXEC') || die();
use Akeeba\Engine\Factory;
use Akeeba\Engine\Platform;
use Joomla\CMS\Filter\InputFilter;
/**
* Step through a backup job
*/
class StepBackup extends AbstractTask
{
/**
* Execute the JSON API task
*
* @param array $parameters The parameters to this task
*
* @return mixed
*
* @throws \RuntimeException In case of an error
*/
public function execute(array $parameters = [])
{
$filter = InputFilter::getInstance();
// Get the passed configuration values
$defConfig = [
'tag' => 'json',
'backupid' => null,
];
$defConfig = array_merge($defConfig, $parameters);
$tag = $filter->clean($defConfig['tag'], 'cmd');
$backupid = $filter->clean($defConfig['backupid'], 'cmd');
if (empty($backupid))
{
throw new \RuntimeException("JSON API :: stepBackup -- You have not provided the required backupid parameter. This parameter is MANDATORY since May 2016. Please update your client software to include this parameter.");
}
/** @var \Akeeba\Backup\Site\Model\Backup $model */
$model = $this->container->factory->model('Backup')->tmpInstance();
$profile = max(1, (int) $model->getLastBackupProfile($tag, $backupid));
$this->container->platform->setSessionVar('profile', $profile, 'akeeba');
define('AKEEBA_PROFILE', $profile);
$model->setState('tag', $tag);
$model->setState('backupid', $backupid);
$model->setState('profile', $profile);
$array = $model->stepBackup(true);
if ($array['Error'] != '')
{
throw new \RuntimeException('A backup error has occurred: ' . $array['Error'], 500);
}
// BackupID contains the numeric backup record ID. backupid contains the backup id (usually in the form id123)
$statistics = Factory::getStatistics();
$array['BackupID'] = $statistics->getId();
// Remote clients expect a boolean, not an integer.
$array['HasRun'] = ($array['HasRun'] === 0);
$array['Profile'] = Platform::getInstance()->get_active_profile();
return $array;
}
}
TestDBConnection.php 0000644 00000001415 15235344133 0010426 0 ustar 00 <?php
/**
* @package akeebabackup
* @copyright Copyright (c)2006-2023 Nicholas K. Dionysopoulos / Akeeba Ltd
* @license GNU General Public License version 3, or later
*/
namespace Akeeba\Backup\Site\Model\Json\Task;
// Protect from unauthorized access
defined('_JEXEC') || die();
use Joomla\CMS\Filter\InputFilter;
/**
* Test an extra database definition
*
* @deprecated
*/
class TestDBConnection extends AbstractTask
{
/**
* Execute the JSON API task
*
* @param array $parameters The parameters to this task
*
* @return mixed
*
* @throws \RuntimeException In case of an error
*/
public function execute(array $parameters = [])
{
throw new \RuntimeException('This method is no longer supported by the Akeeba Remote JSON API', 501);
}
}
UpdateGetInformation.php 0000644 00000001412 15235344133 0011346 0 ustar 00 <?php
/**
* @package akeebabackup
* @copyright Copyright (c)2006-2023 Nicholas K. Dionysopoulos / Akeeba Ltd
* @license GNU General Public License version 3, or later
*/
namespace Akeeba\Backup\Site\Model\Json\Task;
// Protect from unauthorized access
defined('_JEXEC') || die();
use Joomla\CMS\Filter\InputFilter;
/**
* Get the update information
*
* @deprecated
*/
class UpdateGetInformation extends AbstractTask
{
/**
* Execute the JSON API task
*
* @param array $parameters The parameters to this task
*
* @return mixed
*
* @throws \RuntimeException In case of an error
*/
public function execute(array $parameters = [])
{
throw new \RuntimeException('This method is no longer supported by the Akeeba Remote JSON API', 501);
}
}