1. Go to this page and download the library: Download genilto/sbackup library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
\genilto\sbackup\SBackup;
use \genilto\sbackup\adapters\SBackupDropbox;
use \genilto\sbackup\store\FileDataStore;
use \genilto\sbackup\logger\SBLogger;
use \Analog\Analog;
use \Analog\Logger;
// Defines the default timezone
Analog::$timezone = 'America/Sao_Paulo';
date_default_timezone_set(Analog::$timezone);
if (!function_exists('createDefaultLogger')) {
/**
* Creates the default logger using Analog as Logger class
* Any other PSR-3 Logger could be used
*
* @return SBLogger
*/
function createDefaultSBackupLogger () {
// Creates the Default Logger
$logger = new Logger();
// Define where to save the logs
$currentDate = date("Y-m-d");
$logger->handler (__DIR__ . "/$currentDate-sbackup.log");
// Return a SBLogger instance
return new SBLogger($logger, 3); // 3 - Full Logging
}
}
/**
* Define the IENT_SECRET);
// The main SBackup class that will the available to be used
$SBackup = new SBackup($SBUploader, $SBLogger);
// In production, it is very important to create some kind of
// Authorization, blocking users that do not have access to authenticate with
// the cloud service, as dropbox.
// If anyone reachs this page, they could authenticate their
// own account and then receive all your uploaded files!!
// Include the backup.config.php file so we have the $SBackup object available
* Return the error description of the uploaded file
*
* @param string $path
*
* @return string|false The function returns the error description or false on failure.
*/
function getUploadErrorDescription ($uploadErrorCode) {
$phpFileUploadErrors = array(
0 => 'There is no error, the file uploaded with success',
1 => 'The uploaded file exceeds the upload_max_filesize directive in php.ini',
2 => 'The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form',
3 => 'The uploaded file was only partially uploaded',
4 => 'No file was uploaded',
6 => 'Missing a temporary folder',
7 => 'Failed to write file to disk.',
8 => 'A PHP extension stopped the file upload.',
);
if (isset($phpFileUploadErrors[$uploadErrorCode])) {
return $phpFileUploadErrors[$uploadErrorCode];
}
return false;
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.